codejitsu
codejitsu

Reputation: 3182

PDF-Form Text hidden unless clicked

In my application I have to fill a predefined PDF form with data from DB. We are using Java and Pdfbox. The filling itself is not a problem.

The problem is that in resulting PDF-file all texts in the form are invisible (or hidden, also grey rectangles) unless field clicked.

How can I solve this problem?

Upvotes: 5

Views: 26144

Answers (9)

Jakub Pawlowski
Jakub Pawlowski

Reputation: 247

Map over all text form fields and programmatically nuke DA, MK and AP entries in a PDF dictionary - those are references to styles so they can include things like fonts that other machine might not have installed and therefore by default they displays as blanks.

Upvotes: 0

Marcelo095
Marcelo095

Reputation: 1

In my case I solved it by changing the font to Arial (or one of the standard in windows set), in the 'Appearance' tab, in properties. Before, it was set Helvetica which was not embedded in the file and that I think generated the problem.

Upvotes: 0

nevster
nevster

Reputation: 6465

Nothing I tried here worked - except to change software.

I was using PDFElement 6 Pro (trial) and couldn't make it work. Tried all sorts of things with PDFBox plus all suggestions above.

Ended up trying https://www.pdfescape.com/ and it all worked just fine.

Upvotes: 0

dirkk
dirkk

Reputation: 6218

I had the same problem when I tried to programmatically fill PDF forms using pdfbox. I add this answer to a rather old question as all the other answers manipulate the original PDF, which is not always an option.

The problem with invisible form fields just appeared in Acrobat PDF, other PDF renderers showed it fine. If using pdfbox 1.8.x you have to set Need Appearances as explained here:

PDAcroForm form = docCatalog.getAcroForm();
form.getDictionary().setItem(COSName.getPDFName("NeedAppearances"), COSBoolean.TRUE);

If using pdfbox 2 this is simplified to:

PDAcroForm form = docCatalog.getAcroForm();
form.setNeedAppearances(true);

Upvotes: 11

Susie
Susie

Reputation: 21

I just ran across this and tried a combination of things before one very simple thing worked. I have Adobe Acrobat 9.0 and I couldn't find some of the options written here.

What I ended up doing was a two-pronged process: I went to Forms > Manage Form Data > Export Data; I then saved that file on my desktop. Next, I went back to Forms > Manage Form Data but instead selected Import Data, and selected that file I'd just saved. Bingo! Everything filled in properly.

Upvotes: 2

adamold
adamold

Reputation: 11

in the appearance tab of each erroneously hidden object you will see the "fill color" set to none. set it to none again (just click on it) and save the PDF and these fields will show up normally. I can't believe adobe has let this error persist for so long. It happens constantly when viewing/saving with multiple pdf readers.

Upvotes: 1

BoBFiSh
BoBFiSh

Reputation: 102

I don't quite know how you can stop it happening in the future but a resolution to getting the file working, similar to g-eorge is to open it in adobe acrobat pro, in tools on the right hand menu select "Interactive objects" and choose select object.

When you highlight the first field you want to fix, you should then be able to control-a to select all interactive objects. Once all are selected, right click on one field and select properties.

In the "general" tab the bottom option should have "common properties" which has the option "form field" change this to hidden and then back to visible. This will then restore all visibility to the form.

This has worked for me on all the rare instances when I receive this, and hasn't failed me once. Hope it does the same for you,

BoB

Upvotes: 1

g-eorge
g-eorge

Reputation: 3346

I had this exact problem with a form I was filling with PDFBox in Java.

I fixed it by opening the original (blank) PDF form in Acrobat Pro and changing some options for each of the problem text fields. The options might vary for you, but here's what worked for me:

In the Acrobat Pro menu bar go to Forms > Add or edit fields. Right click the text field in Acrobat Pro and select properties, then:

In the 'Options' tab:

  • Untick all options except 'scroll long text'
  • Add a few space characters in to the Default Value box

In the 'Appearance' tab:

  • Set the font size to 'auto'

Click 'close form editing' and save the file.

Field Options

Upvotes: 4

Zalia
Zalia

Reputation: 29

I read this on a forum and worked for me:

Using Adobe Acrobat Pro, I exported the form using "Export Data" to a XML and then imported it back from XML-file with "Import Data". Those commands are under Forms/Manage Forms Data

This is the link to the post: http://forums.adobe.com/thread/637421

Upvotes: 2

Related Questions