HiQPdf Documentation

PDF Page

Quickly Create High Quality PDFs

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 one of the PdfDocumentAddPageAtIndex overloaded methods.

Create PDF Pages Sample Source Code

// determine the PDF page where to add URL 2
PdfPage page2 = null;
PointF location2 = PointF.Empty;
if (checkBoxNewPage.Checked)
    // URL 2 is laid out on a new page with the selected orientation
    page2 = document.AddPage(PdfPageSize.A4, PdfDocumentMargins.Empty, GetSelectedPageOrientation());
    location2 = PointF.Empty;
    // URL 2 is laid out immediately after URL 1 and html1LayoutInfo
    // gives the location where the URL 1 layout finished
    page2 = document.Pages[html1LayoutInfo.LastPageIndex];
    location2 = new PointF(html1LayoutInfo.LastPageRectangle.X, html1LayoutInfo.LastPageRectangle.Bottom);
Iterate PDF Pages Sample Source Code

#region Add an orange border to each page of the loaded PDF document

// 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 = Color.OrangeRed;

    // layout the rectangle in PDF page

See Also

Other Resources