Chapter 12. Drawing to Java Graphics2D

This chapter covers

  • iText and Java’s Graphics2D

  • java.awt.font vs. com.lowagie.text.Font

  • Swing components and PDF

  • PDF and Optional Content

In the two previous chapters, we’ve been discussing methods to draw graphics and text using iText’s direct content object PdfContentByte. You may have recognized some of the examples from other books on SVG, PostScript, or Java graphics. For instance, all the graphical shapes you drew in chapter 10 also exist in the standard Java Developer Kit (JDK): The package java.awt.geom has objects such as Rectangle2D, Ellipse2D, CubicCurve2D, and so on.

Maybe you’re already familiar with these objects. If that is the case, you can use iText as a PDF engine for all your Graphics2D requirements. ...

Get iText in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.