[ 
https://issues.apache.org/jira/browse/PDFBOX-4011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16251921#comment-16251921
 ] 

ASF subversion and git services commented on PDFBOX-4011:
---------------------------------------------------------

Commit 1815246 from [~tilman] in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1815246 ]

PDFBOX-4011: put bbox in correct order and allow flexibility, deprecate current 
byte array method and introduce int array method

> BBox in signature forms has wrong order
> ---------------------------------------
>
>                 Key: PDFBOX-4011
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4011
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Signing
>    Affects Versions: 1.8.13, 2.0.8
>            Reporter: Tilman Hausherr
>            Assignee: Tilman Hausherr
>             Fix For: 1.8.14, 2.0.9, 3.0.0 PDFBox
>
>
> As pointed out by Gabriel Pessoa in the user mailing list:
> {quote}
> 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 
> {code}
> "String imgFormContent    = "q " + 100 + " 0 0 50 0 0 cm /" + 
> imageName.getName() + " Do Q\n";" 
> {code}
> 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.
> {quote}
> Our code is wrong, in the specification bbox is defined as minX, minY, maxX, 
> maxY: "An array of four numbers in the form coordinate system, giving the 
> coordinates of the left, bottom, right, and top edges, respectively, of the 
> form XObject's bounding box. These boundaries shall be used to clip the form 
> XObject and to determine its size for caching."
> I'll change the code to make it more flexible and also create a method that 
> uses an int array and deprecate the current one.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to