Click or drag to resize

PdfPage Class

The PdfPage class represents a page in the PDF document. A PdfPage class object can be instantiated using the AddPage method. When calling the AddPage method without parameters, a page with the default margins, size and orientation is created. The margins are inherited from the Margins property of the Document object. The default orientation is Portrait when adding the first page to the document or the previous page orientation is inherited if there was a previous page in document. The default size is A4 when adding the first page or the previous page size if there was a previous page in document. However, any of these properties can be specified when using other overloadings of the AddPage() method.

Sample Code

The sample code below opens an existing PDF document, adds are new page (size Letter, 5 points margins) and saves the document back to the file:

Document existingDoc = new Document(file);
PdfPage newPage = existingDoc.AddPage(PageSize.Letter, new Margins(5));
existingDoc.Save(file);
existingDoc.Close();