As a follow up to this question we created similar signatures with Adobe Reader and iText (both the latest versions, both able to print the signature image on Chrome) and inspected the generated PDFs.

Looking at the AP dictionary I noticed that both write the BBox for the /N, /FRM and /img dictionaries different than PDFBox.

For the /N and /FRM they both write [0, 0, width, height] the values being those from the rectangle where the image is set. For /img they calculate the scale factor relative between the image original size and the rectangle size.

PDFBox uses by default for all three [100, 50, 0, 0] and that can be changed with PDVisibleSignDesigner.formatterRectangleParams(byte[]).

Using that method (but passing 127 for width, because when i used 128 it wrote -128 on the PDF), the image was sucessfully printed from Chrome, although it does not fit the whole space, I believe because of the line "String imgFormContent    = "q " + 100 + " 0 0 50 0 0 cm /" + imageName.getName() + " Do Q\n";" in PDVisibleSigBuilder.injectAppearanceStreams.

And just to pinpoint the exact BBox, i downloaded PDFBox from 2.0.9 -SNAPSHOT and changed the code so that only the BBox from PDFTemplateBuilder.createHolderForm receives the value set in formatterRectangleParams(byte[]) and I was able to print the signature image.

I'm curious why PDFBox uses [100, 50, 0, 0] as the BBox, because for what i understood according to the PDF spec is that it represents the lower left (in this case x=100, y=50) and upper right corners (x=0, y=0) of what is being drawn.

The original and signed files that i used for this can be found at: https://drive.google.com/open?id=0B2hR5R90BDFQZzkwSHEzTVEwSDQ

Em 27/10/2017 17:15, Tilman Hausherr escreveu:
it's a known problem in chrome:
https://bugs.chromium.org/p/pdfium/issues/detail?id=643

it's a known problem in firefox:
https://github.com/mozilla/pdf.js/issues/4743

Tilman

Am 27.10.2017 um 21:02 schrieb Gabriel Pessoa:
Just to clarify, the problem was detected with a client that prefers to download and print their signed PDFs directly from Chrome.

On Edge the image is printed no problem and Firefox is the same as Chrome.


Em 27/10/2017 16:57, Gabriel Pessoa escreveu:
Hello everyone I have a problem that is bugging me for the last couple of days.

When we sign any PDF with a image associated and then we open the signed PDF on Chrome and try to print from it, the image does not appears.

I tried PDFs generated with the HelloWorld example, exported from Word, BIRT Report Engine and AsposePdf and the result was the same. We have applications running PDFBox 1.8.13 (legacy, soon to be discontinued) and 2.0.7, and in both the situation occurs.

It is possible to replicate the problem with the example for visual signature on the example directory. In any case the original file and the signed one can be found here: https://drive.google.com/open?id=0B2hR5R90BDFQZzkwSHEzTVEwSDQ

Thanks in advance for any help that you guys can give.

Att,

Gabriel Pessoa
Analista
BRy Tecnologia
Rua Lauro Linhares, 2123 Torre B - 3º andar
88036-002 - Florianópolis - SC - Brasil
+55 (48) 3234 6696


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


--
Atenciosamente,

Gabriel Pessoa
Analista
BRy Tecnologia
Rua Lauro Linhares, 2123 Torre B - 3º andar
88036-002 - Florianópolis - SC - Brasil
+55 (48) 3234 6696


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to