How to convert an HTML page into a PDF document online?

Source: Internet
Author: User

In our work or study, we often want to use a function that we want to convert an HTML page into a PDF document. It's a common practice to copy this HTML page into a Word document in office, and then convert Word into a PDF document using the tool that comes with Word. We need to convert an HTML page or a piece of code that can render a process HTML page into a PDF page in our program, so what should we do? Here you can recommend an online website, https://pdfcrowd.com/html-to-pdf-api/, on this site, you can register a free account, this trial account can generate 100 PDF documents. The way API calls are very simple,

Step1. Register a user account with your own email address (e.g., Henryzhu), the registered mailbox will receive a value that uniquely identifies the user (for example, 096c8a2953b993db5b02341274393623).

Step2. Go to Https://pdfcrowd.com/static/clients/java/pdfcrowd-2.6-java.zip to download a jar package

Step3. Create an Eclipse project, add the downloaded package from the STEP2 to the build path, and then run the following instance code.

Import Com.pdfcrowd.*;import java.io.*;p ublic class Pdfcrowdtest {public static void main (string[] args) {try                  {FileOutputStream fileStream;            Create an API client instance client client = new Client ("Henryzhu", "096c8a2953b993db5b02341274393623");             Convert a Web page and save the PDF to a file FileStream = new FileOutputStream ("Google_com.pdf");            Client.converturi ("http://www.google.com/", FileStream);            Filestream.close (); Convert an HTML string and store the PDF into a byte array bytearrayoutputstream memstream = new Bytearrayo            Utputstream ();            String HTML = "

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.