I am using PdfFileEditor to extract a page, then using PdfPageEditor to rotate the extracted page on the attached PDF. When I rotate page 1 I am loosing part of the image. I can't seem to figure out why this is happening?
Hi,
We're looking into the matter and will update you the earliest possible.
We appreciate your patience.
Regards,
Hi Brian,
Thanks for considering Aspose.
The reason why you are facing the problem is because the page origin for the resultant file is not properly set when it is rotated. Please try using the MovePosition method in PdfPageEditor Class. I've tested the issue using the following code snippet and it resolved the problem. The resultant file that I've generated is also in attachment. Please take a look.
[C#]
//construct a PdfPageEditor object
PdfPageEditor pe = new PdfPageEditor();
//Binds an input pdf file
pe.BindPdf(@"d:\pdftest\dtuser2.pdf");
// Sets the rotation of the pages,
pe.Rotation = 90;
//Moves the origin from (0, 0) to the point that specified
pe.MovePosition(5, 270);
//Saves the result PDF to file.
pe.Save(@"d:\pdftest\dtuser_rotated.pdf");
Thanks, it looks perfect, but how am I supposed to determine what the position should be at runtime? I am writing a generic pdf page rotation class and I am not going to have the luxury of hard coding the position values.
Hi Brian,
As far as I’ve tested the position issue is occurring for this Pdf file only, when setting rotation angle for page. As a workaround you can use the following code snippet.
[C#]
//construct a PdfPageEditor object
PdfPageEditor pe = new PdfPageEditor();
//Binds an input pdf file
pe.BindPdf(@"D:\pdftest\Rotation_Resources\dtuser2.pdf");
// Integer to hold the Rotaion angle
int angle = 0;
if (angle == 0)
{
// Sets the rotation of the pages,
pe.Rotation = angle;
//Moves the origin from (0, 0) to the point that specified
pe.MovePosition(130, 135);
}
else if (angle == 90)
{
// Sets the rotation of the pages,
pe.Rotation = angle;
//Moves the origin from (0, 0) to the point that specified
pe.MovePosition(5, 270);
}
else if (angle == 270)
{
// Sets the rotation of the pages,
pe.Rotation = angle;
//Moves the origin from (0, 0) to the point that specified
pe.MovePosition(270, 5);
}
else if (angle == 180)
{
// Sets the rotation of the pages,
pe.Rotation = angle;
//Moves the origin from (0, 0) to the point that specified
pe.MovePosition(405, 405);
}
//Saves the result PDF to file.
pe.Save(@"D:\pdftest\Rotation_Resources\dtuser_Rotated"+ angle.ToString()+".pdf");
If it does not satisfy your requirement, please feel free to contact.
Hello,
We have investigated the rotation problem and found that it is a bug for some particular pdf documents. We have logged it as PDFKITNET-7573 in our Issue Tracking System and we will resolve it ASAP.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Hi,
The issue PDFKITNET-7573 has been resolved, please download the attached Beta version(3.3.1.8) of Aspose.Pdf.Kit and try it before our next release publishing.
Thanks,
Seems to work. Thanks!
The issues you have found earlier (filed as 7573) have been fixed in [this update](http://www.aspose.com/community/files/51/file-format-components/aspose.pdf.kit-for-.net-and-java/entry171362.aspx).