Test in production without watermarks.
Works wherever you need it to.
Get 30 days of fully functional product.
Have it up and running in minutes.
Full access to our support engineering team during your product trial
Convert PDFs using templates such as images, office documents, HTML, websites and build on them.
Convert HTML files into pixel-perfect PDFs. This feature ensures that your HTML designs, complete with CSS and JavaScript elements, render accurately in PDF format, preserving the visual layout and styling.
Learn how to:convert HTML to PDF// Import IronPdf namespace for PDF generation functionality
using IronPdf;
// Create ChromePdfRenderer instance for HTML to PDF conversion
var renderer = new ChromePdfRenderer();
// Convert HTML string to PDF document using Chrome rendering engine
// RenderHtmlAsPdf method processes HTML/CSS/JavaScript content
var pdfDocument = renderer.RenderHtmlAsPdf("<h1>Hello IronPdf</h1>");
// Save the generated PDF document to disk
// The PDF will be pixel-perfect matching Chrome's rendering
pdfDocument.SaveAs("pixel-perfect.pdf");Transform any webpage into a PDF with this feature. Ideal for capturing entire web pages or online articles as downloadable or shareable PDF documents.
Learn how to:convert URL to PDFusing IronPdf;
// Create ChromePdfRenderer for URL to PDF conversion
var renderer = new ChromePdfRenderer();
// Convert webpage URL directly to PDF document
// Preserves all styling, images, and interactive elements
var pdf = renderer.RenderUrlAsPdf("https://en.wikipedia.org/wiki/PDF");
// Save the rendered webpage as a PDF file
pdf.SaveAs("wikipedia.pdf");Easily convert DOCX files into PDFs while retaining formatting and structure, making document sharing and distribution simple and reliable.
Learn how to:convert DOCX to PDFusing IronPdf;
// Instantiate Renderer
DocxToPdfRenderer renderer = new DocxToPdfRenderer();
// Render from DOCX file
PdfDocument pdf = renderer.RenderDocxAsPdf("Modern-chronological-resume.docx");
// Save the PDF
pdf.SaveAs("pdfFromDocx.pdf");Convert Rich Text Format (RTF) and Markdown (MD) files into professional PDF documents, preserving the original formatting and styles.
Learn how to:convert RTF to PDFusing IronPdf;
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
// Load the RTF as File
PdfDocument pdfFromRTFFile = renderer.RenderRtfFileAsPdf("report.rtf");
PdfDocument pdfFromMDFile = renderer.RenderMarkdownFileAsPdf("report.md");
pdfFromRTFFile.SaveAs("report.pdf");
pdfFromMDFile.SaveAs("markdown.pdf");Quickly convert images to PDF format, perfect for creating PDF albums, reports with screenshots, or archiving scanned documents.
Learn how to:convert Image to PDFusing IronPdf;
using System.IO;
using System.Linq;
// One or more images as IEnumerable. This example selects all JPEG images in a specific 'assets' folder.
var imageFiles = Directory.EnumerateFiles("assets").Where(f => f.EndsWith(".jpg") || f.EndsWith(".jpeg"));
// Converts the images to a PDF and save it.
ImageToPdfConverter.ImageToPdf(imageFiles).SaveAs("composite.pdf");Easily convert Razor views to PDFs while preserving the layout and dynamic content. Perfect for turning server-rendered web pages into professional PDFs.
Learn how to:convert Razor Components to PDFprivate async void PrintToPdf()
{
ChromePdfRenderer renderer = new ChromePdfRenderer();
// Apply text footer
renderer.RenderingOptions.TextFooter = new TextHeaderFooter()
{
LeftText = "{date} - {time}",
DrawDividerLine = true,
RightText = "Page {page} of {total-pages}",
Font = IronSoftware.Drawing.FontTypes.Arial,
FontSize = 11
};
Parameters.Add("persons", persons);
// Render razor component to PDF
PdfDocument pdf = renderer.RenderRazorComponentToPdf<Person>(Parameters);
File.WriteAllBytes("razorComponentToPdf.pdf", pdf.BinaryData);
}Transform CSHTML files into PDFs that match the look and feel of your original page. This ensures that all HTML elements, styling, and formatting are retained.
Learn how to:convert Razor Pages to PDF// PM > Install-Package IronPdf.Extensions.Razor
using IronPdf.Razor.Pages;
public IActionResult OnPostAsync()
{
persons = new List<Person>
{
new Person { Name = "Alice", Title = "Mrs.", Description = "Software Engineer" },
};
ViewData["personList"] = persons;
ChromePdfRenderer renderer = new ChromePdfRenderer();
// Render Razor Page to PDF document
PdfDocument pdf = renderer.RenderRazorToPdf(this);
Response.Headers.Add("Content-Disposition", "inline");
return File(pdf.BinaryData, "application/pdf", "razorPageToPdf.pdf");
}Convert ASPX pages to PDF documents seamlessly, enabling easy sharing or archiving of web pages developed using the ASP.NET Web Forms framework.
Learn how to:convert ASPX to PDFusing IronPdf;
private void Form1_Load(object sender, EventArgs e)
{
//Changes the ASPX output into a pdf instead of HTML
IronPdf.AspxToPdf.RenderThisPageAsPdf();
}Render XAML files into high-quality PDFs with preserved structure and styling, ideal for applications built using WPF or other XAML-based technologies.
Learn how to:convert XAML to PDF// PM > Install-Package IronPdf.Extensions.Maui
ChromePdfRenderer renderer = new ChromePdfRenderer();
// Apply HTML header
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter()
{
HtmlFragment = "<h1>Header</h1>",
};
// Render PDF from Maui Page
PdfDocument pdf = renderer.RenderContentPageToPdf<MainPage, App>().Result;
pdf.SaveAs(@"C:\contentPageToPdf.pdf");Easily convert content from secure websites or authenticated sessions by supporting TLS and system login for secure conversions.
Learn how to:work with authenticated sessionsusing IronPdf;
using System;
using System.IO;
var uri = new Uri("http://localhost:51169/Invoice");
var urlToPdf = new ChromePdfRenderer
{
// Set login credentials to bypass basic authentication
LoginCredentials = new IronPdf.ChromeHttpLoginCredentials
{
NetworkUsername = "testUser",
NetworkPassword = "testPassword"
}
};
var pdf = urlToPdf.RenderUrlAsPdf(uri);
pdf.SaveAs(Path.Combine(Directory.GetCurrentDirectory(), "UrlToPdfWithHttpLogin.Pdf"));Set custom margins for your PDFs to better control the space and layout of the content. Perfect for creating print-ready documents with precise spacing.
Learn how to:customize marginusing IronPdf;
var renderer = new ChromePdfRenderer();
// Set Margins (in millimeters)
renderer.RenderingOptions.MarginTop = 40;
renderer.RenderingOptions.MarginLeft = 20;
renderer.RenderingOptions.MarginRight = 20;
renderer.RenderingOptions.MarginBottom = 40;
renderer.RenderHtmlFileAsPdf("my-content.html").SaveAs("my-content.pdf");Automatically insert page numbers into your PDFs. Control the position, formatting, and style to ensure your document is easy to navigate and looks organized.
Learn how to:set page numbersusing IronPdf;
ChromePdfRenderer renderer = new ChromePdfRenderer();
// Add text header as labelling the page numbers
renderer.RenderingOptions.TextHeader = new TextHeaderFooter()
{
CenterText = "{page} of {total-pages}",
};
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Hello World!</h1>");Convert your PDFs to grayscale to reduce file size, save ink when printing, or meet specific document submission requirements, while still maintaining clear readability.
Learn how to:convert to grayscaleusing IronPdf;
ChromePdfRenderer renderer = new ChromePdfRenderer();
// Set GrayScale to true
renderer.RenderingOptions.GrayScale = true;
PdfDocument pdf = renderer.RenderUrlAsPdf("https://ironsoftware.com/");
pdf.CopyPage(0).SaveAs("test.pdf");Create a dynamic table of contents for your PDFs to improve navigation and readability, especially for longer documents.
Learn how to:add a table of contentsusing IronPdf;
// Instantiate Renderer
ChromePdfRenderer renderer = new ChromePdfRenderer();
// Configure render options
renderer.RenderingOptions = new ChromePdfRenderOptions
{
// Enable table of content feature
TableOfContents = TableOfContentsTypes.WithPageNumbers,
};
PdfDocument pdf = renderer.RenderHtmlFileAsPdf("tableOfContent.html");
pdf.SaveAs("tableOfContents.pdf");Insert page breaks within your PDF document to control content flow and organization. This feature ensures that sections or paragraphs start on new pages, maintaining a professional layout and avoiding awkward splits.
Learn how to:add page breaksusing IronPdf;
var html = @"
<p> Hello Iron</p>
<p> This is 1st Page </p>
<div style = 'page-break-after: always;' ></div>
<p> This is 2nd Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 3rd Page</p>";
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("pageBreak.pdf");Automatically adjust the content of your PDF to fit within the chosen paper size. This feature optimizes your document's layout for printing or display, ensuring that no content is cut off and everything fits perfectly on the page.
Learn how to:use paper layoutsusing IronPdf;
ChromePdfRenderer renderer = new ChromePdfRenderer();
// Fit to page rendering
renderer.RenderingOptions.PaperFit.UseFitToPageRendering();
// Render web URL to PDF
PdfDocument pdf = renderer.RenderUrlAsPdf("https://en.wikipedia.org/wiki/Main_Page");
pdf.SaveAs("fitToPage.pdf");