A PDF page is represented by the PdfPage class. A PDF document has a collection of pages given by the PdfDocumentPages property. A new page can be added to the PDF document using one of the PdfDocumentAddPage overloaded methods or the PdfDocumentAddPageAtIndex method.
Create PDF Pages Sample Source Code
C#
// URL 2 is laid out on a new page with the selected orientation PdfPage page2 = document.AddPage(PdfPageSize.A4, new PdfMargins(5), GetSelectedPageOrientation()); // layout the HTML from URL 2 PdfHtml html2 = new PdfHtml(textBoxUrl2.Text); html2.WaitBeforeConvert = 2; page2.Layout(html2);
Iterate PDF Pages Sample Source Code
C#
// add an orange border to each PDF page in the loaded PDF document foreach (PdfPage pdfPage in document.Pages) { float crtPdfPageWidth = pdfPage.Size.Width; float crtPdfPageHeight = pdfPage.Size.Height; // create a PdfRectangle object PdfRectangle pdfRectangle = new PdfRectangle(2, 2, crtPdfPageWidth - 4, crtPdfPageHeight - 4); pdfRectangle.LineStyle.LineWidth = 2; pdfRectangle.ForeColor = PdfColor.OrangeRed; // layout the rectangle in PDF page pdfPage.Layout(pdfRectangle); }
See Also