You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Wade Polk <wi...@mddv.com> on 2019/12/10 12:58:19 UTC

PDFBox 1.8.10 Question

Hello Mailing List,



Please forgive me if I’m doing this wrong, I’ve never actually used a
mailing list for support like this but a developer said this was the best
thing to do so here I am.



Long story short, I am attempting to use an older version of PDFBox
(1.8.10) to fill out and sign a PDF form. All form fields and signature
lines will be on the document long before this. It needs to be signed with
a certificate and it needs to operate very much like it does in acrobat,
were you see a picture and can click on it for signature details. I’ve
attached my short code to keep this simple… my biggest issue has been
related to understanding the object hierarchies and purpose… documentation
is sparse so it confuses me (e.g. PDSignature.setContents: “Sets the
contents.” … doesn’t really tell me much, I’m guessing this is for setting
the img or perhaps the actual certificate).

RE: RE: PDFBox 1.8.10 Question

Posted by Wade Polk <wi...@mddv.com>.
I fixed it, added the second line in below code before completing the text
fields based on:
 -
https://stackoverflow.com/questions/30549830/attachment-damages-signature-part-2/30592558#30592558

PDDocument pdfDocument = PDDocument.load(pdfFile);
pdfDocument.getDocument().getTrailer().removeItem(COSName.TYPE);

I had read that post probably 10 times in trying to learn this library, only
now do I understand what they were talking about =).

-----Original Message-----
From: Wade Polk <wi...@mddv.com>
Sent: December 12, 2019 9:06 AM
To: 'users@pdfbox.apache.org' <us...@pdfbox.apache.org>
Subject: RE: RE: PDFBox 1.8.10 Question

Thanks, that is what I've been doing... fill out form, save, fill out
signature, save incrementally... but that breaks the signature which is what
started this thread.

Thanks for the help.

-----Original Message-----
From: Tilman Hausherr <TH...@t-online.de>
Sent: December 12, 2019 8:59 AM
To: users@pdfbox.apache.org
Subject: AW: RE: PDFBox 1.8.10 Question

I'll look at it later but I can tell immediately: don't do both. First fill
the form (the non signature parts). Save() it normally. Then reload and
handle the signature thing and save incrementally.

Tilman


------------------------------------------------------------------------
Gesendet mit der Telekom Mail App
<https://kommunikationsdienste.t-online.de/redirects/email_app_android_sendmail_footer>



--- Original-Nachricht ---
Von: Wade Polk
Betreff: RE: PDFBox 1.8.10 Question
Datum: 12.12.2019, 14:31 Uhr
An: users@pdfbox.apache.org




https://drive.google.com/file/d/17JtXs0d_DPgLQVCcdIQSd03VTsTe2xdJ/view?usp=sharing
<https://drive.google.com/file/d/17JtXs0d_DPgLQVCcdIQSd03VTsTe2xdJ/view?usp=sharing>

That's the link to the code you can download. I think your right about
incremental save... but no matter I try, I can fill out the form, I can sign
the form, but when I try to do both at the same time I break one or the
other.

-----Original Message-----
From: Tilman Hausherr <THausherr@t-online.de <ma...@t-online.de>
>
Sent: December 11, 2019 11:27 PM
To: users@pdfbox.apache.org <ma...@pdfbox.apache.org>
Subject: Re: PDFBox 1.8.10 Question

You responded to the wrong thread, so I am moving this back here...

I can't see your code except two lines, you need to upload this somewhere.

What I see is that you use save() instead of incremental save.

You need to first get the example to run, unchanged. The example uses
incremental save. Then make your changes.

If it still doesn't work, please upload source and result PDF and code to a
sharehoster.

As I wrote, the example in 1.8 doesn't support adding signatures to existing
PDFs but it may be worth a try with the code I posted.

To put a signature in a field it must be a empty signature field.

You can only add 1 signature at a time. I.e. load, sign, save incrementally.

Tilman

