Web/HTML to PDF
Apryse SDK allows you to convert html pages to PDF documents.
Convert HTML to PDF in Xamarin.Android
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.
From 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
};From HTML string
To convert an HTML string to PDF, simply:
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](https://developer.android.com/reference/android/webkit/WebView.html#loadDataWithBaseURL(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)).
From other sources
If none of the above fit your needs, you can also pass in a WebView directly for conversion:
Convert HTML to PDF in Xamarin.iOS
The platform-specific conversion API also supports HTML to PDF conversion, either with the +convertOfficeToPDF:paperSize:completion: method for .html files or the +convertHTMLStringToPDF:baseURL:paperSize:completion: for raw HTML text.
The following code shows how to convert an HTML string to PDF:
where baseURL is the URL to use as the page's base URL for resolving relative links in the document.
Last updated
Was this helpful?