Originally posted by Klaus Meucht:
Is the book "IText in Action" itself written with iText?
No, Manning Publications asks its writers to provide the manuscript in another form. However: Manning is using iText for post processing. For instance: for stamping user-specific information on every eBook that is sold.
Originally posted by Klaus Meucht:
On page 95 there is published a little bit of source code (HelloWorldEncryptDecrypt.java). Some lines are marked with black points and numbers in it. There is a vertical line to mark more than one line of the source code.
I like this kind of marking to explain source code. Can I do this with iText?
The black point with a number in it, is called a cueball.
Note that I had to write the code like this:
Document document = new Document(); #1
PdfWriter.getInstance( #2
document, new FileOutputStream("my.pdf")); #2
document.open(); #3
document.add(new Paragraph("Hello World")); #4
document.close() ; #5
<annotation#1> step 1
<annotation#2> step 2
<annotation#3> step 3
<annotation#4> step 4
<annotation#5> step 5
A typographer then added the cueballs and lines.
Note that this is a very difficult process to automate (it can lead to ugly results). But it's not entirely impossible to achieve with iText.
You could use the font ZapfDingbats (see chapter 8) for the cueballs, and draw the lines with the path construction and drawing functionality (explained in chapter 10). You could find the coordinates (where to draw the lines) using the onGenericTag functionality (explained in chapter 4; about generic Chunk functionaliy).
There are other ways to achieve the same result. I would probably do it with ColumnText (chapter 7). It all depends on the format of the text source (is it plain text? is it XML? how do you store the annotation?)