HTML to PDF Conversion using Java

Hi

Is there Api in Java for converting html to pdf. If yes, please send me a sample.

Thank you.
Customer
---------------------------------------------

image
Thanks for your message, you can call VeryPDF HTML Tools Command Line from Java code to convert from HTML files to PDF files, you may download VeryPDF HTML Tools Command Line from following web page to try,

https://www.verypdf.com/app/html-converter/try-and-buy.html#cmd
https://www.verypdf.com/htmltools/htmltools.zip

after you download and unzip it to a folder, you can call htmltools.exe from your Java code to convert from HTML files to PDF files easily,

public static void main(String[] args) {
        try {
            Runtime runTime = Runtime.getRuntime();
           
            String executablePath = "C:\\VeryPDF\\htmltools.exe -webkit https://www.verypdf.com D:\\verypdf.pdf";
           
            Process process = runTime.exec(executablePath);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

With htmltools.exe application, you can run following command lines to convert your HTML file or a URL to PDF file easily,

htmltools.exe -$ XXXXXXXXXXXXXXXXXX test.htm _test1.pdf
htmltools.exe -$ XXXXXXXXXXXXXXXXXX https://www.verypdf.com _web1.pdf

htmltools.exe -$ XXXXXXXXXXXXXXXXXX -html2pdf2 test.htm _test_html2pdf2.pdf

htmltools.exe -$ XXXXXXXXXXXXXXXXXX -webkit test.htm _test_webkit.pdf
htmltools.exe -$ XXXXXXXXXXXXXXXXXX -webkit https://www.verypdf.com _web_webkit.pdf
htmltools.exe -$ XXXXXXXXXXXXXXXXXX -webkit https://www.verypdf.com/artprint/docprintsdk.htm _verypdf_webkit.pdf

htmltools.exe -$ XXXXXXXXXXXXXXXXXX -webkit2 test.htm _test_webkit2.pdf
htmltools.exe -$ XXXXXXXXXXXXXXXXXX -webkit2 -width 1080 -height 1080 https://www.verypdf.com _web_webkit2.pdf
htmltools.exe -$ XXXXXXXXXXXXXXXXXX -webkit2 -width 1080 -height 1080 https://www.verypdf.com/artprint/docprintsdk.htm _verypdf_webkit2.pdf

In generate, -webkit and -webkit2 options will work better for you, if you encounter any problem with htmltools.exe application, please feel free to let us know, we will assist you asap.

VeryPDF

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!