Itext official tutorial

Source: Internet
Author: User

If you want to export a PDF file, the first choice is itext. You have also found some information from the Internet, and there are a lot of things.

I made an example by myself, and it seems that it is still very simple, and the in-depth content is still hard to be studied. Download the official jar package. I wanted to see it.

In the demo, only the API documentation is returned. The information is really hard to find.

Today, we found that there are still many examples of code on the official website.

: Http://itextpdf.com/examples/

Itext Official Website: http://itextpdf.com/

There is an online resources under the Home Page

Below is a link to example code. After clicking it, we found that it was a very gorgeous tutorial with instance code!

Http://itextpdf.com/book/examples.php

This is more authoritative than the blogs written by others on the Internet. I 'd like to share this with you.

There are 16 chapters in it, the content is quite complete, and there are Demo videos.

 

 

 

This is an example of helloword. Let's study it by yourself:

/* * This class is part of the book "iText in Action - 2nd Edition" * written by Bruno Lowagie (ISBN: 9781935182610) * For more info, go to: http://itextpdf.com/examples/ * This example only works with the AGPL version of iText. */ package part1.chapter01; import java.io.FileOutputStream;import java.io.IOException; import com.itextpdf.text.Document;import com.itextpdf.text.DocumentException;import com.itextpdf.text.Paragraph;import com.itextpdf.text.pdf.PdfWriter; /** * First iText example: Hello World. */public class HelloWorld {     /** Path to the resulting PDF file. */    public static final String RESULT        = "results/part1/chapter01/hello.pdf";     /**     * Creates a PDF file: hello.pdf     * @param    args    no arguments needed     */    public static void main(String[] args)    throws DocumentException, IOException {    new HelloWorld().createPdf(RESULT);    }     /**     * Creates a PDF document.     * @param filename the path to the new PDF document     * @throws    DocumentException      * @throws    IOException      */    public void createPdf(String filename)throws DocumentException, IOException {        // step 1        Document document = new Document();        // step 2        PdfWriter.getInstance(document, new FileOutputStream(filename));        // step 3        document.open();        // step 4        document.add(new Paragraph("Hello World!"));        // step 5        document.close();    }}

 

 

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.