Click or drag to resize

Conversion Summary

The ConversionSummary property of the PdfConverter class returns an object filled in by each successful call of the conversion methods described in PdfConverter Class. Its data describes the conversion that has just finished and helps to change the generated document further, as described in Post Convert Customization.

The main properties of the ConversionSummary object are PdfPageCount, the number of pages rendered by the converter, and RenderedPagesRectangles, the rectangle of the content rendered on each page.

To add more content after the converted page, use LastPageIndex and LastPageRectangle: the zero based index of the last rendered page and the rectangle of the content on that page. The rectangle ends where the content of the page ends (see Where the last page ends). ConsoleLog holds what the scripts of the page wrote to the browser console.

Sample Code

The code below converts a URL, then adds a second web page right below the content of the first one:

PdfConverter pdfConverter = new PdfConverter();

// convert the first URL to a Document object
Document pdfDocument = pdfConverter.GetPdfDocumentObjectFromUrl(url);
try
{
    ConversionSummary conversionSummary = pdfConverter.ConversionSummary;

    // the PDF page where the conversion ended
    PdfPage lastPage = pdfDocument.Pages[conversionSummary.LastPageIndex];

    // the rectangle of the content on that page
    RectangleF lastRectangle = conversionSummary.LastPageRectangle;

    // add the second URL right below the content of the first conversion
    HtmlToPdfElement htmlToPdfUrl2 = new HtmlToPdfElement(lastRectangle.Left,
        lastRectangle.Bottom, url2);
    lastPage.AddElement(htmlToPdfUrl2);

    pdfDocument.Save(pdfFilePath);
}
finally
{
    pdfDocument.Close();
}

The second page continues on new pages when it does not fit on the last page (see HTML to PDF element).

See Also