Click or drag to resize

Conversion Summary

The ConversionSummary property of the PdfConverter class returns an object, populated after the call of one of the render methods described in PdfConverter Class section, with a set of data that can be used to display details about the conversion that has just finished or to further customize the generated PDF document as described in the Post Convert Customization section.

The most important properties of the ConversionSummary object are the PdfPageCount, which represents the total number of pages rendered by the converter and the RenderedPagesRectangles, which gives for each rendered PDF page the bounding rectangle for the content rendered in that page.

For example, if you want to add more elements at the end of the generated PDF document after a conversion, you can find where the conversion ended from the last rectangle of the RenderedPagesRectangles array. For this important scenario, two other properties were also added to the conversion summary: LastPageIndex and LastPageRectangle giving the zero based index of the last rendered page and the bounding rectangle of the content rendered in this last page.

Sample Code

Usage of conversion summary object is illustrated below:

// initialize pdf converter
PdfConverter pdfConverter = new PdfConverter();

// call the converter and get a Document object from URL
Document pdfDocument = pdfConverter.GetPdfDocumentObjectFromUrl(url);

// get the conversion summary object
ConversionSummary conversionSummary = pdfConverter.ConversionSummary;

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

// the last rectangle in the last PDF page where the previous conversion nded
RectangleF lastRectangle = conversionSummary.LastPageRectangle;

// add another html element right below the content of the initial conversion
HtmlToPdfElement htmlToPdfUrl2 = new HtmlToPdfElement(lastRectangle.Left, lastRectangle.Bottom, url2);

// save document

// close document