iText 5

Let’s start with six quick facts about PDF: ■ PDF is the Portable Document Format. ■ It’s an open file format (ISO-32000-1), originally created by Adobe. ■ It’s used for documents that are independent of system software and hardware. ■ PDF documents are an essential part of the web. ■ Adobe Reader is the most […]

Working with the examples in this topic (iText 5)

All the source files, as well as the resources and extra libraries necessary to run the book’s examples, were uploaded to a Subversion (SVN) repository on SourceForge. If you have an SVN client, you can check out of the complete working environment at once. This way, you’ll be able to get the latest updates and […]

Creating a PDF document in five steps with iText

Let’s copy the content of the main method of figure 1.5, and remove the comments. The numbers to the side in this listing indicate the different steps in the PDF-creation process. Listing 1.1 In each of the following subsections, we’ll focus on one specific step. You’ll apply small changes to step O in the […]

Illustrating the examples with a real-world database (iText 5)

The main theme of the examples in this topic is movies. I’ve made a selection of 120 movies, 80 directors, and 32 countries, and I’ve put all this information in a database. The entity relationship diagram (ERD) in figure 2.2 shows how the data is organized. There are three main tables, consisting of movies, directors, […]

Adding Chunk, Phrase, Paragraph, and List objects Part 1 (iText 5)

The general idea of step Q in listing 1.1 in the PDF-creation process using docu-ment.add() is that you add objects implementing the Element interface to a Document object. Behind the scenes, a PdfWriter and a PdfDocument object analyze these objects and translate them into the appropriate PDF syntax, positioning the content on one or more […]

Adding Chunk, Phrase, Paragraph, and List objects Part 2 (iText 5)

Distributing text over different lines In the movie_paragraphs_1.pdf document (listing 2.8), all the information about a movie is in one Paragraph. For most of the movies, the content of this Paragraph doesn’t fit on one line, and iText splits the string, distributing the content over different lines. The default behavior of iText is to put […]

Adding Chunk, Phrase, Paragraph, and List objects Part 3 (iText 5)

The Drawinterface: vertical position marks, separators, and tabs In section 1.3.4, you learned that there are different ways to add content to a page using iText. In this topic, you’ve been using document.add(), trusting iText to put the content at the correct position in a page. But in some cases, you might want to add […]

Adding Anchor, Image, topic, and Section objects (iText 5)

In the previous examples, you’ve used every field shown in the ERD in figure 2.2, except for one: the field named imdb. This field contains the ID for the movie on, which is the Internet Movie Database (IMDB). Wouldn’t it be nice to link to this external site from your documents? And what kind […]

Introducing the concept of direct content (iText 5)

As a first example, you’ll use high-level objects to create a postcard inviting people to the movie that will open the Foobar Film Festival; then you’ll add extra content at absolute positions in the document using low-level methods. The page to the left in figure 3.1 is created by adding a Paragraph with the text […]

Adding text at absolute positions (iText 5)

In listing 3.1, you wrote "SOLD OUT" on top of a poster of the movie that is opening the film festival. You used methods such as setTextRenderingMode(), setTextMa-trix(), and so on, but it’s not easy to create a complete document using these low-level methods. It’s easier to use convenience methods that do part of the […]