HiQPdf Documentation

Get Started with HTML to PDF Converter

Quickly Create High Quality PDFs

Using HiQPdf Library, with just a few lines of code, you can convert an URL or a HTML code to a PDF buffer in memory or to a PDF file on disk:

Convert URL to a PDF Buffer Example

C#
// create the HTML to PDF converter
HtmlToPdf htmlToPdfConverter = new HtmlToPdf();

// convert URL to a PDF buffer in memory
// the buffer can be saved to a file, a stream or a HTTP response
byte[] pdfBuffer = htmlToPdfConverter.ConvertUrlToMemory("http://www.google.com");

Convert URL to a PDF File Example

C#
// create the HTML to PDF converter
HtmlToPdf htmlToPdfConverter = new HtmlToPdf();

// convert URL to a PDF file
htmlToPdfConverter.ConvertUrlToFile("http://www.google.com", "result.pdf");

Convert HTML Code to a PDF Buffer Example

C#
// create the HTML to PDF converter
HtmlToPdf htmlToPdfConverter = new HtmlToPdf();

// convert a HTML code to a PDF buffer in memory
// the buffer can be saved to a file, a stream or a HTTP response
byte[] pdfBuffer = htmlToPdfConverter.ConvertHtmlToMemory("<b>Hello World</b>", null);

Convert HTML Code to a PDF File Example

C#
// create the HTML to PDF converter
HtmlToPdf htmlToPdfConverter = new HtmlToPdf();

// convert HTML Code to a PDF file
htmlToPdfConverter.ConvertHtmlToFile("<b>Hello World</b>", null, "result.pdf");

When you convert a HTML code to PDF you can give a base URL which can be used by converter to resolve the relative URLs found in the HTML code to fully qualified URLs. In the simple examples above, this parameter is null because there are no resources referenced in the HTML code.

See Also

Other Resources