Home Contact
Skip Navigation Links

Convert HTML to PDF in your Java Applications

EVO HTML to PDF Converter for Java offers full support for HTML tags, CSS styles, SVG vector graphics, Canvas, Web Fonts, JavaScript, page breaks control with CSS styles, repeating HTML table header and footer in PDF pages, live URLs and internal links in PDF, automatically generated hierarchical bookmarks and table of contents, HTML in the headers and footers. The library is much more than a HTML to PDF converter. You can also use it to easily merge, edit and fill existing PDF documents.

Java Logo
EVO HTML to PDF Converter
for Java

EVO HTML to PDF Converter library for Java can be easily integrated in Java server and desktop 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.

The library was designed and tested to work reliably in multithreaded environments which makes it ideal for usage in high traffic websites and services.

Download Download
API Reference API Reference
Support Support
Buy Now Buy Now
Download Icon Software Download

EVO HTML to PDF Converter for Java is distributed in a Zip archive. You can follow the link below to download the software. The Zip archive contains the client library for Java as a JAR file for JRE 1.6 or newer, the API documentation in HTML format, the HTML to PDF Server and the demo applications for Java.

Download HTML to PDF Converter v6.16 for Java
Install Icon Software Installation

In order to use the EVO HTML to PDF Converter for Java 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 JAR library that you link in your Java application 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.

Code Sample Icon Java Code Sample

The EVO HTML to PDF Converter for Java 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 Getting Started demo for HTML to PDF Converter that you can find the in the samples folder of the software Zip package.

private byte[] convertHtmlToPdf(boolean convertURL) throws Exception 
{
    String serverIP = textServerIP.getText();
    int port = Integer.parseInt(textServerPort.getText());

    // create the HTML to PDF converter
    HtmlToPdfConverter htmlToPdfConverter = new HtmlToPdfConverter(serverIP, port);

    // set license key
    htmlToPdfConverter.setLicenseKey("B4mYiJubiJiInoaYiJuZhpmahpGRkZGImg==");

    // set service password if necessary
    if (textServicePassword.getText().length() > 0)
	    htmlToPdfConverter.setServicePassword(textServicePassword.getText());

    // set HTML viewer width
    int viewerWidth = Integer.parseInt(textHtmlViewerWidth.getText());
    htmlToPdfConverter.setHtmlViewerWidth(viewerWidth);

    // set HTML viewer height if necessary
    if (textHtmlViewerHeight.getText().length() > 0) {
	    int viewerHeight = Integer.parseInt(textHtmlViewerHeight.getText());
	    htmlToPdfConverter.setHtmlViewerHeight(viewerHeight);
    }

    // set navigation timeout
    int navigationTimeout = Integer.parseInt(textHtmlViewerWidth.getText());
    htmlToPdfConverter.setNavigationTimeout(navigationTimeout);

    // set conversion delay if necessary
    if (textConversionDelay.getText().length() > 0) {
	    int conversionDelay = Integer.parseInt(textConversionDelay.getText());
	    htmlToPdfConverter.setConversionDelay(conversionDelay);
    }

    // set PDF page size
    htmlToPdfConverter.pdfDocumentOptions().setPdfPageSize(selectedPdfPageSize());

    // set PDF page orientation
    htmlToPdfConverter.pdfDocumentOptions().setPdfPageOrientation(selectedPdfPageOrientation());

    // set margins
    int leftMargin = Integer.parseInt(textLeftMargin.getText());
    htmlToPdfConverter.pdfDocumentOptions().setLeftMargin(leftMargin);

    int rightMargin = Integer.parseInt(textRightMargin.getText());
    htmlToPdfConverter.pdfDocumentOptions().setRightMargin(rightMargin);

    int topMargin = Integer.parseInt(textTopMargin.getText());
    htmlToPdfConverter.pdfDocumentOptions().setTopMargin(topMargin);

    int bottomMargin = Integer.parseInt(textBottomMargin.getText());
    htmlToPdfConverter.pdfDocumentOptions().setBottomMargin(bottomMargin);

    // add header
    if (chckbxAddHeader.isSelected()) {
	    htmlToPdfConverter.pdfDocumentOptions().setShowHeader(true);
	    drawHeader(htmlToPdfConverter, true);
    }

    // add footer
    if (chckbxAddFooter.isSelected()) {
	    htmlToPdfConverter.pdfDocumentOptions().setShowFooter(true);
	    drawFooter(htmlToPdfConverter, true, true);
    }

    byte[] outPdfBuffer = null;

    if (convertURL) {
	    // convert URL to PDF

	    String urlToConvert = textUrl.getText();

	    outPdfBuffer = htmlToPdfConverter.convertUrl(urlToConvert);
    } else {
	    // convert HTML to PDF

	    String html = textHtml.getText();
	    String baseUrl = textBaseUrl.getText();

	    outPdfBuffer = htmlToPdfConverter.convertHtml(html, baseUrl);
    }

    return outPdfBuffer;
}