9781932394795

IText in Action : Creating and Manipulating PDF

by
  • ISBN13:

    9781932394795

  • ISBN10:

    1932394796

  • Format: Paperback
  • Copyright: 2006-12-01
  • Publisher: Oreilly & Associates Inc
  • Purchase Benefits
  • Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $49.99 Save up to $10.00
  • Buy New
    $39.99
    Add to Cart Free Shipping

    IN STOCK USUALLY SHIPS IN 24-48 HOURS

Supplemental Materials

What is included with this book?

  • The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

Summary

Imagine a publisher who wants to "stamp" his ebooks on the fly with the name of the buyer (no discourage sharing). Such a publisher would (and we know one who does) use iText for the task. Developers looking to enhance web- and other applications with dynamic PDF document generation and/or manipulation will find this book unique in content and readability. Based on ongoing examples that encourage learning "in action," they will finally understand PDF and learn how to build applications that produce professional, high-quality PDF documents. While the basic functionality of iText is easy to acquire, this book lowers the learning curve for more advanced functionality. All the examples are written in Java, but they can be easily adapted to .NET by developers using one of the .NET ports: iTextSharp (C#) or iText.NET (#J). While iText is a free Java library and the examples are written from the point of view of the Java developer, nine out of ten examples can be run by .NET developers without any changes.

Author Biography

Bruno Lowagie has been programming since he was twelve years old. He has a degree in civil architectural engineering and is the initial developer and one of the current maintainers of iText. He works at Ghent University, Belgium.

Table of Contents

Prefacep. xix
Acknowledgmentsp. xxi
About this bookp. xxiii
Introductionp. 1
iText: when and whyp. 3
The history of iTextp. 5
How iText was bornp. 5
iText todayp. 7
Beyond Javap. 9
iText: first contactp. 10
Running the examples in the bookp. 11
Experimenting with the iText toolboxp. 12
An almost-true storyp. 14
Some Foobar fictionp. 15
A document daydreamp. 16
Welcoming the studentp. 18
Producing and processing interactive documentsp. 23
Making the dream come truep. 28
Summaryp. 29
PDF engine jump-startp. 30
Generating a PDF document in five stepsp. 31
Creating a new document objectp. 32
Getting a DocWriter instancep. 35
Opening the documentp. 37
Adding contentp. 42
Closing the documentp. 46
Manipulating existing PDF filesp. 48
Reading an existing PDF filep. 49
Using PdfStamper to change document propertiesp. 54
Using PdfStamper to add contentp. 55
Introducing imported pagesp. 60
Using imported pages with PdfWriterp. 61
Manipulating existing PDF files with PdfCopyp. 64
Concatenating forms with PdfCopyFieldsp. 66
Summary of the manipulation classesp. 67
Creating PDF in multiple passesp. 68
Stamp first, then copyp. 69
Copy first, then stampp. 70
Stamp, copy, stampp. 71
Summaryp. 72
PDF: why and whenp. 73
A document historyp. 74
Adobe and documentsp. 75
The Acrobat familyp. 77
The intellectual property of the PDF specificationp. 78
Types of PDFp. 79
Traditional PDFp. 80
Tagged PDFp. 80
Linearized PDFp. 81
PDFs preserving native editing capabilitiesp. 81
PDF types that became an ISO standardp. 81
PDF forms, FDF, and XFDFp. 83
XFA and XDPp. 84
Rules of thumbp. 84
PDF version historyp. 85
Changing the user unitp. 86
PDF content and compressionp. 88
Encryptionp. 90
Summaryp. 95
Basic Building Blocksp. 97
Composing text elementsp. 99
Wrapping Strings in text elementsp. 100
The atomic building block: com.lowagie.text.Chunkp. 101
An Array List of Chunks: com.lowagie.text.Phrasep. 103
A sequence of Phrases: com.lowagie.text.Paragraphp. 104
Adding extra functionality to text elementsp. 105
External and internal links: com.lowagie.text.Anchorp. 106
Lists and ListItems: com.lowagie.text.List/ListItemp. 107
Automatic bookmarking: com.lowagie.text. Chapter/Sectionp. 109
Chunk characteristicsp. 111
Measuring and scalingp. 111
Lines: underlining and striking through textp. 112
TextRise: sub- and superscriptp. 115
Simulating italic fonts: skewing textp. 116
Changing font and background colorsp. 117
Simulating bold fonts: stroking vs. fillingp. 117
Chunks and space distributionp. 118
The split characterp. 119
Hyphenationp. 120
Changing the Char Space ratiop. 121
Anchors revisitedp. 122
Remote Gotop. 123
Local Gotop. 124
Generic Chunk functionalityp. 125
Drawing custom backgrounds and linesp. 125
Implementing custom functionalityp. 126
Building an indexp. 127
Making a flyer (part 1)p. 129
Summaryp. 134
Inserting imagesp. 135
Standard image typesp. 136
BMP, EPS, GIF, JPEG, PNG, TIFF, and WMFp. 137
TIFF with multiple pagesp. 139
Animated GIFsp. 139
Working with java.awt.Imagep. 140
Byte arrays with image datap. 143
Raw image datap. 144
CCITT compressed imagesp. 145
Creating barcodesp. 146
Working with com.lowagie.text.pdf.PdfTemplatep. 147
Setting image propertiesp. 147
Adding images to the documentp. 147
Translating, scaling, and rotating imagesp. 151
Image masksp. 156
Making a flyer (part 2)p. 158
Getting the Image instancep. 158
Setting the border, the alignment, and the dimensionsp. 159
The resulting PDFp. 160
Summaryp. 161
Constructing tablesp. 162
Tables in PDF: PdfPTablep. 163
Your first PdfPTablep. 163
Changing the width and alignment of a PdfPTablep. 164
Adding PdfPCells to a PdfPTablep. 167
Special PdfPCell constructorsp. 176
Working with large tablesp. 178
Adding a PdfPTable at an absolute positionp. 182
Alternatives to PdfPTablep. 186
Composing a study guide (part 1)p. 189
The data sourcep. 189
Generating the PDFp. 190
Summaryp. 192
Constructing columnsp. 193
Retrieving the current vertical positionp. 194
Adding text to ColumnTextp. 197
Different ways to add text to a columnp. 197
Keeping paragraphs togetherp. 199
Adding more than one column to a pagep. 201
Composing ColumnText with other building blocksp. 206
Combining text mode with images and tablesp. 207
ColumnText in composite modep. 209
Automatic columns with MultiColumnTextp. 211
Regular columns with MultiColumnTextp. 211
Irregular columns with MultiColumnTextp. 213
Composing a study guide (part 2)p. 216
Summaryp. 219
PDF Text and Graphicsp. 221
Choosing the right fontp. 223
Defining a fontp. 224
Using the right terminologyp. 225
Standard Type 1 fontsp. 226
Introducing base fontsp. 231
Working with an encodingp. 232
Class BaseFont and Type 1 fontsp. 233
Embedding Type 3 fontsp. 238
Working with TrueType fontsp. 239
Working with OpenType fontsp. 243
Composite fontsp. 248
What is Unicode?p. 248
Introducing Chinese, Japanese, Korean (CJK) fontsp. 251
Embedding CIDFontsp. 252
Using TrueType collectionsp. 254
Summaryp. 255
Using fontsp. 257
Other writing directionsp. 258
Vertical writingp. 258
Writing from right to leftp. 260
Sending a message of peace (part 1)p. 262
Advanced typographyp. 264
Handling diacriticsp. 265
Dealing with ligaturesp. 268
Automating font creation and selectionp. 271
Getting a Font object from the FontFactoryp. 271
Automatic font selectionp. 276
Sending a message of peace (part 2)p. 279
Summaryp. 282
Constructing and painting pathsp. 283
Path construction and painting operatorsp. 284
Seven path construction operatorsp. 284
Path-painting operatorsp. 286
Working with iText's direct contentp. 294
Direct content layersp. 295
PdfPTable and PdfPCell eventsp. 296
Graphics state operatorsp. 303
The graphics state stackp. 303
Changing the characteristics of a linep. 305
Changing the coordinate systemp. 313
The CTMp. 313
Positioning external objectsp. 316
Drawing a map of a city (part 1)p. 321
The XML/SVG source filep. 321
Parsing the SVG filep. 323
Summaryp. 324
Adding color and textp. 325
Adding color to PDF filesp. 326
Device colorspacesp. 326
Separation colorspacesp. 328
Painting patternsp. 329
Using color with basic building blocksp. 334
The transparent imaging modelp. 335
Transparency groupsp. 336
Isolation and knockoutp. 338
Applying a soft mask to an imagep. 340
Clipping contentp. 341
PDF's text statep. 344
Text objectsp. 344
Convenience methods to position and show textp. 350
The map of Foobar (part 2)p. 353
Summaryp. 355
Drawing to Java Graphics2Dp. 356
Obtaining a Java.awt.Graphics2D instancep. 357
A simple example from Sun's tutorialp. 358
Mapping AWT fonts to PDF fontsp. 362
Drawing glyph shapes instead of using a PDF fontp. 365
Two-dimensional graphics in the real worldp. 368
Exporting Swing components to PDFp. 368
Drawing charts with JFreeChartp. 371
PDF's optional contentp. 374
Making content visible or invisiblep. 374
Adding structure to layersp. 375
Using a PdfLayerp. 378
Optional content membershipp. 380
Changing the state of a layer with an actionp. 382
Optional content in XObjects and annotationsp. 384
Enhancing the map of Foobarp. 385
Defining the layers for the map and the street namesp. 386
Combining iText and Apache Batikp. 388
Adding tourist information to the mapp. 389
Summaryp. 392
Interactive PDFp. 393
Browsing a PDF documentp. 395
Changing viewer preferencesp. 396
Setting the page layoutp. 397
Choosing the page modep. 398
Viewer optionsp. 399
Visualizing thumbnailsp. 401
Changing the page labelsp. 402
Changing the thumbnail imagep. 404
Adding page transitionsp. 405
Adding bookmarksp. 407
Creating destinationsp. 407
Constructing an outline treep. 409
Adding actions to an outline treep. 410
Retrieving bookmarks from an existing PDF filep. 411
Manipulating bookmarks in existing PDF filesp. 413
Introducing actionsp. 415
Actions to go to an internal destinationp. 415
Actions to go to an external destinationp. 417
Triggering actions from eventsp. 418
Adding JavaScript to a PDF documentp. 420
Launching an applicationp. 420
Enhancing the course catalogp. 421
Summaryp. 424
Automating PDF creationp. 425
Creating a pagep. 426
Adding empty pagesp. 426
Defining page boundariesp. 427
Reordering pagesp. 431
Common page event functionalityp. 432
Overview of the PdfPageEvent methodsp. 432
Adding a header and a footerp. 433
Adding page X of Yp. 435
Adding watermarksp. 438
Creating an automatic slide showp. 440
Automatically creating bookmarksp. 442
Automatically creating a table of contentsp. 443
Alternative XML solutionsp. 445
Writing a letter on company stationeryp. 445
Parsing a playp. 451
Parsing (X)HTMLp. 456
Using HtmlWorker to parse HTML snippetsp. 458
Enhancing the course catalog (part 2)p. 461
Summaryp. 463
Creating annotations and fieldsp. 464
Introducing annotationsp. 465
Simple annotationsp. 465
Other types of annotationsp. 470
Adding annotations to a chunk or imagep. 474
Creating an AcroFormp. 475
Button fieldsp. 476
Creating text fieldsp. 482
Creating choice fieldsp. 486
Submitting a formp. 488
Choosing field namesp. 488
Adding actions to the pushbuttonsp. 491
Adding actionsp. 496
Comparing HTML and PDF formsp. 498
Summaryp. 500
Filling and signing AcroFormsp. 501
Filling in the fields of an AcroFormp. 502
Retrieving information about the fields (part 1)p. 503
Filling fieldsp. 505
Retrieving information from a field (part 2)p. 508
Flattening a PDF filep. 510
Optimizing the flattening processp. 511
Working with FDF and XFDF filesp. 514
Reading and writing FDFfilesp. 514
Reading XFDF filesp. 517
Signing a PDF filep. 518
Adding a signature field to a PDF filep. 518
Using public and private keysp. 520
Generating keys and certificatesp. 521
Signing a documentp. 523
Verifying a PDF filep. 529
Summaryp. 532
iText in web applicationsp. 533
Writing PDF to the ServletOutputStream: pitfallsp. 534
Solving problems related to content type-related problemsp. 536
Troubleshooting the blank-page problemp. 537
Problems with PDF generated from JSPp. 542
Avoiding multiple hits per PDFp. 543
Workaround for the timeout problemp. 545
Putting the theory into practicep. 550
A personalized course catalogp. 550
Creating a learning agreement formp. 553
Reading an FDF file in a JSP pagep. 559
Summaryp. 561
Under the hoodp. 562
Inside iText and PDFp. 563
Factors of successp. 563
The file structure of a PDF documentp. 564
Basic PDF objectsp. 569
Climbing up the object treep. 570
Extracting and editing textp. 574
Reading a page's content streamp. 574
Why iText doesn't do text extractionp. 576
Why you shouldn't use PDF as a format for editingp. 578
Rendering PDFp. 581
How to print a PDF file programmaticallyp. 581
Printing a PDF file in a web applicationp. 583
Manipulating PDF filesp. 584
Toolbox toolsp. 585
The learning agreement (revisited)p. 587
Summaryp. 590
Class diagramsp. 591
Creating barcodesp. 602
Open parametersp. 618
Signing a PDF with a smart cardp. 621
Dealing with exceptionsp. 624
Pdf/X, Pdf/A and tagged PDFp. 630
Resourcesp. 638
Indexp. 642
Table of Contents provided by Ingram. All Rights Reserved.

Rewards Program

Write a Review