pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Herber <patrick.her...@gmail.com>
Subject Re: Adjust signature field for rotated pages
Date Fri, 26 Oct 2018 20:58:41 GMT
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):



180 degrees: signature image dimensions are correct:





Best regards and again thanks for the support!

Patrick


> On 24 Oct 2018, at 21:57, Tilman Hausherr <THausherr@t-online.de> wrote:
> 
> Done in
> 
> 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
>>                 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: 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
> 


Mime
View raw message