HTML to PDF Converter for Xamarin

xamarin_logoEVO HTML to Converter for Xamarin allows you develop applications for iOS, Mac OS, Android and Windows using C# as development language. A large part of the code you write for Xamarin platform can be reused to produce native application for multiple platforms. The HTML to PDF Converter for Xamarin package you can download contains demo applications for iOS, Android and Mac OS.

EVO HTML to PDF Converter Library for Xamarin can be easily integrated in iOS, Android and Mac OS X applications to convert HTML documents to PDF, raster images or SVG vector images. The library is a powerful tool helping you to instantly create nicely formatted and easily maintainable PDF reports directly from existing HTML reports.

The converter offers full support for HTML5, CSS3, JavaScript, SVG, web fonts, page breaks control with CSS and from API, automatically repeated HTML table header and footer, live URLs and internal links, automatically generated hierarchical bookmarks and table of contents, automatically generated fillable PDF forms and allows you to digitally sign and password protect the generated PDF documents.

In order to use the EVO HTML to PDF Converter for Xamarin you first have to install the EVO HTML to PDF Server. The server was built on .NET library to extend its capabilities to other platforms and languages. The client library that you link in your Xamarin applications will connect to the server to convert HTML to PDF, to Image or to SVG.
EVO HTML to PDF Converter Server can run either in a Windows Service on a Windows machine or in an Azure Cloud Service deployed in Microsoft Azure cloud. You can find detailed installation and uninstallation instructions in the Readme.txt file from the root of the downloaded package.

The EVO HTML to PDF Converter for Xamarin API allows you to convert a HTML document to PDF in just a few lines a code. The programming interface is also very rich and allows you customize the generated PDF document in various ways. The code below is copied from the demo for HTML to PDF Converter that you can find the in the Demo folder of the software Zip package.

C# Code to Convert HTML to PDF in Xamarin for iOS Applications

private void ConvertUrlToPdf()
{
    try {
	    String serverIPAddress = serverIP.Text;
	    uint serverPortNumber = uint.Parse (serverPort.Text);

	    // create the HTML to PDF converter object
	    HtmlToPdfConverter htmlToPdfConverter = new HtmlToPdfConverter (serverIPAddress, serverPortNumber);

	    // set license key
	    htmlToPdfConverter.LicenseKey = "4W9+bn19bn5ue2B+bn1/YH98YHd3d3c=";

	    // set service password if necessary
	    if (serverPassword.Text.Length > 0)
		    htmlToPdfConverter.ServicePassword = serverPassword.Text;

	    // set PDF page size
	    htmlToPdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;

	    // set PDF page orientation
	    htmlToPdfConverter.PdfDocumentOptions.PdfPageOrientation = PdfPageOrientation.Portrait;

	    // convert the HTML page from given URL to PDF in a buffer
	    byte[] pdfBytes = htmlToPdfConverter.ConvertUrl (urlToConvert.Text);

	    string documentsFolder = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments); 
	    string outPdfFile = System.IO.Path.Combine (documentsFolder, "EvoHtmlToPdf.pdf");

	    // write the PDF buffer in output file
	    System.IO.File.WriteAllBytes (outPdfFile, pdfBytes);

	    // open the PDF document in the default PDF viewer
	    UIDocumentInteractionController pdfViewer = UIDocumentInteractionController.FromUrl (Foundation.NSUrl.FromFilename (outPdfFile));
	    pdfViewer.PresentOpenInMenu (this.View.Frame, this.View, true);

    } catch (Exception ex) {
	    UIAlertView alert = new UIAlertView ();
	    alert.Title = "Error";
	    alert.AddButton ("OK");
	    alert.Message = ex.Message;
	    alert.Show ();
    }
}

You can find more details about the EVO HTML to PDF Converter for Xamarin on product webpage.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s