We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Shift all contents of PDF Horizontally or Vertically

I have a pdf document that I need to open and shift all the contents on each page horizontally and/or vertically to account for printing on different printers. How can I accomplish this using Aspose.PDF?

Hi Steve,

Thanks for your inquiry. You may rotate document pages as per your requirements. Please check following code snippet for the purpose. Hopefully it will help you to accomplish the task.

Document pdfDocument
= new Document(myDir

  • “TestPdf.pdf”);<o:p></o:p>

for (int i = 1; i <= pdfDocument.Pages.Count; i++)




pdfDocument.Save(myDir + "TestPdf_rotate.pdf");

Please feel free to contact us for any further assistance.

Best Regards,

we need to be able to move all the contents of the document slightly to the left, right, top, or bottom. Will rotating the page do this?

Hi Steve,

Thanks for your feedback. To move all the contents within a page you can use ResizeContents method of PdfFileEditor. Please check following documentation link for the purpose. Moreover, page rotation method rotate page to some predefined angles(90,180, 270).

Please feel free to contact us for any further assistance.

Best Regards,

Hi Steve,

Adding more to Tilal’s comments, you may also consider moving the page origin to new location. Please try using MovePosition(…) method of PdfPageEditor class.


// instantiate PdfPageEditor class to get particular page region<o:p></o:p>

Aspose.Pdf.Facades.PdfPageEditor editor = new Aspose.Pdf.Facades.PdfPageEditor();<o:p></o:p>

// bind the source PDF file<o:p></o:p>


// move the origin of PDF file to particular point<o:p></o:p>