Some test text!

menu
search
Web/HTML to PDFkeyboard_arrow_down

Web/HTML to PDF

PDFTron SDK allows you to convert html pages to PDF documents.

Convert HTML to PDF

This tutorial only applies to Xamarin.Android. See Xamarin.iOS equivalent here.
HTML to PDF conversion is available for Android API 19 and above.

The HTML to PDF conversion API accepts different sources, such as HTTP/HTTPS URLs, HTML strings, and everything that can be loaded in a WebView.

linkFrom link

To convert a link URL to PDF, simply:

HTML2PDF hTML2PDF = new HTML2PDF(this);
hTML2PDF.FromUrl("http://developer.android.com/about/index.html");
hTML2PDF.ConversionFinished += (sender, e) =>
{
    // do something with e.PdfOutput
};
hTML2PDF.ConversionFailed += (sender, e) =>
{
    // error handling
};

linkFrom HTML string

To convert an HTML string to PDF, simply:

HTML2PDF hTML2PDF = new HTML2PDF(this);
hTML2PDF.FromHTMLDocument(myBaseUrl, myHtmlData);
hTML2PDF.ConversionFinished += (sender, e) =>
{
    // do something with e.PdfOutput
};
hTML2PDF.ConversionFailed += (sender, e) =>
{
    // error handling
};

where myBaseUrl is the URL to use as the page's base URL. If null defaults to about:blank and myHtmlData is a String of data in the UTF-8 encoding. Click here for more info.

linkFrom other sources

If none of the above fit your needs, you can also pass in a WebView directly for conversion:

HTML2PDF hTML2PDF = new HTML2PDF(myWebview);
hTML2PDF.DoHtml2Pdf();
hTML2PDF.ConversionFinished += (sender, e) =>
{
    // do something with e.PdfOutput
};
hTML2PDF.ConversionFailed += (sender, e) =>
{
    // error handling
};

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

PDFTron Receives USD$71 Million Growth Investment Led By Silversmith Capital Partners

Learn More
close