pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maruan Sahyoun <sahy...@fileaffairs.de>
Subject Re: Problems combining files with form fields
Date Tue, 05 May 2015 13:29:35 GMT
Hi Gilad

> Am 05.05.2015 um 14:37 schrieb Maruan Sahyoun <sahyoun@fileaffairs.de>:
> 
> Hi,
> 
>> Am 05.05.2015 um 14:34 schrieb Gilad Denneboom <gilad.denneboom@gmail.com>:
>> 
>> Sure, I'd be happy to.
>> 
>> So do you know what went wrong when I used the merger util?
> 
> not yet - haven't looked into that one as I first wanted to answer the easier questions
:-)

OK - the reason is that after merging the files the AcroForms field entries and the annotations
which are defined on the page no longer match so although the form fields exist and they have
annotations you won't see the entries on the page as they are not pointing to one. In addition
the existing annotations are no longer part of the AcroForms definition so the visual content
you see is not accessible from the AcroForms fields.

So where with your input form where AcroForms and annotations representing the fields were
connected after merging AcroForms and annotations exist in parallel but are no longer connected.

Which version of PDFBox are you using? 


BR
Maruan

> 
> BR
> Maruan
> 
>> 
>> On Tue, May 5, 2015 at 2:32 PM, Maruan Sahyoun <sahyoun@fileaffairs.de>
>> wrote:
>> 
>>> Hi,
>>> 
>>>> Am 05.05.2015 um 14:21 schrieb Gilad Denneboom <
>>> gilad.denneboom@gmail.com>:
>>>> 
>>>> Wow, that's unfortunate... What about the PDFMergerUtility, though? Does
>>> it
>>>> have the same limitation?
>>> 
>>> no - that's merging the AcroForms and annotations.
>>> 
>>> I added https://issues.apache.org/jira/browse/PDFBOX-2787 <
>>> https://issues.apache.org/jira/browse/PDFBOX-2787> to maybe come up with
>>> an easier mechanism. If you would be willing to work on that feature I'm
>>> happy to support you.
>>> 
>>> BR
>>> Maruan
>>> 
>>>> 
>>>> On Tue, May 5, 2015 at 2:13 PM, Maruan Sahyoun <sahyoun@fileaffairs.de>
>>>> wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>>>> Am 05.05.2015 um 11:59 schrieb Gilad Denneboom <
>>>>> gilad.denneboom@gmail.com>:
>>>>>> 
>>>>>> Correct. And in some of the cases (example1) I can't even edit the
form
>>>>>> fields properly after inserting the file to another PDF.
>>>>> 
>>>>> reason is that importPage/addPage add the page content but not the form
>>>>> fields. You'd need to add the AcroForms manually (potentially looking
at
>>>>> which PDWidgetAnnotations are really pointing at the page you are
>>> adding)
>>>>> 
>>>>> BR
>>>>> 
>>>>> Maruan
>>>>> 
>>>>>> 
>>>>>> On Tue, May 5, 2015 at 11:55 AM, Maruan Sahyoun <
>>> sahyoun@fileaffairs.de>
>>>>>> wrote:
>>>>>> 
>>>>>>> Hi Gilad,
>>>>>>> 
>>>>>>>> Am 05.05.2015 um 11:45 schrieb Gilad Denneboom <
>>>>>>> gilad.denneboom@gmail.com>:
>>>>>>>> 
>>>>>>>> Hi Maruan,
>>>>>>>> 
>>>>>>>> Sure, here they are...
>>>>>>>> 
>>>>>>>> Gilad
>>>>>>>> ​
>>>>>>>> batch_sequences 1.pdf
>>>>>>>> <
>>>>>>> 
>>>>> 
>>> https://docs.google.com/file/d/0B_eBFHMNjkhsNmlPNjJMcTJVXzQ/edit?usp=drive_web
>>>>>>>> 
>>>>>>>> ​​
>>>>>>>> Input form.pdf
>>>>>>>> <
>>>>>>> 
>>>>> 
>>> https://docs.google.com/file/d/0B_eBFHMNjkhsaWlHbmYzSEFpX0U/edit?usp=drive_web
>>>>>>>> 
>>>>>>>> ​
>>>>>>>> 
>>>>>>>> On Tue, May 5, 2015 at 11:36 AM, Maruan Sahyoun <
>>>>> sahyoun@fileaffairs.de>
>>>>>>>> wrote:
>>>>>>>> 
>>>>>>>>> Hi Gilad,
>>>>>>>>> 
>>>>>>>>>> Am 05.05.2015 um 11:30 schrieb Gilad Denneboom <
>>>>>>>>> gilad.denneboom@gmail.com>:
>>>>>>>>>> 
>>>>>>>>>> Hi guys,
>>>>>>>>>> 
>>>>>>>>>> This should be a simple task, but it turns out to
be quite a
>>> complex
>>>>>>> and
>>>>>>>>>> problematic one, I'm afraid...
>>>>>>>>>> I'm trying to combine two files, one with a bunch
of form fields in
>>>>> it
>>>>>>> (a
>>>>>>>>>> single page, created in Acrobat) and one without
any fields. I have
>>>>>>> tried
>>>>>>>>>> doing it using three different methods, and all three
have failed,
>>> in
>>>>>>>>>> various ways.
>>>>>>>>>> 
>>>>>>>>>> Method 1: PDDocument importPage
>>>>>>>>>> I tried importing the page with the form fields into
the existing
>>>>>>> files.
>>>>>>>>>> The page is placed at the end of the document (I
need it at the
>>>>>>>>> start...),
>>>>>>>>>> but that's not the big issue. The big issue is that
although the
>>> page
>>>>>>>>> with
>>>>>>>>>> the form fields is added to the file, the PDAcroForm
in the new
>>> file
>>>>> is
>>>>>>>>>> null and I'm having weird problems editing the form
fields in
>>> Acrobat
>>>>>>>>> (see
>>>>>>>>>> "example1.pdf", try to make a selection in one of
the drop-downs in
>>>>>>>>>> Acrobat).
>>>>>>>>>> 
>>>>>>>>>> Method 2: PDDocument addPage (how is this different
from
>>> importPage,
>>>>> by
>>>>>>>>> the
>>>>>>>>>> way? The documentation is very lacking on this point.
Also, why
>>> isn't
>>>>>>> it
>>>>>>>>>> possible to specify the page number where you want
to insert the
>>> new
>>>>>>>>> page?)
>>>>>>>>>> The result is similar to importPage, only now I am
able to make a
>>>>>>>>> selection
>>>>>>>>>> in the drop-down fields in Acrobat, but they are
still not picked
>>> up
>>>>> by
>>>>>>>>>> PDFBox when I re-load the file and try to access
them (see
>>>>>>>>> "example2.pdf").
>>>>>>>>>> 
>>>>>>>>>> Method 3: PDFMergerUtililty
>>>>>>>>>> In order to get the right page order I decided to
merge the files
>>>>>>> instead
>>>>>>>>>> of adding one to the other.
>>>>>>>>>> Here the PDAcroForm object does exist in the merged
files, but the
>>>>>>> values
>>>>>>>>>> of the fields are not picked up. Using getValue on
the fields
>>> returns
>>>>>>> the
>>>>>>>>>> default value for the drop-downs and null for the
text fields, even
>>>>>>>>> though
>>>>>>>>>> they are clearly filled-in (see "example3.pdf").
>>>>>>> 
>>>>>>> So what you are saying is that looking at the form with Adobe
Reader
>>> the
>>>>>>> form is fine but trying to get the value using PDFBox you are
not
>>>>> getting
>>>>>>> the value you are looking for?
>>>>>>> 
>>>>>>> BR
>>>>>>> Maruan
>>>>>>> 
>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Any help is appreciated…
>>>>>>>>> 
>>>>>>>>> Could you also upload the individual files prior to merging?
>>>>>>>>> 
>>>>>>>>> BR
>>>>>>>>> Maruan
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Regards, Gilad.
>>>>>>>>>> ​
>>>>>>>>>> example1.pdf
>>>>>>>>>> <
>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> https://docs.google.com/file/d/0B_eBFHMNjkhscDdvcGhXNjRMZ28/edit?usp=drive_web
>>>>>>>>>> 
>>>>>>>>>> ​​
>>>>>>>>>> example2.pdf
>>>>>>>>>> <
>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> https://docs.google.com/file/d/0B_eBFHMNjkhsck9RSTlNTWFtaHc/edit?usp=drive_web
>>>>>>>>>> 
>>>>>>>>>> ​​
>>>>>>>>>> example3.pdf
>>>>>>>>>> <
>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> https://docs.google.com/file/d/0B_eBFHMNjkhsQXBRdVdDMGkyR2s/edit?usp=drive_web
>>>>>>>>>> 
>>>>>>>>>> ​
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>>>> 
>>>>>>> 
>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>> 
>>>>> 
>>> 
>>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message