pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: Adjust signature field for rotated pages
Date Wed, 24 Oct 2018 17:20:30 GMT
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


Mime
View raw message