Insert Page Break in PDF using C#

This topic describes how to insert page break in PDF using C#. It has the details to set the development environment, a list of steps, and a sample code showing how to insert a page break in a PDF document using C#. You will get details to define the position on the page for adding a page break.

Steps to Add Page Break to PDF using C#

  1. Set the environment to use Aspose.PDF for .NET to add a page break
  2. Load the source PDF file into the Document class object for inserting a page break
  3. Create another empty PDF file for saving the output PDF file
  4. Instantiate the PdfFileEditor object for working with the PDF
  5. Add a page break at the specified location
  6. Save the output

The above steps describe how to insert a page break in Adobe PDF using C#. Load the source PDF document, create an empty PDF document for saving the output, and instantiate the PdfFileEditor object. Call the AddPageBreak() method by providing the page numbers and position from the bottom of the document.

Code to Add Page Break in PDF using C#

This example code demonstrates how to insert page break in Adobe PDF using C#. The PdfFileEditor contains the features to work with the contents in a PDF file. Use the AddPageBreak() method that takes the source document, output document, and an array of page breaks where you set the page number and distance from the bottom in pixels to add a page break.

This quick example has taught us how to add page break in PDF using C#. To split a document by pages, refer to the article on how to split PDF file by pages in C#.

 English