Oh-oh... The source code adjustForRotation() has some suspicious
hard-coded parts (the 100, 50, 0.5 and 2) :-(
I need to think about this... either this was intended, or bad
judgement. Until then, you can try creating your own
PDVisibleSignDesigner and overwrite that method. Or change your picture
so that it is 200 x 100.
current code:
public PDVisibleSignDesigner adjustForRotation()
{
switch (rotation)
{
case 90:
// https://stackoverflow.com/a/34359956/535646
float temp = yAxis;
yAxis = pageHeight - xAxis - imageWidth;
xAxis = temp;
temp = imageHeight;
imageHeight = imageWidth;
imageWidth = temp;
affineTransform = new AffineTransform(0, 0.5, -2, 0,
100, 0);
break;
case 180:
float newX = pageWidth - xAxis - imageWidth;
float newY = pageHeight - yAxis - imageHeight;
xAxis = newX;
yAxis = newY;
affineTransform = new AffineTransform(-1, 0, 0, -1,
100, 50);
break;
case 270:
temp = xAxis;
xAxis = pageWidth - yAxis - imageHeight;
yAxis = temp;
temp = imageHeight;
imageHeight = imageWidth;
imageWidth = temp;
affineTransform = new AffineTransform(0, -0.5, 2, 0, 0,
50);
break;
case 0:
default:
break;
}
return this;
}
Tilman
Am 23.10.2018 um 20:58 schrieb Patrick Herber:
Hi
Thanks a lot for your reply! I’m using version 2.0.12.
As PDF file I’ve used for example the attached doc0-rotated90.pdf file
whereas as signature the attached signature.png file
Then I’ve used the example CreateVisibleSignature
(https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/CreateVisibleSignature.java?view=markup)
and on line 91 replaced the current
visibleSignDesigner.xAxis(x).yAxis(y).zoom(zoomPercent).adjustForRotation();
with
visibleSignDesigner.xAxis(x).yAxis(y).height(92).width(265).adjustForRotation();
Regards
Patrick
On 23 Oct 2018, at 19:44, Tilman Hausherr <[email protected]
<mailto:[email protected]>> wrote:
Hi,
What version are you using?
Please share the PDF and mention what parameters are different than
the example.
Tilman
Am 23.10.2018 um 11:40 schrieb Patrick Herber:
Hi,
I have some problems with the sizing of a signature field inside a
rotated document page (90 degrees).
If instead of specifying the zoom factor (as in the
CreateVisibleSignature example) I specify the desired height and
width of the signature, the resulting image has completely wrong
dimensions:
visibleSignDesigner.xAxis(x).yAxis(y).height(height).width(width).adjustForRotation();
If the page is not rotated or if I remove the call to
adjustForRotation() then the image is correctly displayed (in case
of rotated document of course rotated but with the correct proportions).
What could be the problem?
Thanks a lot for your help and best regards
Patrick
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
<mailto:[email protected]>
For additional commands, e-mail: [email protected]
<mailto:[email protected]>