Bruno,

Thanks a lot it worked. Not sure I understand the code
but as I said I needed a temporary solution and I have
it!

About the result: the output is indeed a bit odd, the
string are splitted on some unexpected parts (easy to
work around though). The Pdf I use is a PowerBuilder
datawindow printed using Adobe PDF.

Fabio

--- Bruno Lowagie <[EMAIL PROTECTED]> wrote:
> I'll give you a snippet from chapter 18 from the
> upcoming book:
> 
> PdfReader reader = new PdfReader("HelloWorld.pdf");
> PdfDictionary page = reader.getPageN(1); // content
> of page 1
> PRIndirectReference objectReference =
> (PRIndirectReference) 
> page.get(PdfName.CONTENTS);
> PRStream stream = (PRStream)
> PdfReader.getPdfObject(objectReference);
> byte[] streamBytes =
> PdfReader.getStreamBytes(stream);
> PRTokeniser tokenizer = new
> PRTokeniser(streamBytes);
> while (tokenizer.nextToken()) {
>   if (tokenizer.getTokenType() ==
> PRTokeniser.TK_STRING) {
>     System.out.println(tokenizer.getStringValue());
>   }
> }
> 
> It won't work on all your PDFs, but if your PDF is
> generated
> with iText in a sequence of document.add statements
> using a
> 'normal' font, it will give you a more or less good
> result.
> If the PDFs are generated with another tool, you can
> get very
> odd results. You'll have to wait for the book for
> the complete
> explanation ;-)
> br,
> Bruno


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to