Click or drag to resize
Pdf Library for .NET

Convert Url To Pdf

Using Select.Pdf Html to Pdf Converter for .NET any web page can be converted to pdf. The web page can be specified by an external url or can be a local html file on the disk.

To convert an url (or local file) to pdf, HtmlToPdf class exposes the ConvertUrl(String) method.

Sample Code

This sample code shows how to use Select.Pdf html to pdf converter to convert an url to pdf, also setting a few properties.

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

// set converter options
converter.Options.PdfPageSize = pageSize;
converter.Options.PdfPageOrientation = pdfOrientation;
converter.Options.WebPageWidth = webPageWidth;
converter.Options.WebPageHeight = webPageHeight;

// 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
See Also