Question

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?

Was it helpful?

Solution

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);

OTHER TIPS

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

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

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.

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

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.

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top