• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is iText in Action written with iText?

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Bruno Lowagie

Is the book "IText in Action" itself written with iText?

I was at your homepage and I saw the sampleChapter 3 on your book.

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?
 
author
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic