Skip to Content
Developing with PDF
book

Developing with PDF

by Leonard Rosenthol
October 2013
Intermediate to advanced content levelIntermediate to advanced
215 pages
4h 29m
English
O'Reilly Media, Inc.
Content preview from Developing with PDF

Chapter 2. PDF Imaging Model

In this chapter you’ll begin your exploration into the PDF imaging model—that is, the various types of graphic operations that can be carried out on the pages of a document. You’ll learn not only the language used to describe those operations, but also about various graphic and imaging concepts that accompany it.

Content Streams

As described in the previous chapter, a PDF file is composed of one or more pages (of a fixed size), and the visible elements on each page come from either the page content or a series of annotations that sit on top (visibly) of the content. This chapter discusses the page content.

Page content is described using a special text-based syntax (related to, but different from the PDF file syntax that you learned about in Chapter 1) that is stored in the PDF inside of a special type of stream object called a content stream. The content syntax is derived from Adobe’s Postscript language and is comprised of a series of operators and their operands, where each operand can be expressed as a standard PDF object (see PDF Objects). A simple example, for drawing a rectangle filled with the color blue, is given in Example 2-1.

Example 2-1. Drawing a simple rectangle
Simple Blue Rectangle
0 0 1 rg               % set the color to blue in RGB
0 0 100 100 re         % draw a rectangle 100x100 with the bottom left at 0,0
F                      % fill it

We’ll look at the various operators themselves shortly, but for ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PDF Hacks

PDF Hacks

Sid Steward
Fonts & Encodings

Fonts & Encodings

Yannis Haralambous
iText in Action

iText in Action

Bruno Lowagie

Publisher Resources

ISBN: 9781449327903Errata Page