Chapter 14. The imaging model

 

This chapter covers

  • The PDF imaging model
  • All methods in PdfContentByte
  • Using Graphics2D to create PDF content

We studied the Carousel Object System in the previous chapter. We used iText to find, remove, change, and replace objects in a PDF file. In this chapter, we’ll look at one specific type of object: the stream containing the syntax that makes up a page.

First we’ll look at the PDF imaging model and learn how to draw graphics and text using PDF syntax. Then we’ll look at the Java class java.awt.Graphics2D as an alternative solution for achieving the same results. In both cases, we’ll add content at absolute positions as we did in chapter 3. Chapter 3 explained the mechanisms available in iText, but this chapter dives straight into the PDF syntax.

This chapter includes different tables listing all the possible graphics and text operators and operands. This chapter will serve as a reference that can be used to look up the meaning of the syntax in a PDF file, and to find the iText methods that correspond with this syntax.

14.1. Examining the content stream

Let’s start by looking at the content streams of some PDF samples you’ve created in previous parts of the book. A first step is to get the content of a page.

14.2. Path construction and painting operators

14.3. Overview of the graphics state methods

14.4. Overview of the text and text state methods

14.5. Using java.awt.Graphics2D

14.6. Summary

sitemap