Click or drag to resize
Pdf Library for .NET
Partial Page Conversion with Html to Pdf Converter

Select.Pdf Html to Pdf Converter for .NET can be used to convert only a specific section of a web page to pdf.

The section that will be converted to pdf is specified by the html element ID. The element can be anything (image, table, table row, div, text, etc). To set the element id in Select.Pdf Library, the VisibleWebElementId property of the HtmlToPdfOptions object must be used.

Sample Code

This sample code shows how the html to pdf converter can be used to convert only a section of a web page using Select.Pdf Pdf Library for .NET.

// instantiate a html to pdf converter object
HtmlToPdf converter = new HtmlToPdf();

// specify the id of the section that will be converted to pdf
converter.Options.VisibleWebElementId = elementId;

// create a new pdf document converting an url
PdfDocument doc = converter.ConvertUrl(url);

// save pdf document
doc.Save(Response, false, "Sample.pdf");

// close pdf document
doc.Close();
See Also