Hi, please share the signed 90° file (upload to a sharehoster, attachments are usually deleted). I'll have a look at it with PDFDebugger to see what is different.
Tilman --- Original-Nachricht --- Von: Patrick Herber Betreff: Re: Adjust signature field for rotated pages Datum: 29.10.2018, 8:02 Uhr An: [email protected] Dear Tilman Thanks a lot for your reply I’ve tried with the “latest" snapshot WAR files of version 2.0.13 (2.0.13-20181024.204010-80), 2.1.0 and 3 (3.0.0-20181026.180346-919) using the trunk version of the CreateVisibleSignature example class, changing only the line you mentioned inside the setVisibleSignDesigner method but unfortunately with all these versions I get the same result as in my previous screenshot: the width of the image is not correct. After the adjustForRotation() call the value of affineTransform is as you wrote: AffineTransform[[0.0, -2.88043475151062, 265.0], [0.347169816493988, 0.0, 0.0]] What could be then the difference? Thanks again and best regards Patrick Herber > On 27 Oct 2018, at 10:23, Tilman Hausherr <[email protected] <mailto:[email protected]> > wrote: > > Sorry about that... I signed the three files: > > https://drive.google.com/drive/folders/1D8qlk-_qF4cUz2iXemmGZbYIow1uSKs5?usp=sharing <https://drive.google.com/drive/folders/1D8qlk-_qF4cUz2iXemmGZbYIow1uSKs5?usp=sharing> < https://drive.google.com/drive/folders/1D8qlk-_qF4cUz2iXemmGZbYIow1uSKs5?usp=sharing> <https://drive.google.com/drive/folders/1D8qlk-_qF4cUz2iXemmGZbYIow1uSKs5?usp=sharing>> ; > > How did you sign them? By getting the code from a snapshot or by extending the class? > > I used the CreateVisibleSignature example with the modification you mentioned: > > public void setVisibleSignDesigner(String filename, int x, int y, int zoomPercent, > InputStream imageStream, int page) > throws IOException > { > visibleSignDesigner = new PDVisibleSignDesigner(filename, imageStream, page); > visibleSignDesigner.xAxis(x).yAxis(y).height(92).width(265).adjustForRotation(); > } > > I tested with the trunk, but 2.0 should be identical in that aspect. > > If you extended the class and used the code I posted, here's the affinetransform after adjustforrotation(): > > 90°: > AffineTransform[[0.0, -2.88043475151062, 265.0], [0.347169816493988, 0.0, 0.0]] > > 180°: > AffineTransform[[-1.0, 0.0, 265.0], [0.0, -1.0, 92.0]] > > 270° > AffineTransform[[0.0, 2.88043475151062, 0.0], [-0.347169816493988, 0.0, 92.0]] > > Tilman > > Am 26.10.2018 um 22:58 schrieb Patrick Herber: >> Thanks a lot for this really quick fix! >> >> I’ve tested the correction but I fear there is still a small issue. The signature field is now correctly positioned inside the page for the 4 rotations, but in case of 90 and 270 degrees the signature images does not correctly fit the field. >> >> 90 degrees: signature image dimensions are not correct (height OK but width to small): >> >> <90degrees.png> <http://90degrees.png>> ; >> >> 180 degrees: signature image dimensions are correct: >> >> >> <180degrees.png> <http://180degrees.png>> ; >> >> >> Best regards and again thanks for the support! >> >> Patrick >> >> >>> On 24 Oct 2018, at 21:57, Tilman Hausherr <[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]> >> wrote: >>> >>> Done in >>> >>> https://issues.apache.org/jira/browse/PDFBOX-4359 <https://issues.apache.org/jira/browse/PDFBOX-4359> < https://issues.apache.org/jira/browse/PDFBOX-4359> <https://issues.apache.org/jira/browse/PDFBOX-4359>> ; >>> >>> There will be a snapshot in a few hours, hopfully (build server unstable) >>> >>> Tilman >>> >>> >>> >>> Am 24.10.2018 um 19:20 schrieb Tilman Hausherr: >>>> Please extend the PDVisibleSignDesigner class and implement this method. I'll commit this later (don't have much time right now). >>>> >>>> >>>> public PDVisibleSignDesigner adjustForRotation() >>>> { >>>> switch (rotation) >>>> { >>>> case 90: >>>> // https://stackoverflow.com/a/34359956/535646 <https://stackoverflow.com/a/34359956/535646> < https://stackoverflow.com/a/34359956/535646> <https://stackoverflow.com/a/34359956/535646>> ; >>>> float temp = yAxis; >>>> yAxis = pageHeight - xAxis - imageWidth; >>>> xAxis = temp; >>>> >>>> affineTransform = new AffineTransform( >>>> 0, imageHeight / imageWidth, -imageWidth / imageHeight, 0, imageWidth, 0); >>>> >>>> temp = imageHeight; >>>> imageHeight = imageWidth; >>>> imageWidth = temp; >>>> break; >>>> >>>> case 180: >>>> float newX = pageWidth - xAxis - imageWidth; >>>> float newY = pageHeight - yAxis - imageHeight; >>>> xAxis = newX; >>>> yAxis = newY; >>>> >>>> affineTransform = new AffineTransform(-1, 0, 0, -1, imageWidth, imageHeight); >>>> break; >>>> >>>> case 270: >>>> temp = xAxis; >>>> xAxis = pageWidth - yAxis - imageHeight; >>>> yAxis = temp; >>>> >>>> affineTransform = new AffineTransform( >>>> 0, -imageHeight / imageWidth, imageWidth / imageHeight, 0, 0, imageHeight); >>>> >>>> temp = imageHeight; >>>> imageHeight = imageWidth; >>>> imageWidth = temp; >>>> break; >>>> >>>> case 0: >>>> default: >>>> break; >>>> } >>>> return this; >>>> } >>>> >>>> >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] <mailto:[email protected]> <mailto: [email protected] <mailto:[email protected]> > >>>> For additional commands, e-mail: [email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]> > >>>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] <mailto:[email protected]> <mailto: [email protected] <mailto:[email protected]> > >>> For additional commands, e-mail: [email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]> > >>> >> >

