contents


preface xix
acknowledgments xxi
about this book xxiii Part 1 Introduction   1
1 iText: when and why   3
1.1 The history of iText 5
1.2 iText: first contact 10
1.3 An almost-true story 14
1.4 Summary 29
2 PDF engine jump-start   30
2.1 Generating a PDF document in five steps 31
2.2 Manipulating existing PDF files 48
2.3 Creating PDF in multiple passes 68
2.4 Summary 72
3 PDF: why and when   73
3.1 A document history 74
3.2 Types of PDF 79
3.3 PDF version history 85
3.4 Summary 95
Part 2 Basic building blocks   97
4 Composing text elements   99
4.1 Wrapping Strings in text elements 100
4.2 Adding extra functionality to text elements 105
4.3 Chunk characteristics 111
4.4 Chunks and space distribution 118
4.5 Anchors revisited 122
4.6 Generic Chunk functionality 125
4.7 Making a flyer (part 1) 129
4.8 Summary 134
5 Inserting images   135
5.1 Standard image types 136
5.2 Working with java.awt.Image 140
5.3 Byte arrays with image data 143
5.4 Setting image properties 147
5.5 Making a flyer (part 2) 158
5.6 Summary 161
6 Constructing tables   162
6.1 Tables in PDF: PdfPTable 163
6.2 Alternatives to PdfPTable 186
6.3 Composing a study guide (part 1) 189
6.4 Summary 192
7 Constructing columns   193
7.1 Retrieving the current vertical position 194
7.2 Adding text to ColumnText 197
7.3 Composing ColumnText with other building blocks 206
7.4 Automatic columns with MultiColumnText 211
7.5 Composing a study guide (part 2) 216
7.6 Summary 219
Part 3 PDF text and graphics   221
8 Choosing the right font   223
8.1 Defining a font 224
8.2 Introducing base fonts 231
8.3 Composite fonts 248
8.4 Summary 255
9 Using fonts   257
9.1 Other writing directions 258
9.2 Sending a message of peace (part 1) 262
9.3 Advanced typography 264
9.4 Automating font creation and selection 271
9.5 Sending a message of peace (part 2) 279
9.6 Summary 282
10 Constructing and painting paths   283
10.1 Path construction and painting operators 284
10.2 Working with iTextÒs direct content 294
10.3 Graphics state operators 303
10.4 Changing the coordinate system 313
10.5 Drawing a map of a city (part 1) 321
10.6 Summary 324
11 Adding color and text   325
11.1 Adding color to PDF files 326
11.2 The transparent imaging model 335
11.3 Clipping content 341
11.4 PDFÒs text state 344
11.5 The map of Foobar (part 2) 353
11.6 Summary 355
12 Drawing to Java Graphics2D   356
12.1 Obtaining a Java.awt.Graphics2D instance 357
12.2 Two-dimensional graphics in the real world 368
12.3 PDFÒs optional content 374
12.4 Enhancing the map of Foobar 385
12.5 Summary 392
Part 4 Interactive PDF   393
13 Browsing a PDF document   395
13.1 Changing viewer preferences 396
13.2 Visualizing thumbnails 401
13.3 Adding page transitions 405
13.4 Adding bookmarks 407
13.5 Introducing actions 415
13.6 Enhancing the course catalog 421
13.7 Summary 424
14 Automating PDF creation   425
14.1 Creating a page 426
14.2 Common page event functionality 432
14.3 Alternative XML solutions 445
14.4 Enhancing the course catalog (part 2) 461
14.5 Summary 463
15 Creating annotations and fields   464
15.1 Introducing annotations 465
15.2 Creating an AcroForm 475
15.3 Submitting a form 488
15.4 Comparing HTML and PDF forms 498
15.5 Summary 500
16 Filling and signing AcroForms   501
16.1 Filling in the fields of an AcroForm 502
16.2 Working with FDF and XFDF files 514
16.3 Signing a PDF file 518
16.4 Verifying a PDF file 529
16.5 Summary 532
17 iText in web applications   533
17.1 Writing PDF to the ServletOutputStream: pitfalls 534
17.2 Putting the theory into practice 550
17.3 Summary 561
18 Under the hood   562
18.1 Inside iText and PDF 563
18.2 Extracting and editing text 574
18.3 Rendering PDF 581
18.4 Manipulating PDF files 584
18.5 Summary 590

 
appendix A: Class diagrams   591
appendix B: Creating barcodes   602
appendix C: Open parameters   618
appendix D: Signing a PDF with a smart card   621
appendix E: Dealing with exceptions   624
appendix F: Pdf/X, Pdf/A, and tagged PDF   630
appendix G: Resources   638
                     index   642