Chapter 10. Brightening your document with color and images

 

This chapter covers

  • Using color in PDF documents
  • Introducing transparency
  • Using images in PDF documents

You’ve already used color and images in previous chapters. You set the background and changed the font color of a Chunk using the BaseColor class in chapter 2. You used setColorFill() and setColorStroke() methods when you painted movie blocks on a calendar sheet in chapter 3. But that doesn’t mean we’ve talked about everything. One could write an entire book about color.

The same goes for images. We looked at the Image class in chapter 2, but there are many other classes involved when creating an Image object: Jpeg, GifImage, TiffImage, and so on. It would lead us too far astray to go into too much detail about color and images, but this chapter will help you if you need more color or image functionality than we covered in part 1.

10.1. Working with the iText color classes

Colors are defined using values, and these values are interpreted according to a color space. Color spaces are expressed as PDF dictionaries, and there are eleven different color spaces available in PDF. You can find a reference to these dictionaries in the resources entry of a PDF stream. This is explained in great detail in the PDF reference; but don’t worry, iText provides color classes that hide the complex theory.

The most common group of color spaces is the device color space family.

10.1.1. Device colors

10.2. Overview of supported image types

 
 

10.3. Making images transparent

 

10.4. Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest