How to Render URL to PDF

by Regan Pun

Rendering existing URLs as PDFs with C# is very efficient and intuitive. IronPDF makes it very straightforward to render HTML from existing URLs as PDF documents. There is a very high level of support for JavaScript, Images, Forms and CSS.


C# NuGet Library for PDF

Install with NuGet

Install-Package IronPdf
or
Java PDF JAR

Download DLL

Download DLL

Manually install into your project

C# NuGet Library for PDF

Install with NuGet

Install-Package IronPdf
or
Java PDF JAR

Download DLL

Download DLL

Manually install into your project

Start using IronPDF in your project today with a free trial.

First Step:
green arrow pointer

Check out IronPDF on Nuget for quick installation and deployment. With over 8 million downloads, it's transforming PDF with C#.

C# NuGet Library for PDF nuget.org/packages/IronPdf/
Install-Package IronPdf

Consider installing the IronPDF DLL directly. Download and manually install it for your project or GAC form: IronPdf.zip

Manually install into your project

Download DLL

Convert URL to PDF Example

Here we have an example of IronPDF renderig wikipedia webpage into a PDF by using the RenderUrlAsPdf() method. The parameter is an absolute (fully formed) Uri. This points to the Html document to be rendered as a PDF.

:path=/static-assets/pdf/content-code-examples/how-to/url-to-pdf.cs
using IronPdf;

// Instantiate Renderer
var renderer = new ChromePdfRenderer();

// Create a PDF from a URL or local file path
var pdf = renderer.RenderUrlAsPdf("https://en.wikipedia.org/wiki/Main_Page");

// Export to a file or Stream
pdf.SaveAs("url.pdf");
Imports IronPdf

' Instantiate Renderer
Private renderer = New ChromePdfRenderer()

' Create a PDF from a URL or local file path
Private pdf = renderer.RenderUrlAsPdf("https://en.wikipedia.org/wiki/Main_Page")

' Export to a file or Stream
pdf.SaveAs("url.pdf")
VB   C#

Result

This is the file that the code produced:

Regan Pun

Software Engineer

Regan graduated from the University of Reading, with a BA in Electronic Engineering. Before joining Iron Software, his previous job roles had him laser-focused on single tasks; and what he most enjoys at Iron Software is the spectrum of work he gets to undertake, whether it’s adding value to sales, technical support, product development or marketing. He enjoys understanding the way developers are using the Iron Software library, and using that knowledge to continually improve documentation and develop the products.