pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Tanner <br...@fireplan.ca>
Subject Re: Null Pointer Exceptions when trying to set field value
Date Sun, 08 Jan 2017 22:35:07 GMT
Yup. All good.

Thank you very much for the quick response and great project!


--
Brian Tanner
Operations Manager, Fire Inspector
brian@fireplan.ca
204-975-4901 Extension 102

Fire Plan Strategies: Fire safety training, planning, signs, and supplies across Canada!

> On Jan 8, 2017, at 4:01 PM, Tilman Hausherr <THausherr@t-online.de> wrote:
> 
> Hi,
> 
> Please test with a snapshot:
> https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/2.0.5-SNAPSHOT/
<https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/2.0.5-SNAPSHOT/>
> 
> Your stack trace looks like a problem that was solved recently ( https://issues.apache.org/jira/browse/PDFBOX-3638
<https://issues.apache.org/jira/browse/PDFBOX-3638> ).
> 
> If it still doesn't work, please post the smallest possible code that reproduces the
problem.
> 
> Tilman
> 
> Am 08.01.2017 um 22:53 schrieb Brian Tanner:
>> Hi all. I’m green as grass, so apologies in advance.
>> 
>> I am creating a PDF in the following way:
>> a) Creating various template files with placeholders in Adobe inDesign
>> b) Extendscript (Adobe scripting tools) used to put together templates, fill text
values, **create TextBox FormFields**, export as an Adobe Interactive PDF all through Indesign.
>> 
>> I’m working on a Mac.
>> 
>> Out pops a nice PDF that I can open and fill values in with either Preview.app or
Acrobat Pro.  In Acrobat, when go Tools->Prepare form, all my fields are there with their
names set correctly.
>> 
>> What I *want* is to pre-fill known values on these forms as part of this automated
workflow.
>> 
>> Apparently it is impossible to  pre-fill/set default form field values from within
inDesign.
>> 
>> Scripting control of Acrobat to load form field values from a text file is not trivial.
Could be done manually.
>> 
>> Google quickly helped me zero in on the PDFBox project, which seems awesome and will
be useful for various things I do. Hooray.
>> 
>> However, I’m having trouble right off the bat because with 2.04 I am getting a
null pointer exception when I try to set a form field value:
>> 
>> Exception in thread "main" java.lang.NullPointerException
>> 	at org.apache.pdfbox.pdmodel.PDResources.add(PDResources.java:675)
>> 	at org.apache.pdfbox.pdmodel.PDResources.add(PDResources.java:573)
>> 	at org.apache.pdfbox.pdmodel.PDPageContentStream.getName(PDPageContentStream.java:964)
>> 	at org.apache.pdfbox.pdmodel.PDPageContentStream.setStrokingColor(PDPageContentStream.java:979)
>> 	at org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.initializeAppearanceContent(AppearanceGeneratorHelper.java:221)
>> 	at org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:167)
>> 	at org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:263)
>> 	at org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:228)
>> 	at org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:218)
>> 	at com.fireplan.pdf.PDFFillTester.main(PDFFillTester.java:55)
>> 
>> It seems like there is some form setup that I need to do either at the inDesign stage
or with PDFBox before I can fill my form fields. Anyone have any direction?
>> 
>> Here is a download link from one of the forms with the issue:
>> https://dl.dropboxusercontent.com/u/5922585/ContactForms-Fillable-2017-1-8_919.pdf
<https://dl.dropboxusercontent.com/u/5922585/ContactForms-Fillable-2017-1-8_919.pdf>
<https://dl.dropboxusercontent.com/u/5922585/ContactForms-Fillable-2017-1-8_919.pdf <https://dl.dropboxusercontent.com/u/5922585/ContactForms-Fillable-2017-1-8_919.pdf>>
>> 
>> If I export my document without form fields from indesign, then create them with
indesign using the automatic features, then the PDFBox code works.
>> 
>> So, obviously inDesign is not doing something with the interactive PDF setup that
PDFBox needs/wants that Acrobat does.  I just have no idea what.
>> 
>> Any help would be much appreciated.
>> 
>> --
>> Brian Tanner
>> Operations Manager, Fire Inspector
>> brian@fireplan.ca <mailto:brian@fireplan.ca>
>> 204-975-4901 Extension 102
>> 
>> Fire Plan Strategies: Fire safety training, planning, signs, and supplies across
Canada!
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org <mailto:users-unsubscribe@pdfbox.apache.org>
> For additional commands, e-mail: users-help@pdfbox.apache.org <mailto:users-help@pdfbox.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message