Most commonly used web browsers like Chrome, Internet Explorer, FireFox, Opera, and Safari provides users with the options to save web page for further reference. But it is not so much convenient to send the web page for others to view or keep on PC. If you want to save a web page content and share it with other colleagues or send it to a printer, converting it to a PDF document or an image file might prove handy. Certainly, PDF appears much more like the original web page. As we all know, the images, table, links, and other media files function normally within the PDF document.

Need to turn or convert a web URL to other convenient presentation formats like PDF, JPG, BMP, and PNG in C# application development? Use XsHtml .NET HTML to PDF SDK. This powerful .NET Html converter library allows you to integrate high-quality HTML to PDF/images conversion features to C# programming projects. Use our powerful APIs to create PDFs and images from web URL automatically!

How to Convert HTML Web URL to PDF/Image in C#

Converting from web page URL to PDF document or raster images with XsHtml HTML to PDF SDK is quite easy. Take a look at the C# example below, which shows how to convert web page URL to PDF document in C# programming. It might be the most handiest way to save web page URL as PDF for storing, sharing, printing, and other manipulating.

// Set html source from a online url or your localhost in IIS
string url = "";
string savePath = "sample.pdf";

// Create a Html converter instance 
HtmlToPdfConverter converter = new HtmlToPdfConverter();

// Set output PDF size
converter.PageSize = PageSize.A4;
// Convert html to PDF
converter.ConvertFromFile(html, savePath);

Notice - If you use the free trial version of .NET HTML to PDF SDK, for HTML to PDF: there is a statement in page footer("This is an XsPDF trial version"), for HTML to image: the image quality is 50% of its original.