Am 11.12.2019 um 20:14 schrieb Wade Polk:
> In PDFBox 1.8.10, I sign the form with code very similar to the
> CreateVisibleSignature.java example.
>
> This seems to work well enough, however when I fill out the form FIRST
> using code like the below, it breaks the signature; when I click on
> the signature I see error message "Error during signature
> verification, Unexpected byte range values defining scope of signed
> data., Details: The signature byte range is invalid."
>
> This is how I set field on my form fields:
> PDTextbox field = (PDTextbox) acroForm.getField
<http://acroForm.getField> ( fieldName );
> field.setValue(fieldValue <http://field.setValue(fieldValue> );
pdfDocument.save(pdfFilePath <http://pdfDocument.save(pdfFilePath> );
>
> I get the impression I have to associate every applicable field with
> this signature, but just a guess.
>
> Note:
> - My form has 8 signatures and various fields to be filled out by each.
> - I would prefer to have all fields and signature lines locked on the
> PDF beforehand and then just to set them with my code, but I believe
> with this version you can only place a signature and not fill out an
> existing signature field, correct?
>
> I definitely feel like I'm missing something, any help is appreciated.
>
>
> -----Original Message-----
> From: Tilman Hausherr <THausherr@t-online.de
<ma...@t-online.de> >
> Sent: December 11, 2019 1:46 PM
> To: users@pdfbox.apache.org <ma...@pdfbox.apache.org>
> Subject: Re: Page boxes differ between Acrobat and PDFBox
>
> Ouch, I've known about this, but put it on low priority because I've
> never seen such a file before. I've opened
>
> https://issues.apache.org/jira/browse/PDFBOX-4706
<https://issues.apache.org/jira/browse/PDFBOX-4706>
>
> I'm not yet sure what to do, but COSName.USER_UNIT is the minimum.
> Getter/Setter probably too.
>
> Tilman
>
> Am 11.12.2019 um 18:31 schrieb Gilad Denneboom:
>> Hmm, that's very interesting. Should PDFBox take that value into
>> account when reporting the page size, then?
>> I see this is a property of the page. Should this be added to PDFBox
>> through a getter/setter? Or at least UserUnit should be added to the
>> COSName enum?
>> Thanks a lot for the information, anyway. It gives me a way to solve
>> this issue!
>>
>> On Wed, Dec 11, 2019 at 4:24 PM Peter Wyatt <petervwyatt@gmail.com
<ma...@gmail.com> >
>> wrote:
>>
>>> The sample PDF provided has a /UserUnit key with the value 3 in the
>>> Page dictionary. This key was introduced in PDF 1.6 and is described
>>> in various specifications along the lines of "(Optional; PDF 1.6) A
>>> positive number giving the size of default user space units, in
>>> multiples of 1 ⁄ 72 inch." so it is a scaling factor on default user
>>> space. So, based on what you have reported, Acrobat is entirely
>>> correct and confirmed by other tooling.
>>>
>>> Peter
>>> ISO 32000 co-Project Leader
>>>
>>> On Wed, Dec 11, 2019 at 10:13 AM Gilad Denneboom
>>> <gilad.denneboom@gmail.com <ma...@gmail.com> > wrote:
>>>> Hi all,
>>>>
>>>> This issue really stumps me. I'm getting different page box values
>>> between
>>>> PDFBox and Acrobat, and even within Acrobat itself...
>>>> The files I'm working with are very large housing plans.
>>>> When I open them in Acrobat it reports the page size to be 35.93 x
>>>> 435.20 inches, but when I use a script I get different results,
>>>> namely 11.97 x
>>>> 145.06 inches, which is also what I'm getting when I use PDFBox
2.0.16.
>>> It
>>>> seems the difference is exactly 1/3, ie the page boxes reported by
>>> Acrobat
>>>> are 3 times as large as those PDFBox and the script find. The same
>>>> is
>>> true
>>>> of all boxes (Crop, Trim, Bleed, Art, etc.).
>>>> I think the results reported by Acrobat are the correct ones, but I
>>>> can't figure out where they're coming from... Any insight would be
>>>> very much appreciated.
>>>>
>>>> A sample file can be found here:
>>>> https://drive.google.com/open?id=1FeFs1W0Iesz6Kcq3wTU_LclyIgmFBOsF
<https://drive.google.com/open?id=1FeFs1W0Iesz6Kcq3wTU_LclyIgmFBOsF>
>>>>
>>>> Thanks in advance!
>>> --------------------------------------------------------------------
>>> - To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
<ma...@pdfbox.apache.org>
>>> For additional commands, e-mail: users-help@pdfbox.apache.org
<ma...@pdfbox.apache.org>
>>>
>>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
<ma...@pdfbox.apache.org>
> For additional commands, e-mail: users-help@pdfbox.apache.org
<ma...@pdfbox.apache.org>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
<ma...@pdfbox.apache.org>
> For additional commands, e-mail: users-help@pdfbox.apache.org
<ma...@pdfbox.apache.org>
>


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

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

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


RE: RE: PDFBox 1.8.10 Question

Posted by Wade Polk <wi...@mddv.com>.
Thanks, that is what I've been doing... fill out form, save, fill out
signature, save incrementally... but that breaks the signature which is what
started this thread.

Thanks for the help.

-----Original Message-----
From: Tilman Hausherr <TH...@t-online.de>
Sent: December 12, 2019 8:59 AM
To: users@pdfbox.apache.org
Subject: AW: RE: PDFBox 1.8.10 Question

I'll look at it later but I can tell immediately: don't do both. First fill
the form (the non signature parts). Save() it normally. Then reload and
handle the signature thing and save incrementally.

Tilman


------------------------------------------------------------------------
Gesendet mit der Telekom Mail App
<https://kommunikationsdienste.t-online.de/redirects/email_app_android_sendmail_footer>



--- Original-Nachricht ---
Von: Wade Polk
Betreff: RE: PDFBox 1.8.10 Question
Datum: 12.12.2019, 14:31 Uhr
An: users@pdfbox.apache.org




https://drive.google.com/file/d/17JtXs0d_DPgLQVCcdIQSd03VTsTe2xdJ/view?usp=sharing
<https://drive.google.com/file/d/17JtXs0d_DPgLQVCcdIQSd03VTsTe2xdJ/view?usp=sharing>

That's the link to the code you can download. I think your right about
incremental save... but no matter I try, I can fill out the form, I can sign
the form, but when I try to do both at the same time I break one or the
other.

-----Original Message-----
From: Tilman Hausherr <THausherr@t-online.de <ma...@t-online.de>
>
Sent: December 11, 2019 11:27 PM
To: users@pdfbox.apache.org <ma...@pdfbox.apache.org>
Subject: Re: PDFBox 1.8.10 Question

You responded to the wrong thread, so I am moving this back here...

I can't see your code except two lines, you need to upload this somewhere.

What I see is that you use save() instead of incremental save.

You need to first get the example to run, unchanged. The example uses
incremental save. Then make your changes.

If it still doesn't work, please upload source and result PDF and code to a
sharehoster.

As I wrote, the example in 1.8 doesn't support adding signatures to existing
PDFs but it may be worth a try with the code I posted.

To put a signature in a field it must be a empty signature field.

You can only add 1 signature at a time. I.e. load, sign, save incrementally.

Tilman

Am 11.12.2019 um 20:14 schrieb Wade Polk:
> In PDFBox 1.8.10, I sign the form with code very similar to the
> CreateVisibleSignature.java example.
>
> This seems to work well enough, however when I fill out the form FIRST
> using code like the below, it breaks the signature; when I click on
> the signature I see error message "Error during signature
> verification, Unexpected byte range values defining scope of signed
> data., Details: The signature byte range is invalid."
>
> This is how I set field on my form fields:
> PDTextbox field = (PDTextbox) acroForm.getField
<http://acroForm.getField> ( fieldName );
> field.setValue(fieldValue <http://field.setValue(fieldValue> );
pdfDocument.save(pdfFilePath <http://pdfDocument.save(pdfFilePath> );
>
> I get the impression I have to associate every applicable field with
> this signature, but just a guess.
>
> Note:
> - My form has 8 signatures and various fields to be filled out by each.
> - I would prefer to have all fields and signature lines locked on the
> PDF beforehand and then just to set them with my code, but I believe
> with this version you can only place a signature and not fill out an
> existing signature field, correct?
>
> I definitely feel like I'm missing something, any help is appreciated.
>
>
> -----Original Message-----
> From: Tilman Hausherr <THausherr@t-online.de
<ma...@t-online.de> >
> Sent: December 11, 2019 1:46 PM
> To: users@pdfbox.apache.org <ma...@pdfbox.apache.org>
> Subject: Re: Page boxes differ between Acrobat and PDFBox
>
> Ouch, I've known about this, but put it on low priority because I've
> never seen such a file before. I've opened
>
> https://issues.apache.org/jira/browse/PDFBOX-4706
<https://issues.apache.org/jira/browse/PDFBOX-4706>
>
> I'm not yet sure what to do, but COSName.USER_UNIT is the minimum.
> Getter/Setter probably too.
>
> Tilman
>
> Am 11.12.2019 um 18:31 schrieb Gilad Denneboom:
>> Hmm, that's very interesting. Should PDFBox take that value into
>> account when reporting the page size, then?
>> I see this is a property of the page. Should this be added to PDFBox
>> through a getter/setter? Or at least UserUnit should be added to the
>> COSName enum?
>> Thanks a lot for the information, anyway. It gives me a way to solve
>> this issue!
>>
>> On Wed, Dec 11, 2019 at 4:24 PM Peter Wyatt <petervwyatt@gmail.com
<ma...@gmail.com> >
>> wrote:
>>
>>> The sample PDF provided has a /UserUnit key with the value 3 in the
>>> Page dictionary. This key was introduced in PDF 1.6 and is described
>>> in various specifications along the lines of "(Optional; PDF 1.6) A
>>> positive number giving the size of default user space units, in
>>> multiples of 1 ⁄ 72 inch." so it is a scaling factor on default user
>>> space. So, based on what you have reported, Acrobat is entirely
>>> correct and confirmed by other tooling.
>>>
>>> Peter
>>> ISO 32000 co-Project Leader
>>>
>>> On Wed, Dec 11, 2019 at 10:13 AM Gilad Denneboom
>>> <gilad.denneboom@gmail.com <ma...@gmail.com> > wrote:
>>>> Hi all,
>>>>
>>>> This issue really stumps me. I'm getting different page box values
>>> between
>>>> PDFBox and Acrobat, and even within Acrobat itself...
>>>> The files I'm working with are very large housing plans.
>>>> When I open them in Acrobat it reports the page size to be 35.93 x
>>>> 435.20 inches, but when I use a script I get different results,
>>>> namely 11.97 x
>>>> 145.06 inches, which is also what I'm getting when I use PDFBox
2.0.16.
>>> It
>>>> seems the difference is exactly 1/3, ie the page boxes reported by
>>> Acrobat
>>>> are 3 times as large as those PDFBox and the script find. The same
>>>> is
>>> true
>>>> of all boxes (Crop, Trim, Bleed, Art, etc.).
>>>> I think the results reported by Acrobat are the correct ones, but I
>>>> can't figure out where they're coming from... Any insight would be
>>>> very much appreciated.
>>>>
>>>> A sample file can be found here:
>>>> https://drive.google.com/open?id=1FeFs1W0Iesz6Kcq3wTU_LclyIgmFBOsF
<https://drive.google.com/open?id=1FeFs1W0Iesz6Kcq3wTU_LclyIgmFBOsF>
>>>>
>>>> Thanks in advance!
>>> --------------------------------------------------------------------
>>> - To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
<ma...@pdfbox.apache.org>
>>> For additional commands, e-mail: users-help@pdfbox.apache.org
<ma...@pdfbox.apache.org>
>>>
>>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
<ma...@pdfbox.apache.org>
> For additional commands, e-mail: users-help@pdfbox.apache.org
<ma...@pdfbox.apache.org>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
<ma...@pdfbox.apache.org>
> For additional commands, e-mail: users-help@pdfbox.apache.org
<ma...@pdfbox.apache.org>
>


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

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

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


AW: RE: PDFBox 1.8.10 Question

Posted by Tilman Hausherr <TH...@t-online.de>.
I'll look at it later but I can tell immediately: don't do both. First fill 
the form (the non signature parts). Save() it normally. Then reload and 
handle the signature thing and save incrementally.

Tilman


------------------------------------------------------------------------
Gesendet mit der Telekom Mail App
<https://kommunikationsdienste.t-online.de/redirects/email_app_android_sendmail_footer>



--- Original-Nachricht ---
Von: Wade Polk
Betreff: RE: PDFBox 1.8.10 Question
Datum: 12.12.2019, 14:31 Uhr
An: users@pdfbox.apache.org




https://drive.google.com/file/d/17JtXs0d_DPgLQVCcdIQSd03VTsTe2xdJ/view?usp=sharing
<https://drive.google.com/file/d/17JtXs0d_DPgLQVCcdIQSd03VTsTe2xdJ/view?usp=sharing>

That's the link to the code you can download. I think your right about
incremental save... but no matter I try, I can fill out the form, I can 
sign
the form, but when I try to do both at the same time I break one or the
other.

-----Original Message-----
From: Tilman Hausherr <THausherr@t-online.de <ma...@t-online.de> 
>
Sent: December 11, 2019 11:27 PM
To: users@pdfbox.apache.org <ma...@pdfbox.apache.org>
Subject: Re: PDFBox 1.8.10 Question

You responded to the wrong thread, so I am moving this back here...

I can't see your code except two lines, you need to upload this somewhere.

What I see is that you use save() instead of incremental save.

You need to first get the example to run, unchanged. The example uses
incremental save. Then make your changes.

If it still doesn't work, please upload source and result PDF and code to a
sharehoster.

As I wrote, the example in 1.8 doesn't support adding signatures to 
existing
PDFs but it may be worth a try with the code I posted.

To put a signature in a field it must be a empty signature field.

You can only add 1 signature at a time. I.e. load, sign, save 
incrementally.

Tilman

Am 11.12.2019 um 20:14 schrieb Wade Polk:
> In PDFBox 1.8.10, I sign the form with code very similar to the
> CreateVisibleSignature.java example.
>
> This seems to work well enough, however when I fill out the form FIRST
> using code like the below, it breaks the signature; when I click on
> the signature I see error message "Error during signature
> verification, Unexpected byte range values defining scope of signed
> data., Details: The signature byte range is invalid."
>
> This is how I set field on my form fields:
> PDTextbox field = (PDTextbox) acroForm.getField
<http://acroForm.getField> ( fieldName );
> field.setValue(fieldValue <http://field.setValue(fieldValue> ); 
pdfDocument.save(pdfFilePath <http://pdfDocument.save(pdfFilePath> );
>
> I get the impression I have to associate every applicable field with
> this signature, but just a guess.
>
> Note:
> - My form has 8 signatures and various fields to be filled out by each.
> - I would prefer to have all fields and signature lines locked on the
> PDF beforehand and then just to set them with my code, but I believe
> with this version you can only place a signature and not fill out an
> existing signature field, correct?
>
> I definitely feel like I'm missing something, any help is appreciated.
>
>
> -----Original Message-----
> From: Tilman Hausherr <THausherr@t-online.de
<ma...@t-online.de> >
> Sent: December 11, 2019 1:46 PM
> To: users@pdfbox.apache.org <ma...@pdfbox.apache.org>
> Subject: Re: Page boxes differ between Acrobat and PDFBox
>
> Ouch, I've known about this, but put it on low priority because I've
> never seen such a file before. I've opened
>
> https://issues.apache.org/jira/browse/PDFBOX-4706
<https://issues.apache.org/jira/browse/PDFBOX-4706>
>
> I'm not yet sure what to do, but COSName.USER_UNIT is the minimum.
> Getter/Setter probably too.
>
> Tilman
>
> Am 11.12.2019 um 18:31 schrieb Gilad Denneboom:
>> Hmm, that's very interesting. Should PDFBox take that value into
>> account when reporting the page size, then?
>> I see this is a property of the page. Should this be added to PDFBox
>> through a getter/setter? Or at least UserUnit should be added to the
>> COSName enum?
>> Thanks a lot for the information, anyway. It gives me a way to solve
>> this issue!
>>
>> On Wed, Dec 11, 2019 at 4:24 PM Peter Wyatt <petervwyatt@gmail.com
<ma...@gmail.com> >
>> wrote:
>>
>>> The sample PDF provided has a /UserUnit key with the value 3 in the
>>> Page dictionary. This key was introduced in PDF 1.6 and is described
>>> in various specifications along the lines of "(Optional; PDF 1.6) A
>>> positive number giving the size of default user space units, in
>>> multiples of 1 ⁄ 72 inch." so it is a scaling factor on default user
>>> space. So, based on what you have reported, Acrobat is entirely
>>> correct and confirmed by other tooling.
>>>
>>> Peter
>>> ISO 32000 co-Project Leader
>>>
>>> On Wed, Dec 11, 2019 at 10:13 AM Gilad Denneboom
>>> <gilad.denneboom@gmail.com <ma...@gmail.com> > wrote:
>>>> Hi all,
>>>>
>>>> This issue really stumps me. I'm getting different page box values
>>> between
>>>> PDFBox and Acrobat, and even within Acrobat itself...
>>>> The files I'm working with are very large housing plans.
>>>> When I open them in Acrobat it reports the page size to be 35.93 x
>>>> 435.20 inches, but when I use a script I get different results,
>>>> namely 11.97 x
>>>> 145.06 inches, which is also what I'm getting when I use PDFBox 
2.0.16.
>>> It
>>>> seems the difference is exactly 1/3, ie the page boxes reported by
>>> Acrobat
>>>> are 3 times as large as those PDFBox and the script find. The same
>>>> is
>>> true
>>>> of all boxes (Crop, Trim, Bleed, Art, etc.).
>>>> I think the results reported by Acrobat are the correct ones, but I
>>>> can't figure out where they're coming from... Any insight would be
>>>> very much appreciated.
>>>>
>>>> A sample file can be found here:
>>>> https://drive.google.com/open?id=1FeFs1W0Iesz6Kcq3wTU_LclyIgmFBOsF
<https://drive.google.com/open?id=1FeFs1W0Iesz6Kcq3wTU_LclyIgmFBOsF>
>>>>
>>>> Thanks in advance!
>>> --------------------------------------------------------------------
>>> - To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
<ma...@pdfbox.apache.org>
>>> For additional commands, e-mail: users-help@pdfbox.apache.org
<ma...@pdfbox.apache.org>
>>>
>>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
<ma...@pdfbox.apache.org>
> For additional commands, e-mail: users-help@pdfbox.apache.org
<ma...@pdfbox.apache.org>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
<ma...@pdfbox.apache.org>
> For additional commands, e-mail: users-help@pdfbox.apache.org
<ma...@pdfbox.apache.org>
>


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

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


Re: PDFBox 1.8.10 Question

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 12.12.2019 um 19:58 schrieb Wade Polk:
> Thanks man, no worries. Yeah, sounds like we are on the same page and it
> seems to be working MUCH better now.
>
> - you mentioned "that one does not have an empty signature field". There
> will actually be about 8 signature lines on the form but I removed them
> because, from what I've read, this version can only ADD a signature and
> cannot COMPLETE an EXISTING signature... if this is wrong please let me
> know, I would prefer the later option if possible... it was a real pain
> trying to place the new signature in the right spot. I also need to figure
> out a way to replicate the signature image that you see when signing in
> Acrobat (just using a random jpg).


It is possible to put a signature into an empty signature field in 2.0 
with the code I posted yesterday. I haven't tested it for 1.8.

Tilman


>
> -----Original Message-----
> From: Tilman Hausherr <TH...@t-online.de>
> Sent: December 12, 2019 1:50 PM
> To: users@pdfbox.apache.org
> Subject: Re: PDFBox 1.8.10 Question
>
> Oh, I looked at the wrong file. I had looked at "form.java" and didn't go
> further. I saw the signature.java file and it looks like the example.
>
> I had a look at the form_pdf_afto22_form_template.pdf ... that one does not
> have an empty signature field. Anyway, I tried to sign it with the
> 1.8.17 example, even saving before, and there was no problem, so maybe the
> problem mkl mentioned has been solved after 1.8.10. I do have some weak
> memory about having to clean something when saving.
>
> Tilman
>
> Am 12.12.2019 um 18:25 schrieb Wade Polk:
>> Line 145 of Signature.java, in the function signPDF() is where the
>> incremental save is for the signature.
>>
>> -----Original Message-----
>> From: Tilman Hausherr <TH...@t-online.de>
>> Sent: December 12, 2019 12:21 PM
>> To: users@pdfbox.apache.org
>> Subject: Re: PDFBox 1.8.10 Question
>>
>> Am 12.12.2019 um 14:31 schrieb Wade Polk:
>>> https://drive.google.com/file/d/17JtXs0d_DPgLQVCcdIQSd03VTsTe2xdJ/vie
>>> w
>>> ?usp=sharing
>>>
>>> That's the link to the code you can download. I think your right
>>> about incremental save... but no matter I try, I can fill out the
>>> form, I can sign the form, but when I try to do both at the same time
>>> I break one or the other.
>> So I looked at that code, that will definitively not work. It has
>> nothing in common with the CreateVisibleSignature example.
>>
>> In your other post you wrote that you fixed it, I assume that there is
>> some other code that wasn't uploaded and that did have an incremental
>> save.
>>
>>
>> Tilman
>>
>>
>>
>>> -----Original Message-----
>>> From: Tilman Hausherr <TH...@t-online.de>
>>> Sent: December 11, 2019 11:27 PM
>>> To: users@pdfbox.apache.org
>>> Subject: Re: PDFBox 1.8.10 Question
>>>
>>> You responded to the wrong thread, so I am moving this back here...
>>>
>>> I can't see your code except two lines, you need to upload this
>>> somewhere.
>>>
>>> What I see is that you use save() instead of incremental save.
>>>
>>> You need to first get the example to run, unchanged. The example uses
>>> incremental save. Then make your changes.
>>>
>>> If it still doesn't work, please upload source and result PDF and
>>> code to a sharehoster.
>>>
>>> As I wrote, the example in 1.8 doesn't support adding signatures to
>>> existing PDFs but it may be worth a try with the code I posted.
>>>
>>> To put a signature in a field it must be a empty signature field.
>>>
>>> You can only add 1 signature at a time. I.e. load, sign, save
>>> incrementally.
>>>
>>> Tilman
>>>
>>> Am 11.12.2019 um 20:14 schrieb Wade Polk:
>>>> In PDFBox 1.8.10, I sign the form with code very similar to the
>>>> CreateVisibleSignature.java example.
>>>>
>>>> This seems to work well enough, however when I fill out the form
>>>> FIRST using code like the below, it breaks the signature; when I
>>>> click on the signature I see error message "Error during signature
>>>> verification, Unexpected byte range values defining scope of signed
>>>> data., Details: The signature byte range is invalid."
>>>>
>>>> This is how I set field on my form fields:
>>>> PDTextbox field = (PDTextbox) acroForm.getField( fieldName );
>>>> field.setValue(fieldValue); pdfDocument.save(pdfFilePath);
>>>>
>>>> I get the impression I have to associate every applicable field with
>>>> this signature, but just a guess.
>>>>
>>>> Note:
>>>> - My form has 8 signatures and various fields to be filled out by each.
>>>> - I would prefer to have all fields and signature lines locked on
>>>> the PDF beforehand and then just to set them with my code, but I
>>>> believe with this version you can only place a signature and not
>>>> fill out an existing signature field, correct?
>>>>
>>>> I definitely feel like I'm missing something, any help is appreciated.
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Tilman Hausherr <TH...@t-online.de>
>>>> Sent: December 11, 2019 1:46 PM
>>>> To: users@pdfbox.apache.org
>>>> Subject: Re: Page boxes differ between Acrobat and PDFBox
>>>>
>>>> Ouch, I've known about this, but put it on low priority because I've
>>>> never seen such a file before. I've opened
>>>>
>>>> https://issues.apache.org/jira/browse/PDFBOX-4706
>>>>
>>>> I'm not yet sure what to do, but COSName.USER_UNIT is the minimum.
>>>> Getter/Setter probably too.
>>>>
>>>> Tilman
>>>>
>>>> Am 11.12.2019 um 18:31 schrieb Gilad Denneboom:
>>>>> Hmm, that's very interesting. Should PDFBox take that value into
>>>>> account when reporting the page size, then?
>>>>> I see this is a property of the page. Should this be added to
>>>>> PDFBox through a getter/setter? Or at least UserUnit should be
>>>>> added to the COSName enum?
>>>>> Thanks a lot for the information, anyway. It gives me a way to
>>>>> solve this issue!
>>>>>
>>>>> On Wed, Dec 11, 2019 at 4:24 PM Peter Wyatt <pe...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> The sample PDF provided has a /UserUnit key with the value 3 in
>>>>>> the Page dictionary. This key was introduced in PDF 1.6 and is
>>>>>> described in various specifications along the lines of "(Optional;
>>>>>> PDF 1.6) A positive number giving the size of default user space
>>>>>> units, in multiples of 1 ⁄ 72 inch." so it is a scaling factor on
>>>>>> default user space. So, based on what you have reported, Acrobat
>>>>>> is entirely correct and confirmed by other tooling.
>>>>>>
>>>>>> Peter
>>>>>> ISO 32000 co-Project Leader
>>>>>>
>>>>>> On Wed, Dec 11, 2019 at 10:13 AM Gilad Denneboom
>>>>>> <gi...@gmail.com> wrote:
>>>>>>> Hi all,
>>>>>>>
>>>>>>> This issue really stumps me. I'm getting different page box
>>>>>>> values
>>>>>> between
>>>>>>> PDFBox and Acrobat, and even within Acrobat itself...
>>>>>>> The files I'm working with are very large housing plans.
>>>>>>> When I open them in Acrobat it reports the page size to be 35.93
>>>>>>> x
>>>>>>> 435.20 inches, but when I use a script I get different results,
>>>>>>> namely 11.97 x
>>>>>>> 145.06 inches, which is also what I'm getting when I use PDFBox
>>>>>>> 2.0.16.
>>>>>> It
>>>>>>> seems the difference is exactly 1/3, ie the page boxes reported
>>>>>>> by
>>>>>> Acrobat
>>>>>>> are 3 times as large as those PDFBox and the script find. The
>>>>>>> same is
>>>>>> true
>>>>>>> of all boxes (Crop, Trim, Bleed, Art, etc.).
>>>>>>> I think the results reported by Acrobat are the correct ones, but
>>>>>>> I can't figure out where they're coming from... Any insight would
>>>>>>> be very much appreciated.
>>>>>>>
>>>>>>> A sample file can be found here:
>>>>>>> https://drive.google.com/open?id=1FeFs1W0Iesz6Kcq3wTU_LclyIgmFBOs
>>>>>>> F
>>>>>>>
>>>>>>> Thanks in advance!
>>>>>> ------------------------------------------------------------------
>>>>>> --
>>>>>> - 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
>>>
>> ---------------------------------------------------------------------
>> 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


RE: PDFBox 1.8.10 Question

Posted by Wade Polk <wi...@mddv.com>.
Thanks man, no worries. Yeah, sounds like we are on the same page and it
seems to be working MUCH better now.

- you mentioned "that one does not have an empty signature field". There
will actually be about 8 signature lines on the form but I removed them
because, from what I've read, this version can only ADD a signature and
cannot COMPLETE an EXISTING signature... if this is wrong please let me
know, I would prefer the later option if possible... it was a real pain
trying to place the new signature in the right spot. I also need to figure
out a way to replicate the signature image that you see when signing in
Acrobat (just using a random jpg).

-----Original Message-----
From: Tilman Hausherr <TH...@t-online.de>
Sent: December 12, 2019 1:50 PM
To: users@pdfbox.apache.org
Subject: Re: PDFBox 1.8.10 Question

Oh, I looked at the wrong file. I had looked at "form.java" and didn't go
further. I saw the signature.java file and it looks like the example.

I had a look at the form_pdf_afto22_form_template.pdf ... that one does not
have an empty signature field. Anyway, I tried to sign it with the
1.8.17 example, even saving before, and there was no problem, so maybe the
problem mkl mentioned has been solved after 1.8.10. I do have some weak
memory about having to clean something when saving.

Tilman

Am 12.12.2019 um 18:25 schrieb Wade Polk:
> Line 145 of Signature.java, in the function signPDF() is where the
> incremental save is for the signature.
>
> -----Original Message-----
> From: Tilman Hausherr <TH...@t-online.de>
> Sent: December 12, 2019 12:21 PM
> To: users@pdfbox.apache.org
> Subject: Re: PDFBox 1.8.10 Question
>
> Am 12.12.2019 um 14:31 schrieb Wade Polk:
>> https://drive.google.com/file/d/17JtXs0d_DPgLQVCcdIQSd03VTsTe2xdJ/vie
>> w
>> ?usp=sharing
>>
>> That's the link to the code you can download. I think your right
>> about incremental save... but no matter I try, I can fill out the
>> form, I can sign the form, but when I try to do both at the same time
>> I break one or the other.
>
> So I looked at that code, that will definitively not work. It has
> nothing in common with the CreateVisibleSignature example.
>
> In your other post you wrote that you fixed it, I assume that there is
> some other code that wasn't uploaded and that did have an incremental
> save.
>
>
> Tilman
>
>
>
>> -----Original Message-----
>> From: Tilman Hausherr <TH...@t-online.de>
>> Sent: December 11, 2019 11:27 PM
>> To: users@pdfbox.apache.org
>> Subject: Re: PDFBox 1.8.10 Question
>>
>> You responded to the wrong thread, so I am moving this back here...
>>
>> I can't see your code except two lines, you need to upload this
>> somewhere.
>>
>> What I see is that you use save() instead of incremental save.
>>
>> You need to first get the example to run, unchanged. The example uses
>> incremental save. Then make your changes.
>>
>> If it still doesn't work, please upload source and result PDF and
>> code to a sharehoster.
>>
>> As I wrote, the example in 1.8 doesn't support adding signatures to
>> existing PDFs but it may be worth a try with the code I posted.
>>
>> To put a signature in a field it must be a empty signature field.
>>
>> You can only add 1 signature at a time. I.e. load, sign, save
>> incrementally.
>>
>> Tilman
>>
>> Am 11.12.2019 um 20:14 schrieb Wade Polk:
>>> In PDFBox 1.8.10, I sign the form with code very similar to the
>>> CreateVisibleSignature.java example.
>>>
>>> This seems to work well enough, however when I fill out the form
>>> FIRST using code like the below, it breaks the signature; when I
>>> click on the signature I see error message "Error during signature
>>> verification, Unexpected byte range values defining scope of signed
>>> data., Details: The signature byte range is invalid."
>>>
>>> This is how I set field on my form fields:
>>> PDTextbox field = (PDTextbox) acroForm.getField( fieldName );
>>> field.setValue(fieldValue); pdfDocument.save(pdfFilePath);
>>>
>>> I get the impression I have to associate every applicable field with
>>> this signature, but just a guess.
>>>
>>> Note:
>>> - My form has 8 signatures and various fields to be filled out by each.
>>> - I would prefer to have all fields and signature lines locked on
>>> the PDF beforehand and then just to set them with my code, but I
>>> believe with this version you can only place a signature and not
>>> fill out an existing signature field, correct?
>>>
>>> I definitely feel like I'm missing something, any help is appreciated.
>>>
>>>
>>> -----Original Message-----
>>> From: Tilman Hausherr <TH...@t-online.de>
>>> Sent: December 11, 2019 1:46 PM
>>> To: users@pdfbox.apache.org
>>> Subject: Re: Page boxes differ between Acrobat and PDFBox
>>>
>>> Ouch, I've known about this, but put it on low priority because I've
>>> never seen such a file before. I've opened
>>>
>>> https://issues.apache.org/jira/browse/PDFBOX-4706
>>>
>>> I'm not yet sure what to do, but COSName.USER_UNIT is the minimum.
>>> Getter/Setter probably too.
>>>
>>> Tilman
>>>
>>> Am 11.12.2019 um 18:31 schrieb Gilad Denneboom:
>>>> Hmm, that's very interesting. Should PDFBox take that value into
>>>> account when reporting the page size, then?
>>>> I see this is a property of the page. Should this be added to
>>>> PDFBox through a getter/setter? Or at least UserUnit should be
>>>> added to the COSName enum?
>>>> Thanks a lot for the information, anyway. It gives me a way to
>>>> solve this issue!
>>>>
>>>> On Wed, Dec 11, 2019 at 4:24 PM Peter Wyatt <pe...@gmail.com>
>>>> wrote:
>>>>
>>>>> The sample PDF provided has a /UserUnit key with the value 3 in
>>>>> the Page dictionary. This key was introduced in PDF 1.6 and is
>>>>> described in various specifications along the lines of "(Optional;
>>>>> PDF 1.6) A positive number giving the size of default user space
>>>>> units, in multiples of 1 ⁄ 72 inch." so it is a scaling factor on
>>>>> default user space. So, based on what you have reported, Acrobat
>>>>> is entirely correct and confirmed by other tooling.
>>>>>
>>>>> Peter
>>>>> ISO 32000 co-Project Leader
>>>>>
>>>>> On Wed, Dec 11, 2019 at 10:13 AM Gilad Denneboom
>>>>> <gi...@gmail.com> wrote:
>>>>>> Hi all,
>>>>>>
>>>>>> This issue really stumps me. I'm getting different page box
>>>>>> values
>>>>> between
>>>>>> PDFBox and Acrobat, and even within Acrobat itself...
>>>>>> The files I'm working with are very large housing plans.
>>>>>> When I open them in Acrobat it reports the page size to be 35.93
>>>>>> x
>>>>>> 435.20 inches, but when I use a script I get different results,
>>>>>> namely 11.97 x
>>>>>> 145.06 inches, which is also what I'm getting when I use PDFBox
>>>>>> 2.0.16.
>>>>> It
>>>>>> seems the difference is exactly 1/3, ie the page boxes reported
>>>>>> by
>>>>> Acrobat
>>>>>> are 3 times as large as those PDFBox and the script find. The
>>>>>> same is
>>>>> true
>>>>>> of all boxes (Crop, Trim, Bleed, Art, etc.).
>>>>>> I think the results reported by Acrobat are the correct ones, but
>>>>>> I can't figure out where they're coming from... Any insight would
>>>>>> be very much appreciated.
>>>>>>
>>>>>> A sample file can be found here:
>>>>>> https://drive.google.com/open?id=1FeFs1W0Iesz6Kcq3wTU_LclyIgmFBOs
>>>>>> F
>>>>>>
>>>>>> Thanks in advance!
>>>>> ------------------------------------------------------------------
>>>>> --
>>>>> - 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
>>
>
> ---------------------------------------------------------------------
> 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


Re: PDFBox 1.8.10 Question

Posted by Tilman Hausherr <TH...@t-online.de>.
Oh, I looked at the wrong file. I had looked at "form.java" and didn't 
go further. I saw the signature.java file and it looks like the example.

I had a look at the form_pdf_afto22_form_template.pdf ... that one does 
not have an empty signature field. Anyway, I tried to sign it with the 
1.8.17 example, even saving before, and there was no problem, so maybe 
the problem mkl mentioned has been solved after 1.8.10. I do have some 
weak memory about having to clean something when saving.

Tilman

Am 12.12.2019 um 18:25 schrieb Wade Polk:
> Line 145 of Signature.java, in the function signPDF() is where the
> incremental save is for the signature.
>
> -----Original Message-----
> From: Tilman Hausherr <TH...@t-online.de>
> Sent: December 12, 2019 12:21 PM
> To: users@pdfbox.apache.org
> Subject: Re: PDFBox 1.8.10 Question
>
> Am 12.12.2019 um 14:31 schrieb Wade Polk:
>> https://drive.google.com/file/d/17JtXs0d_DPgLQVCcdIQSd03VTsTe2xdJ/view
>> ?usp=sharing
>>
>> That's the link to the code you can download. I think your right about
>> incremental save... but no matter I try, I can fill out the form, I
>> can sign the form, but when I try to do both at the same time I break
>> one or the other.
>
> So I looked at that code, that will definitively not work. It has nothing in
> common with the CreateVisibleSignature example.
>
> In your other post you wrote that you fixed it, I assume that there is some
> other code that wasn't uploaded and that did have an incremental save.
>
>
> Tilman
>
>
>
>> -----Original Message-----
>> From: Tilman Hausherr <TH...@t-online.de>
>> Sent: December 11, 2019 11:27 PM
>> To: users@pdfbox.apache.org
>> Subject: Re: PDFBox 1.8.10 Question
>>
>> You responded to the wrong thread, so I am moving this back here...
>>
>> I can't see your code except two lines, you need to upload this somewhere.
>>
>> What I see is that you use save() instead of incremental save.
>>
>> You need to first get the example to run, unchanged. The example uses
>> incremental save. Then make your changes.
>>
>> If it still doesn't work, please upload source and result PDF and code to
>> a
>> sharehoster.
>>
>> As I wrote, the example in 1.8 doesn't support adding signatures to
>> existing
>> PDFs but it may be worth a try with the code I posted.
>>
>> To put a signature in a field it must be a empty signature field.
>>
>> You can only add 1 signature at a time. I.e. load, sign, save
>> incrementally.
>>
>> Tilman
>>
>> Am 11.12.2019 um 20:14 schrieb Wade Polk:
>>> In PDFBox 1.8.10, I sign the form with code very similar to the
>>> CreateVisibleSignature.java example.
>>>
>>> This seems to work well enough, however when I fill out the form FIRST
>>> using code like the below, it breaks the signature; when I click on
>>> the signature I see error message "Error during signature
>>> verification, Unexpected byte range values defining scope of signed
>>> data., Details: The signature byte range is invalid."
>>>
>>> This is how I set field on my form fields:
>>> PDTextbox field = (PDTextbox) acroForm.getField( fieldName );
>>> field.setValue(fieldValue); pdfDocument.save(pdfFilePath);
>>>
>>> I get the impression I have to associate every applicable field with
>>> this signature, but just a guess.
>>>
>>> Note:
>>> - My form has 8 signatures and various fields to be filled out by each.
>>> - I would prefer to have all fields and signature lines locked on the
>>> PDF beforehand and then just to set them with my code, but I believe
>>> with this version you can only place a signature and not fill out an
>>> existing signature field, correct?
>>>
>>> I definitely feel like I'm missing something, any help is appreciated.
>>>
>>>
>>> -----Original Message-----
>>> From: Tilman Hausherr <TH...@t-online.de>
>>> Sent: December 11, 2019 1:46 PM
>>> To: users@pdfbox.apache.org
>>> Subject: Re: Page boxes differ between Acrobat and PDFBox
>>>
>>> Ouch, I've known about this, but put it on low priority because I've
>>> never seen such a file before. I've opened
>>>
>>> https://issues.apache.org/jira/browse/PDFBOX-4706
>>>
>>> I'm not yet sure what to do, but COSName.USER_UNIT is the minimum.
>>> Getter/Setter probably too.
>>>
>>> Tilman
>>>
>>> Am 11.12.2019 um 18:31 schrieb Gilad Denneboom:
>>>> Hmm, that's very interesting. Should PDFBox take that value into
>>>> account when reporting the page size, then?
>>>> I see this is a property of the page. Should this be added to PDFBox
>>>> through a getter/setter? Or at least UserUnit should be added to the
>>>> COSName enum?
>>>> Thanks a lot for the information, anyway. It gives me a way to solve
>>>> this issue!
>>>>
>>>> On Wed, Dec 11, 2019 at 4:24 PM Peter Wyatt <pe...@gmail.com>
>>>> wrote:
>>>>
>>>>> The sample PDF provided has a /UserUnit key with the value 3 in the
>>>>> Page dictionary. This key was introduced in PDF 1.6 and is described
>>>>> in various specifications along the lines of "(Optional; PDF 1.6) A
>>>>> positive number giving the size of default user space units, in
>>>>> multiples of 1 ⁄ 72 inch." so it is a scaling factor on default user
>>>>> space. So, based on what you have reported, Acrobat is entirely
>>>>> correct and confirmed by other tooling.
>>>>>
>>>>> Peter
>>>>> ISO 32000 co-Project Leader
>>>>>
>>>>> On Wed, Dec 11, 2019 at 10:13 AM Gilad Denneboom
>>>>> <gi...@gmail.com> wrote:
>>>>>> Hi all,
>>>>>>
>>>>>> This issue really stumps me. I'm getting different page box values
>>>>> between
>>>>>> PDFBox and Acrobat, and even within Acrobat itself...
>>>>>> The files I'm working with are very large housing plans.
>>>>>> When I open them in Acrobat it reports the page size to be 35.93 x
>>>>>> 435.20 inches, but when I use a script I get different results,
>>>>>> namely 11.97 x
>>>>>> 145.06 inches, which is also what I'm getting when I use PDFBox
>>>>>> 2.0.16.
>>>>> It
>>>>>> seems the difference is exactly 1/3, ie the page boxes reported by
>>>>> Acrobat
>>>>>> are 3 times as large as those PDFBox and the script find. The same
>>>>>> is
>>>>> true
>>>>>> of all boxes (Crop, Trim, Bleed, Art, etc.).
>>>>>> I think the results reported by Acrobat are the correct ones, but I
>>>>>> can't figure out where they're coming from... Any insight would be
>>>>>> very much appreciated.
>>>>>>
>>>>>> A sample file can be found here:
>>>>>> https://drive.google.com/open?id=1FeFs1W0Iesz6Kcq3wTU_LclyIgmFBOsF
>>>>>>
>>>>>> Thanks in advance!
>>>>> --------------------------------------------------------------------
>>>>> - 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
>>
>
> ---------------------------------------------------------------------
> 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


RE: PDFBox 1.8.10 Question

Posted by Wade Polk <wi...@mddv.com>.
Line 145 of Signature.java, in the function signPDF() is where the
incremental save is for the signature.

-----Original Message-----
From: Tilman Hausherr <TH...@t-online.de>
Sent: December 12, 2019 12:21 PM
To: users@pdfbox.apache.org
Subject: Re: PDFBox 1.8.10 Question

Am 12.12.2019 um 14:31 schrieb Wade Polk:
> https://drive.google.com/file/d/17JtXs0d_DPgLQVCcdIQSd03VTsTe2xdJ/view
> ?usp=sharing
>
> That's the link to the code you can download. I think your right about
> incremental save... but no matter I try, I can fill out the form, I
> can sign the form, but when I try to do both at the same time I break
> one or the other.


So I looked at that code, that will definitively not work. It has nothing in
common with the CreateVisibleSignature example.

In your other post you wrote that you fixed it, I assume that there is some
other code that wasn't uploaded and that did have an incremental save.


Tilman



>
> -----Original Message-----
> From: Tilman Hausherr <TH...@t-online.de>
> Sent: December 11, 2019 11:27 PM
> To: users@pdfbox.apache.org
> Subject: Re: PDFBox 1.8.10 Question
>
> You responded to the wrong thread, so I am moving this back here...
>
> I can't see your code except two lines, you need to upload this somewhere.
>
> What I see is that you use save() instead of incremental save.
>
> You need to first get the example to run, unchanged. The example uses
> incremental save. Then make your changes.
>
> If it still doesn't work, please upload source and result PDF and code to
> a
> sharehoster.
>
> As I wrote, the example in 1.8 doesn't support adding signatures to
> existing
> PDFs but it may be worth a try with the code I posted.
>
> To put a signature in a field it must be a empty signature field.
>
> You can only add 1 signature at a time. I.e. load, sign, save
> incrementally.
>
> Tilman
>
> Am 11.12.2019 um 20:14 schrieb Wade Polk:
>> In PDFBox 1.8.10, I sign the form with code very similar to the
>> CreateVisibleSignature.java example.
>>
>> This seems to work well enough, however when I fill out the form FIRST
>> using code like the below, it breaks the signature; when I click on
>> the signature I see error message "Error during signature
>> verification, Unexpected byte range values defining scope of signed
>> data., Details: The signature byte range is invalid."
>>
>> This is how I set field on my form fields:
>> PDTextbox field = (PDTextbox) acroForm.getField( fieldName );
>> field.setValue(fieldValue); pdfDocument.save(pdfFilePath);
>>
>> I get the impression I have to associate every applicable field with
>> this signature, but just a guess.
>>
>> Note:
>> - My form has 8 signatures and various fields to be filled out by each.
>> - I would prefer to have all fields and signature lines locked on the
>> PDF beforehand and then just to set them with my code, but I believe
>> with this version you can only place a signature and not fill out an
>> existing signature field, correct?
>>
>> I definitely feel like I'm missing something, any help is appreciated.
>>
>>
>> -----Original Message-----
>> From: Tilman Hausherr <TH...@t-online.de>
>> Sent: December 11, 2019 1:46 PM
>> To: users@pdfbox.apache.org
>> Subject: Re: Page boxes differ between Acrobat and PDFBox
>>
>> Ouch, I've known about this, but put it on low priority because I've
>> never seen such a file before. I've opened
>>
>> https://issues.apache.org/jira/browse/PDFBOX-4706
>>
>> I'm not yet sure what to do, but COSName.USER_UNIT is the minimum.
>> Getter/Setter probably too.
>>
>> Tilman
>>
>> Am 11.12.2019 um 18:31 schrieb Gilad Denneboom:
>>> Hmm, that's very interesting. Should PDFBox take that value into
>>> account when reporting the page size, then?
>>> I see this is a property of the page. Should this be added to PDFBox
>>> through a getter/setter? Or at least UserUnit should be added to the
>>> COSName enum?
>>> Thanks a lot for the information, anyway. It gives me a way to solve
>>> this issue!
>>>
>>> On Wed, Dec 11, 2019 at 4:24 PM Peter Wyatt <pe...@gmail.com>
>>> wrote:
>>>
>>>> The sample PDF provided has a /UserUnit key with the value 3 in the
>>>> Page dictionary. This key was introduced in PDF 1.6 and is described
>>>> in various specifications along the lines of "(Optional; PDF 1.6) A
>>>> positive number giving the size of default user space units, in
>>>> multiples of 1 ⁄ 72 inch." so it is a scaling factor on default user
>>>> space. So, based on what you have reported, Acrobat is entirely
>>>> correct and confirmed by other tooling.
>>>>
>>>> Peter
>>>> ISO 32000 co-Project Leader
>>>>
>>>> On Wed, Dec 11, 2019 at 10:13 AM Gilad Denneboom
>>>> <gi...@gmail.com> wrote:
>>>>> Hi all,
>>>>>
>>>>> This issue really stumps me. I'm getting different page box values
>>>> between
>>>>> PDFBox and Acrobat, and even within Acrobat itself...
>>>>> The files I'm working with are very large housing plans.
>>>>> When I open them in Acrobat it reports the page size to be 35.93 x
>>>>> 435.20 inches, but when I use a script I get different results,
>>>>> namely 11.97 x
>>>>> 145.06 inches, which is also what I'm getting when I use PDFBox
>>>>> 2.0.16.
>>>> It
>>>>> seems the difference is exactly 1/3, ie the page boxes reported by
>>>> Acrobat
>>>>> are 3 times as large as those PDFBox and the script find. The same
>>>>> is
>>>> true
>>>>> of all boxes (Crop, Trim, Bleed, Art, etc.).
>>>>> I think the results reported by Acrobat are the correct ones, but I
>>>>> can't figure out where they're coming from... Any insight would be
>>>>> very much appreciated.
>>>>>
>>>>> A sample file can be found here:
>>>>> https://drive.google.com/open?id=1FeFs1W0Iesz6Kcq3wTU_LclyIgmFBOsF
>>>>>
>>>>> Thanks in advance!
>>>> --------------------------------------------------------------------
>>>> - 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
>


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


Re: PDFBox 1.8.10 Question

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 12.12.2019 um 14:31 schrieb Wade Polk:
> https://drive.google.com/file/d/17JtXs0d_DPgLQVCcdIQSd03VTsTe2xdJ/view?usp=sharing
>
> That's the link to the code you can download. I think your right about
> incremental save... but no matter I try, I can fill out the form, I can sign
> the form, but when I try to do both at the same time I break one or the
> other.


So I looked at that code, that will definitively not work. It has 
nothing in common with the CreateVisibleSignature example.

In your other post you wrote that you fixed it, I assume that there is 
some other code that wasn't uploaded and that did have an incremental save.


Tilman



>
> -----Original Message-----
> From: Tilman Hausherr <TH...@t-online.de>
> Sent: December 11, 2019 11:27 PM
> To: users@pdfbox.apache.org
> Subject: Re: PDFBox 1.8.10 Question
>
> You responded to the wrong thread, so I am moving this back here...
>
> I can't see your code except two lines, you need to upload this somewhere.
>
> What I see is that you use save() instead of incremental save.
>
> You need to first get the example to run, unchanged. The example uses
> incremental save. Then make your changes.
>
> If it still doesn't work, please upload source and result PDF and code to a
> sharehoster.
>
> As I wrote, the example in 1.8 doesn't support adding signatures to existing
> PDFs but it may be worth a try with the code I posted.
>
> To put a signature in a field it must be a empty signature field.
>
> You can only add 1 signature at a time. I.e. load, sign, save incrementally.
>
> Tilman
>
> Am 11.12.2019 um 20:14 schrieb Wade Polk:
>> In PDFBox 1.8.10, I sign the form with code very similar to the
>> CreateVisibleSignature.java example.
>>
>> This seems to work well enough, however when I fill out the form FIRST
>> using code like the below, it breaks the signature; when I click on
>> the signature I see error message "Error during signature
>> verification, Unexpected byte range values defining scope of signed
>> data., Details: The signature byte range is invalid."
>>
>> This is how I set field on my form fields:
>> PDTextbox field = (PDTextbox) acroForm.getField( fieldName );
>> field.setValue(fieldValue); pdfDocument.save(pdfFilePath);
>>
>> I get the impression I have to associate every applicable field with
>> this signature, but just a guess.
>>
>> Note:
>> - My form has 8 signatures and various fields to be filled out by each.
>> - I would prefer to have all fields and signature lines locked on the
>> PDF beforehand and then just to set them with my code, but I believe
>> with this version you can only place a signature and not fill out an
>> existing signature field, correct?
>>
>> I definitely feel like I'm missing something, any help is appreciated.
>>
>>
>> -----Original Message-----
>> From: Tilman Hausherr <TH...@t-online.de>
>> Sent: December 11, 2019 1:46 PM
>> To: users@pdfbox.apache.org
>> Subject: Re: Page boxes differ between Acrobat and PDFBox
>>
>> Ouch, I've known about this, but put it on low priority because I've
>> never seen such a file before. I've opened
>>
>> https://issues.apache.org/jira/browse/PDFBOX-4706
>>
>> I'm not yet sure what to do, but COSName.USER_UNIT is the minimum.
>> Getter/Setter probably too.
>>
>> Tilman
>>
>> Am 11.12.2019 um 18:31 schrieb Gilad Denneboom:
>>> Hmm, that's very interesting. Should PDFBox take that value into
>>> account when reporting the page size, then?
>>> I see this is a property of the page. Should this be added to PDFBox
>>> through a getter/setter? Or at least UserUnit should be added to the
>>> COSName enum?
>>> Thanks a lot for the information, anyway. It gives me a way to solve
>>> this issue!
>>>
>>> On Wed, Dec 11, 2019 at 4:24 PM Peter Wyatt <pe...@gmail.com>
>>> wrote:
>>>
>>>> The sample PDF provided has a /UserUnit key with the value 3 in the
>>>> Page dictionary. This key was introduced in PDF 1.6 and is described
>>>> in various specifications along the lines of "(Optional; PDF 1.6) A
>>>> positive number giving the size of default user space units, in
>>>> multiples of 1 ⁄ 72 inch." so it is a scaling factor on default user
>>>> space. So, based on what you have reported, Acrobat is entirely
>>>> correct and confirmed by other tooling.
>>>>
>>>> Peter
>>>> ISO 32000 co-Project Leader
>>>>
>>>> On Wed, Dec 11, 2019 at 10:13 AM Gilad Denneboom
>>>> <gi...@gmail.com> wrote:
>>>>> Hi all,
>>>>>
>>>>> This issue really stumps me. I'm getting different page box values
>>>> between
>>>>> PDFBox and Acrobat, and even within Acrobat itself...
>>>>> The files I'm working with are very large housing plans.
>>>>> When I open them in Acrobat it reports the page size to be 35.93 x
>>>>> 435.20 inches, but when I use a script I get different results,
>>>>> namely 11.97 x
>>>>> 145.06 inches, which is also what I'm getting when I use PDFBox 2.0.16.
>>>> It
>>>>> seems the difference is exactly 1/3, ie the page boxes reported by
>>>> Acrobat
>>>>> are 3 times as large as those PDFBox and the script find. The same
>>>>> is
>>>> true
>>>>> of all boxes (Crop, Trim, Bleed, Art, etc.).
>>>>> I think the results reported by Acrobat are the correct ones, but I
>>>>> can't figure out where they're coming from... Any insight would be
>>>>> very much appreciated.
>>>>>
>>>>> A sample file can be found here:
>>>>> https://drive.google.com/open?id=1FeFs1W0Iesz6Kcq3wTU_LclyIgmFBOsF
>>>>>
>>>>> Thanks in advance!
>>>> --------------------------------------------------------------------
>>>> - 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
>


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


RE: PDFBox 1.8.10 Question

Posted by Wade Polk <wi...@mddv.com>.
https://drive.google.com/file/d/17JtXs0d_DPgLQVCcdIQSd03VTsTe2xdJ/view?usp=sharing

That's the link to the code you can download. I think your right about
incremental save... but no matter I try, I can fill out the form, I can sign
the form, but when I try to do both at the same time I break one or the
other.

-----Original Message-----
From: Tilman Hausherr <TH...@t-online.de>
Sent: December 11, 2019 11:27 PM
To: users@pdfbox.apache.org
Subject: Re: PDFBox 1.8.10 Question

You responded to the wrong thread, so I am moving this back here...

I can't see your code except two lines, you need to upload this somewhere.

What I see is that you use save() instead of incremental save.

You need to first get the example to run, unchanged. The example uses
incremental save. Then make your changes.

If it still doesn't work, please upload source and result PDF and code to a
sharehoster.

As I wrote, the example in 1.8 doesn't support adding signatures to existing
PDFs but it may be worth a try with the code I posted.

To put a signature in a field it must be a empty signature field.

You can only add 1 signature at a time. I.e. load, sign, save incrementally.

Tilman

Am 11.12.2019 um 20:14 schrieb Wade Polk:
> In PDFBox 1.8.10, I sign the form with code very similar to the
> CreateVisibleSignature.java example.
>
> This seems to work well enough, however when I fill out the form FIRST
> using code like the below, it breaks the signature; when I click on
> the signature I see error message "Error during signature
> verification, Unexpected byte range values defining scope of signed
> data., Details: The signature byte range is invalid."
>
> This is how I set field on my form fields:
> PDTextbox field = (PDTextbox) acroForm.getField( fieldName );
> field.setValue(fieldValue); pdfDocument.save(pdfFilePath);
>
> I get the impression I have to associate every applicable field with
> this signature, but just a guess.
>
> Note:
> - My form has 8 signatures and various fields to be filled out by each.
> - I would prefer to have all fields and signature lines locked on the
> PDF beforehand and then just to set them with my code, but I believe
> with this version you can only place a signature and not fill out an
> existing signature field, correct?
>
> I definitely feel like I'm missing something, any help is appreciated.
>
>
> -----Original Message-----
> From: Tilman Hausherr <TH...@t-online.de>
> Sent: December 11, 2019 1:46 PM
> To: users@pdfbox.apache.org
> Subject: Re: Page boxes differ between Acrobat and PDFBox
>
> Ouch, I've known about this, but put it on low priority because I've
> never seen such a file before. I've opened
>
> https://issues.apache.org/jira/browse/PDFBOX-4706
>
> I'm not yet sure what to do, but COSName.USER_UNIT is the minimum.
> Getter/Setter probably too.
>
> Tilman
>
> Am 11.12.2019 um 18:31 schrieb Gilad Denneboom:
>> Hmm, that's very interesting. Should PDFBox take that value into
>> account when reporting the page size, then?
>> I see this is a property of the page. Should this be added to PDFBox
>> through a getter/setter? Or at least UserUnit should be added to the
>> COSName enum?
>> Thanks a lot for the information, anyway. It gives me a way to solve
>> this issue!
>>
>> On Wed, Dec 11, 2019 at 4:24 PM Peter Wyatt <pe...@gmail.com>
>> wrote:
>>
>>> The sample PDF provided has a /UserUnit key with the value 3 in the
>>> Page dictionary. This key was introduced in PDF 1.6 and is described
>>> in various specifications along the lines of "(Optional; PDF 1.6) A
>>> positive number giving the size of default user space units, in
>>> multiples of 1 ⁄ 72 inch." so it is a scaling factor on default user
>>> space. So, based on what you have reported, Acrobat is entirely
>>> correct and confirmed by other tooling.
>>>
>>> Peter
>>> ISO 32000 co-Project Leader
>>>
>>> On Wed, Dec 11, 2019 at 10:13 AM Gilad Denneboom
>>> <gi...@gmail.com> wrote:
>>>> Hi all,
>>>>
>>>> This issue really stumps me. I'm getting different page box values
>>> between
>>>> PDFBox and Acrobat, and even within Acrobat itself...
>>>> The files I'm working with are very large housing plans.
>>>> When I open them in Acrobat it reports the page size to be 35.93 x
>>>> 435.20 inches, but when I use a script I get different results,
>>>> namely 11.97 x
>>>> 145.06 inches, which is also what I'm getting when I use PDFBox 2.0.16.
>>> It
>>>> seems the difference is exactly 1/3, ie the page boxes reported by
>>> Acrobat
>>>> are 3 times as large as those PDFBox and the script find. The same
>>>> is
>>> true
>>>> of all boxes (Crop, Trim, Bleed, Art, etc.).
>>>> I think the results reported by Acrobat are the correct ones, but I
>>>> can't figure out where they're coming from... Any insight would be
>>>> very much appreciated.
>>>>
>>>> A sample file can be found here:
>>>> https://drive.google.com/open?id=1FeFs1W0Iesz6Kcq3wTU_LclyIgmFBOsF
>>>>
>>>> Thanks in advance!
>>> --------------------------------------------------------------------
>>> - 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


Re: PDFBox 1.8.10 Question

Posted by Tilman Hausherr <TH...@t-online.de>.
You responded to the wrong thread, so I am moving this back here...

I can't see your code except two lines, you need to upload this somewhere.

What I see is that you use save() instead of incremental save.

You need to first get the example to run, unchanged. The example uses 
incremental save. Then make your changes.

If it still doesn't work, please upload source and result PDF and code 
to a sharehoster.

As I wrote, the example in 1.8 doesn't support adding signatures to 
existing PDFs but it may be worth a try with the code I posted.

To put a signature in a field it must be a empty signature field.

You can only add 1 signature at a time. I.e. load, sign, save incrementally.

Tilman

Am 11.12.2019 um 20:14 schrieb Wade Polk:
> In PDFBox 1.8.10, I sign the form with code very similar to the
> CreateVisibleSignature.java example.
>
> This seems to work well enough, however when I fill out the form FIRST using
> code like the below, it breaks the signature; when I click on the signature
> I see error message "Error during signature verification, Unexpected byte
> range values defining scope of signed data., Details: The signature byte
> range is invalid."
>
> This is how I set field on my form fields:
> PDTextbox field = (PDTextbox) acroForm.getField( fieldName );
> field.setValue(fieldValue);
> pdfDocument.save(pdfFilePath);
>
> I get the impression I have to associate every applicable field with this
> signature, but just a guess.
>
> Note:
> - My form has 8 signatures and various fields to be filled out by each.
> - I would prefer to have all fields and signature lines locked on the PDF
> beforehand and then just to set them with my code, but I believe with this
> version you can only place a signature and not fill out an existing
> signature field, correct?
>
> I definitely feel like I'm missing something, any help is appreciated.
>
>
> -----Original Message-----
> From: Tilman Hausherr <TH...@t-online.de>
> Sent: December 11, 2019 1:46 PM
> To: users@pdfbox.apache.org
> Subject: Re: Page boxes differ between Acrobat and PDFBox
>
> Ouch, I've known about this, but put it on low priority because I've never
> seen such a file before. I've opened
>
> https://issues.apache.org/jira/browse/PDFBOX-4706
>
> I'm not yet sure what to do, but COSName.USER_UNIT is the minimum.
> Getter/Setter probably too.
>
> Tilman
>
> Am 11.12.2019 um 18:31 schrieb Gilad Denneboom:
>> Hmm, that's very interesting. Should PDFBox take that value into
>> account when reporting the page size, then?
>> I see this is a property of the page. Should this be added to PDFBox
>> through a getter/setter? Or at least UserUnit should be added to the
>> COSName enum?
>> Thanks a lot for the information, anyway. It gives me a way to solve
>> this issue!
>>
>> On Wed, Dec 11, 2019 at 4:24 PM Peter Wyatt <pe...@gmail.com> wrote:
>>
>>> The sample PDF provided has a /UserUnit key with the value 3 in the
>>> Page dictionary. This key was introduced in PDF 1.6 and is described
>>> in various specifications along the lines of "(Optional; PDF 1.6) A
>>> positive number giving the size of default user space units, in
>>> multiples of 1 ⁄ 72 inch." so it is a scaling factor on default user
>>> space. So, based on what you have reported, Acrobat is entirely
>>> correct and confirmed by other tooling.
>>>
>>> Peter
>>> ISO 32000 co-Project Leader
>>>
>>> On Wed, Dec 11, 2019 at 10:13 AM Gilad Denneboom
>>> <gi...@gmail.com> wrote:
>>>> Hi all,
>>>>
>>>> This issue really stumps me. I'm getting different page box values
>>> between
>>>> PDFBox and Acrobat, and even within Acrobat itself...
>>>> The files I'm working with are very large housing plans.
>>>> When I open them in Acrobat it reports the page size to be 35.93 x
>>>> 435.20 inches, but when I use a script I get different results,
>>>> namely 11.97 x
>>>> 145.06 inches, which is also what I'm getting when I use PDFBox 2.0.16.
>>> It
>>>> seems the difference is exactly 1/3, ie the page boxes reported by
>>> Acrobat
>>>> are 3 times as large as those PDFBox and the script find. The same
>>>> is
>>> true
>>>> of all boxes (Crop, Trim, Bleed, Art, etc.).
>>>> I think the results reported by Acrobat are the correct ones, but I
>>>> can't figure out where they're coming from... Any insight would be
>>>> very much appreciated.
>>>>
>>>> A sample file can be found here:
>>>> https://drive.google.com/open?id=1FeFs1W0Iesz6Kcq3wTU_LclyIgmFBOsF
>>>>
>>>> Thanks in advance!
>>> ---------------------------------------------------------------------
>>> 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


Re: PDFBox 1.8.10 Question

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 11.12.2019 um 14:03 schrieb Wade Polk:
> 3 days in trying to learn PDFBox 1.8.10 source code examples.
>
> I think I finally got it to run, CreateVisibleSignatures.java. The output
> was the following indicating I need to pass in some arguments:
>
> java org.apache.pdfbox.examples.signature.CreateVisibleSignature
> <pkcs12-keystore-file> <pin> <input-pdf> <sign-image>
>
> Questions
> 1. Do you folks have example keystore/pdf/sign-images (just so I can rule
> out issues with my files)?
> 2. Where do the keystore/pdf/sign-images need to be put?
> 3. How does this class know which signature field to use for each
> certificate based signature? My form has 8 signature lines, but there is no
> PDSignatureField argument for this function so I don't see how this could
> work.

Hi,

A keystore can be created with the java keytool (e.g.

keytool -genkeypair -storepass 123456 -storetype pkcs12 -alias test 
-validity 365 -v -keyalg RSA -keystore keystore.p12
)

The password here is 123456.

There is a "usage" that tells where to put them in the command line. Or 
insert this just below "main":

args = new String[]{"keystore.p12",
           "123456",
           "blah.pdf",
           "sig.jpg" // must be jpeg IIRC
       };


The 1.8 example does not support signing existing signature fields. 
Here's some code from 2.0. It may be needed to adjust it, e.g. put some 
casts after the results of "getCOSObject()".


     // Find an existing signature (assumed to be empty). You will 
usually not need this.
     private PDSignature findExistingSignature(PDDocument doc, String 
sigFieldName)
     {
         PDSignature signature = null;
         PDSignatureField signatureField;
         PDAcroForm acroForm = doc.getDocumentCatalog().getAcroForm();
         if (acroForm != null)
         {
             signatureField = (PDSignatureField) 
acroForm.getField(sigFieldName);
             if (signatureField != null)
             {
                 // retrieve signature dictionary
                 signature = signatureField.getSignature();
                 if (signature == null)
                 {
                     signature = new PDSignature();
                     // after solving PDFBOX-3524
                     // signatureField.setValue(signature)
                     // until then:
signatureField.getCOSObject().setItem(COSName.V, signature);
                 }
                 else
                 {
                     throw new IllegalStateException("The signature 
field " + sigFieldName + " is already signed.");
                 }
             }
         }
         return signature;
     }

So instead of calling "new PDSignature()" use the result.

Note that 1.8 has some flaws (e.g. involving multiple signing) that were 
fixed in 2.0. So insisting on using 1.8.10 is not a good practice.

Tilman


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


RE: PDFBox 1.8.10 Question

Posted by Wade Polk <wi...@mddv.com>.
To answer my own question, looks like this example doesn't use any signature
fields, it just plops the image in the top corner. Sorry for blowing up
everyone's inbox...

-----Original Message-----
From: Wade Polk <wi...@mddv.com>
Sent: December 11, 2019 8:03 AM
To: 'users@pdfbox.apache.org' <us...@pdfbox.apache.org>
Subject: RE: PDFBox 1.8.10 Question

3 days in trying to learn PDFBox 1.8.10 source code examples.

I think I finally got it to run, CreateVisibleSignatures.java. The output
was the following indicating I need to pass in some arguments:

java org.apache.pdfbox.examples.signature.CreateVisibleSignature
<pkcs12-keystore-file> <pin> <input-pdf> <sign-image>

Questions
1. Do you folks have example keystore/pdf/sign-images (just so I can rule
out issues with my files)?
2. Where do the keystore/pdf/sign-images need to be put?
3. How does this class know which signature field to use for each
certificate based signature? My form has 8 signature lines, but there is no
PDSignatureField argument for this function so I don't see how this could
work.

-----Original Message-----
From: Tilman Hausherr <TH...@t-online.de>
Sent: December 10, 2019 3:09 PM
To: users@pdfbox.apache.org
Subject: Re: PDFBox 1.8.10 Question

Use this:

         <dependency>
             <groupId>org.apache.pdfbox</groupId>
             <artifactId>jbig2-imageio</artifactId>
             <version>3.0.2</version>
         </dependency>

or (older with some bugs, and I doubt you'll need it for signing anyway)

         <dependency>
             <groupId>com.levigo.jbig2</groupId>
<artifactId>levigo-jbig2-imageio</artifactId>
             <version>1.6.5</version>
         </dependency>

Tilman


Am 10.12.2019 um 20:31 schrieb Wade Polk:
> Thanks for the advice, both these messages clarify a ton of stuff!
>
>
>
> I was having issues setting up pdfbox-1.8.10 in IntelliJ Idea but I
> think I almost have it working except for one dependency below seems
> to be unattainable, any ideas?
>
>
>
> <*dependency*>
>      <*groupId*>com.levigo.jbig2</*groupId*>
>      <*artifactId*>levigo-jbig2-imageio</*artifactId*>
>      <*version*>1.6.2</*version*>
>      <*scope*>test</*scope*>
> </*dependency*>
>
>
>
> -----Original Message-----
> From: Tilman Hausherr <TH...@t-online.de>
> Sent: December 10, 2019 8:50 AM
> To: users@pdfbox.apache.org
> Subject: AW: Re: PDFBox 1.8.10 Question
>
>
>
> or download the sources for that version and search for
> CreateVisibleSignature.java and first get it to run with your
> certificate / pin / keystore / PKI device etc.
>
>
>
> Tilman
>
>
>
>
>
> ----------------------------------------------------------------------
> --
>
> Gesendet mit der Telekom Mail App
>
> <
> https://kommunikationsdienste.t-online.de/redirects/email_app_android_
> sendmail_footer
>
>
>
>
>
>
> --- Original-Nachricht ---
>
> Von: Waldemar Dick
>
> Betreff: Re: PDFBox 1.8.10 Question
>
> Datum: 10.12.2019, 14:45 Uhr
>
> An: users@pdfbox.apache.org
>
>
>
>
>
>
>
>
>
> Hello Wade,
>
>
>
> The documentation is sparse, because PDFBox gives you all objects
> according to the PDF specification.
>
> The naming convention is matching or very close to the names used in
> the PDF specification.
>
> Take a look here: https://www.adobe.com/devnet/pdf/pdf_reference.html
>
> <https://www.adobe.com/devnet/pdf/pdf_reference.html> <
> https://www.adobe.com/devnet/pdf/pdf_reference.html>
>
> <https://www.adobe.com/devnet/pdf/pdf_reference.html>> ;
>
>
>
> Chapter 12.8 Digital Signatures explains the signature process in PDF.
>
>
>
> PDFBox has a lot of very good examples here:
>
> https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/
> apache/pdfbox/examples/signature
>
> <
> https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/
> apache/pdfbox/examples/signature
> / <
>
> https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/
> apache/pdfbox/examples/signature/
> <
> https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/
> apache/pdfbox/examples/signature/
> ;
>
>
>
>
>
>> PDSignature.setContents <http://PDSignature.setContents> ()
>
>
> This will take the CMS signature, that you have to create outside of
> the PDF. Take a look at the examples above.
>
>
>
> The visual part of a signature has nothing to do with the digital
> signature.
>
> The visual part is a widget annotation.
>
> Take a look at chapter 12.5.6.19 <http://12.5.6.19> Widget Annotations.
>
>
>
>
>
>
>
>
>
> Regards,
>
> Waldemar
>
>
>
>
>
>> On 10. 12 2019, at 13:58, Wade Polk <winthrop.polk@mddv.com
> <mailto:winthrop.polk@mddv.com <wi...@mddv.com>> > wrote:
>
>> Hello Mailing List,
>> Please forgive me if I’m doing this wrong, I’ve never actually used a
> mailing list for support like this but a developer said this was the
> best
>
> thing to do so here I am.
>
>> Long story short, I am attempting to use an older version of PDFBox
> (1.8.10) to fill out and sign a PDF form. All form fields and
> signature
>
> lines will be on the document long before this. It needs to be signed
> with
>
> a certificate and it needs to operate very much like it does in
> acrobat,
>
> were you see a picture and can click on it for signature details. I’ve
>
> attached my short code to keep this simple… my biggest issue has been
>
> related to understanding the object hierarchies and purpose…
> documentation
>
> is sparse so it confuses me (e.g. PDSignature.setContents
>
> <http://PDSignature.setContents> : “Sets the contents.” … doesn’t
> really
>
> tell me much, I’m guessing this is for setting the img or perhaps the
>
> actual certificate).
>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> <mailto:users-unsubscribe@pdfbox.apache.org
> <us...@pdfbox.apache.org>>
>
>> For additional commands, e-mail: users-help@pdfbox.apache.org
> <mailto:users-help@pdfbox.apache.org <us...@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


RE: PDFBox 1.8.10 Question

Posted by Wade Polk <wi...@mddv.com>.
3 days in trying to learn PDFBox 1.8.10 source code examples.

I think I finally got it to run, CreateVisibleSignatures.java. The output
was the following indicating I need to pass in some arguments:

java org.apache.pdfbox.examples.signature.CreateVisibleSignature
<pkcs12-keystore-file> <pin> <input-pdf> <sign-image>

Questions
1. Do you folks have example keystore/pdf/sign-images (just so I can rule
out issues with my files)?
2. Where do the keystore/pdf/sign-images need to be put?
3. How does this class know which signature field to use for each
certificate based signature? My form has 8 signature lines, but there is no
PDSignatureField argument for this function so I don't see how this could
work.

-----Original Message-----
From: Tilman Hausherr <TH...@t-online.de>
Sent: December 10, 2019 3:09 PM
To: users@pdfbox.apache.org
Subject: Re: PDFBox 1.8.10 Question

Use this:

         <dependency>
             <groupId>org.apache.pdfbox</groupId>
             <artifactId>jbig2-imageio</artifactId>
             <version>3.0.2</version>
         </dependency>

or (older with some bugs, and I doubt you'll need it for signing anyway)

         <dependency>
             <groupId>com.levigo.jbig2</groupId>
<artifactId>levigo-jbig2-imageio</artifactId>
             <version>1.6.5</version>
         </dependency>

Tilman


Am 10.12.2019 um 20:31 schrieb Wade Polk:
> Thanks for the advice, both these messages clarify a ton of stuff!
>
>
>
> I was having issues setting up pdfbox-1.8.10 in IntelliJ Idea but I
> think I almost have it working except for one dependency below seems
> to be unattainable, any ideas?
>
>
>
> <*dependency*>
>      <*groupId*>com.levigo.jbig2</*groupId*>
>      <*artifactId*>levigo-jbig2-imageio</*artifactId*>
>      <*version*>1.6.2</*version*>
>      <*scope*>test</*scope*>
> </*dependency*>
>
>
>
> -----Original Message-----
> From: Tilman Hausherr <TH...@t-online.de>
> Sent: December 10, 2019 8:50 AM
> To: users@pdfbox.apache.org
> Subject: AW: Re: PDFBox 1.8.10 Question
>
>
>
> or download the sources for that version and search for
> CreateVisibleSignature.java and first get it to run with your
> certificate / pin / keystore / PKI device etc.
>
>
>
> Tilman
>
>
>
>
>
> ----------------------------------------------------------------------
> --
>
> Gesendet mit der Telekom Mail App
>
> <
> https://kommunikationsdienste.t-online.de/redirects/email_app_android_
> sendmail_footer
>
>
>
>
>
>
> --- Original-Nachricht ---
>
> Von: Waldemar Dick
>
> Betreff: Re: PDFBox 1.8.10 Question
>
> Datum: 10.12.2019, 14:45 Uhr
>
> An: users@pdfbox.apache.org
>
>
>
>
>
>
>
>
>
> Hello Wade,
>
>
>
> The documentation is sparse, because PDFBox gives you all objects
> according to the PDF specification.
>
> The naming convention is matching or very close to the names used in
> the PDF specification.
>
> Take a look here: https://www.adobe.com/devnet/pdf/pdf_reference.html
>
> <https://www.adobe.com/devnet/pdf/pdf_reference.html> <
> https://www.adobe.com/devnet/pdf/pdf_reference.html>
>
> <https://www.adobe.com/devnet/pdf/pdf_reference.html>> ;
>
>
>
> Chapter 12.8 Digital Signatures explains the signature process in PDF.
>
>
>
> PDFBox has a lot of very good examples here:
>
> https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/
> apache/pdfbox/examples/signature
>
> <
> https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/
> apache/pdfbox/examples/signature
> / <
>
> https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/
> apache/pdfbox/examples/signature/
> <
> https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/
> apache/pdfbox/examples/signature/
> ;
>
>
>
>
>
>> PDSignature.setContents <http://PDSignature.setContents> ()
>
>
> This will take the CMS signature, that you have to create outside of
> the PDF. Take a look at the examples above.
>
>
>
> The visual part of a signature has nothing to do with the digital
> signature.
>
> The visual part is a widget annotation.
>
> Take a look at chapter 12.5.6.19 <http://12.5.6.19> Widget Annotations.
>
>
>
>
>
>
>
>
>
> Regards,
>
> Waldemar
>
>
>
>
>
>> On 10. 12 2019, at 13:58, Wade Polk <winthrop.polk@mddv.com
> <mailto:winthrop.polk@mddv.com <wi...@mddv.com>> > wrote:
>
>> Hello Mailing List,
>> Please forgive me if I’m doing this wrong, I’ve never actually used a
> mailing list for support like this but a developer said this was the
> best
>
> thing to do so here I am.
>
>> Long story short, I am attempting to use an older version of PDFBox
> (1.8.10) to fill out and sign a PDF form. All form fields and
> signature
>
> lines will be on the document long before this. It needs to be signed
> with
>
> a certificate and it needs to operate very much like it does in
> acrobat,
>
> were you see a picture and can click on it for signature details. I’ve
>
> attached my short code to keep this simple… my biggest issue has been
>
> related to understanding the object hierarchies and purpose…
> documentation
>
> is sparse so it confuses me (e.g. PDSignature.setContents
>
> <http://PDSignature.setContents> : “Sets the contents.” … doesn’t
> really
>
> tell me much, I’m guessing this is for setting the img or perhaps the
>
> actual certificate).
>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> <mailto:users-unsubscribe@pdfbox.apache.org
> <us...@pdfbox.apache.org>>
>
>> For additional commands, e-mail: users-help@pdfbox.apache.org
> <mailto:users-help@pdfbox.apache.org <us...@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


Re: PDFBox 1.8.10 Question

Posted by Tilman Hausherr <TH...@t-online.de>.
Use this:

         <dependency>
             <groupId>org.apache.pdfbox</groupId>
             <artifactId>jbig2-imageio</artifactId>
             <version>3.0.2</version>
         </dependency>

or (older with some bugs, and I doubt you'll need it for signing anyway)

         <dependency>
             <groupId>com.levigo.jbig2</groupId>
<artifactId>levigo-jbig2-imageio</artifactId>
             <version>1.6.5</version>
         </dependency>

Tilman


Am 10.12.2019 um 20:31 schrieb Wade Polk:
> Thanks for the advice, both these messages clarify a ton of stuff!
>
>
>
> I was having issues setting up pdfbox-1.8.10 in IntelliJ Idea but I think I
> almost have it working except for one dependency below seems to be
> unattainable, any ideas?
>
>
>
> <*dependency*>
>      <*groupId*>com.levigo.jbig2</*groupId*>
>      <*artifactId*>levigo-jbig2-imageio</*artifactId*>
>      <*version*>1.6.2</*version*>
>      <*scope*>test</*scope*>
> </*dependency*>
>
>
>
> -----Original Message-----
> From: Tilman Hausherr <TH...@t-online.de>
> Sent: December 10, 2019 8:50 AM
> To: users@pdfbox.apache.org
> Subject: AW: Re: PDFBox 1.8.10 Question
>
>
>
> or download the sources for that version and search for
> CreateVisibleSignature.java and first get it to run with your certificate /
> pin / keystore / PKI device etc.
>
>
>
> Tilman
>
>
>
>
>
> ------------------------------------------------------------------------
>
> Gesendet mit der Telekom Mail App
>
> <
> https://kommunikationsdienste.t-online.de/redirects/email_app_android_sendmail_footer
>
>
>
>
>
>
> --- Original-Nachricht ---
>
> Von: Waldemar Dick
>
> Betreff: Re: PDFBox 1.8.10 Question
>
> Datum: 10.12.2019, 14:45 Uhr
>
> An: users@pdfbox.apache.org
>
>
>
>
>
>
>
>
>
> Hello Wade,
>
>
>
> The documentation is sparse, because PDFBox gives you all objects according
> to the PDF specification.
>
> The naming convention is matching or very close to the names used in the
> PDF specification.
>
> Take a look here: https://www.adobe.com/devnet/pdf/pdf_reference.html
>
> <https://www.adobe.com/devnet/pdf/pdf_reference.html> <
> https://www.adobe.com/devnet/pdf/pdf_reference.html>
>
> <https://www.adobe.com/devnet/pdf/pdf_reference.html>> ;
>
>
>
> Chapter 12.8 Digital Signatures explains the signature process in PDF.
>
>
>
> PDFBox has a lot of very good examples here:
>
> https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature
>
> <
> https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature
> / <
>
> https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/
> <
> https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/
> ;
>
>
>
>
>
>> PDSignature.setContents <http://PDSignature.setContents> ()
>
>
> This will take the CMS signature, that you have to create outside of the
> PDF. Take a look at the examples above.
>
>
>
> The visual part of a signature has nothing to do with the digital signature.
>
> The visual part is a widget annotation.
>
> Take a look at chapter 12.5.6.19 <http://12.5.6.19> Widget Annotations.
>
>
>
>
>
>
>
>
>
> Regards,
>
> Waldemar
>
>
>
>
>
>> On 10. 12 2019, at 13:58, Wade Polk <winthrop.polk@mddv.com
> <mailto:winthrop.polk@mddv.com <wi...@mddv.com>> > wrote:
>
>> Hello Mailing List,
>> Please forgive me if I’m doing this wrong, I’ve never actually used a
> mailing list for support like this but a developer said this was the best
>
> thing to do so here I am.
>
>> Long story short, I am attempting to use an older version of PDFBox
> (1.8.10) to fill out and sign a PDF form. All form fields and signature
>
> lines will be on the document long before this. It needs to be signed with
>
> a certificate and it needs to operate very much like it does in acrobat,
>
> were you see a picture and can click on it for signature details. I’ve
>
> attached my short code to keep this simple… my biggest issue has been
>
> related to understanding the object hierarchies and purpose… documentation
>
> is sparse so it confuses me (e.g. PDSignature.setContents
>
> <http://PDSignature.setContents> : “Sets the contents.” … doesn’t really
>
> tell me much, I’m guessing this is for setting the img or perhaps the
>
> actual certificate).
>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> <mailto:users-unsubscribe@pdfbox.apache.org
> <us...@pdfbox.apache.org>>
>
>> For additional commands, e-mail: users-help@pdfbox.apache.org
> <mailto:users-help@pdfbox.apache.org <us...@pdfbox.apache.org>>
>


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


RE: Re: PDFBox 1.8.10 Question

Posted by Wade Polk <wi...@mddv.com>.
Thanks for the advice, both these messages clarify a ton of stuff!



I was having issues setting up pdfbox-1.8.10 in IntelliJ Idea but I think I
almost have it working except for one dependency below seems to be
unattainable, any ideas?



<*dependency*>
    <*groupId*>com.levigo.jbig2</*groupId*>
    <*artifactId*>levigo-jbig2-imageio</*artifactId*>
    <*version*>1.6.2</*version*>
    <*scope*>test</*scope*>
</*dependency*>



-----Original Message-----
From: Tilman Hausherr <TH...@t-online.de>
Sent: December 10, 2019 8:50 AM
To: users@pdfbox.apache.org
Subject: AW: Re: PDFBox 1.8.10 Question



or download the sources for that version and search for
CreateVisibleSignature.java and first get it to run with your certificate /
pin / keystore / PKI device etc.



Tilman





------------------------------------------------------------------------

Gesendet mit der Telekom Mail App

<
https://kommunikationsdienste.t-online.de/redirects/email_app_android_sendmail_footer
>







--- Original-Nachricht ---

Von: Waldemar Dick

Betreff: Re: PDFBox 1.8.10 Question

Datum: 10.12.2019, 14:45 Uhr

An: users@pdfbox.apache.org









Hello Wade,



The documentation is sparse, because PDFBox gives you all objects according
to the PDF specification.

The naming convention is matching or very close to the names used in the
PDF specification.

Take a look here: https://www.adobe.com/devnet/pdf/pdf_reference.html

<https://www.adobe.com/devnet/pdf/pdf_reference.html> <
https://www.adobe.com/devnet/pdf/pdf_reference.html>

<https://www.adobe.com/devnet/pdf/pdf_reference.html>> ;



Chapter 12.8 Digital Signatures explains the signature process in PDF.



PDFBox has a lot of very good examples here:

https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature

<
https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature
>

/ <

https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/
>

<
https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/
>>

;





> PDSignature.setContents <http://PDSignature.setContents> ()



This will take the CMS signature, that you have to create outside of the
PDF. Take a look at the examples above.



The visual part of a signature has nothing to do with the digital signature.

The visual part is a widget annotation.

Take a look at chapter 12.5.6.19 <http://12.5.6.19> Widget Annotations.









Regards,

Waldemar





> On 10. 12 2019, at 13:58, Wade Polk <winthrop.polk@mddv.com

<mailto:winthrop.polk@mddv.com <wi...@mddv.com>> > wrote:

>

> Hello Mailing List,

>

> Please forgive me if I’m doing this wrong, I’ve never actually used a

mailing list for support like this but a developer said this was the best

thing to do so here I am.

>

> Long story short, I am attempting to use an older version of PDFBox

(1.8.10) to fill out and sign a PDF form. All form fields and signature

lines will be on the document long before this. It needs to be signed with

a certificate and it needs to operate very much like it does in acrobat,

were you see a picture and can click on it for signature details. I’ve

attached my short code to keep this simple… my biggest issue has been

related to understanding the object hierarchies and purpose… documentation

is sparse so it confuses me (e.g. PDSignature.setContents

<http://PDSignature.setContents> : “Sets the contents.” … doesn’t really

tell me much, I’m guessing this is for setting the img or perhaps the

actual certificate).

>

>

>

> ---------------------------------------------------------------------

> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org

<mailto:users-unsubscribe@pdfbox.apache.org
<us...@pdfbox.apache.org>>

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

<mailto:users-help@pdfbox.apache.org <us...@pdfbox.apache.org>>

AW: Re: PDFBox 1.8.10 Question

Posted by Tilman Hausherr <TH...@t-online.de>.
or download the sources for that version and search for 
CreateVisibleSignature.java and first get it to run with your certificate / 
pin / keystore / PKI device etc.

Tilman


------------------------------------------------------------------------
Gesendet mit der Telekom Mail App
<https://kommunikationsdienste.t-online.de/redirects/email_app_android_sendmail_footer>



--- Original-Nachricht ---
Von: Waldemar Dick
Betreff: Re: PDFBox 1.8.10 Question
Datum: 10.12.2019, 14:45 Uhr
An: users@pdfbox.apache.org




Hello Wade,

The documentation is sparse, because PDFBox gives you all objects according 
to the PDF specification.
The naming convention is matching or very close to the names used in the 
PDF specification.
Take a look here: https://www.adobe.com/devnet/pdf/pdf_reference.html
<https://www.adobe.com/devnet/pdf/pdf_reference.html> <
https://www.adobe.com/devnet/pdf/pdf_reference.html>
<https://www.adobe.com/devnet/pdf/pdf_reference.html>> ;

Chapter 12.8 Digital Signatures explains the signature process in PDF.

PDFBox has a lot of very good examples here:
https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature
<https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature> 
/ <
https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/>
<https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/>> 
;


> PDSignature.setContents <http://PDSignature.setContents> ()

This will take the CMS signature, that you have to create outside of the 
PDF. Take a look at the examples above.

The visual part of a signature has nothing to do with the digital 
signature.
The visual part is a widget annotation.
Take a look at chapter 12.5.6.19 <http://12.5.6.19> Widget Annotations.




Regards,
Waldemar


> On 10. 12 2019, at 13:58, Wade Polk <winthrop.polk@mddv.com
<ma...@mddv.com> > wrote:
>
> Hello Mailing List,
>
> Please forgive me if I’m doing this wrong, I’ve never actually used a 
mailing list for support like this but a developer said this was the best 
thing to do so here I am.
>
> Long story short, I am attempting to use an older version of PDFBox 
(1.8.10) to fill out and sign a PDF form. All form fields and signature 
lines will be on the document long before this. It needs to be signed with 
a certificate and it needs to operate very much like it does in acrobat, 
were you see a picture and can click on it for signature details. I’ve 
attached my short code to keep this simple… my biggest issue has been 
related to understanding the object hierarchies and purpose… documentation 
is sparse so it confuses me (e.g. PDSignature.setContents
<http://PDSignature.setContents> : “Sets the contents.” … doesn’t really 
tell me much, I’m guessing this is for setting the img or perhaps the 
actual certificate).
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
<ma...@pdfbox.apache.org>
> For additional commands, e-mail: users-help@pdfbox.apache.org
<ma...@pdfbox.apache.org>


Re: PDFBox 1.8.10 Question

Posted by Waldemar Dick <wd...@devmue.de>.
Hello Wade,

The documentation is sparse, because PDFBox gives you all objects according to the PDF specification.
The naming convention is matching or very close to the names used in the PDF specification.
Take a look here: https://www.adobe.com/devnet/pdf/pdf_reference.html <https://www.adobe.com/devnet/pdf/pdf_reference.html>

Chapter 12.8 Digital Signatures explains the signature process in PDF.

PDFBox has a lot of very good examples here:
https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/ <https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/>


> PDSignature.setContents()

This will take the CMS signature, that you have to create outside of the PDF. Take a look at the examples above.

The visual part of a signature has nothing to do with the digital signature.
The visual part is a widget annotation.
Take a look at chapter 12.5.6.19 Widget Annotations.




Regards,
Waldemar


> On 10. 12 2019, at 13:58, Wade Polk <wi...@mddv.com> wrote:
> 
> Hello Mailing List,
>  
> Please forgive me if I’m doing this wrong, I’ve never actually used a mailing list for support like this but a developer said this was the best thing to do so here I am.
>  
> Long story short, I am attempting to use an older version of PDFBox (1.8.10) to fill out and sign a PDF form. All form fields and signature lines will be on the document long before this. It needs to be signed with a certificate and it needs to operate very much like it does in acrobat, were you see a picture and can click on it for signature details. I’ve attached my short code to keep this simple… my biggest issue has been related to understanding the object hierarchies and purpose… documentation  is sparse so it confuses me (e.g. PDSignature.setContents: “Sets the contents.” … doesn’t really tell me much, I’m guessing this is for setting the img or perhaps the actual certificate).
>  
>  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org