Hi

I am a beginner to iText, but I am using it to study about pdf format.
I have bought the book, but I am lost at trying to decode the flate-encoded
(with predictor=12, col=5) stream.
I did the following:

PdfReader reader = new PdfReader("format.pdf");
        
PdfLister lister = new PdfLister(new PrintStream(list));
PdfDictionary trailer = reader.getTrailer();
                
for (int i = 0; i < reader.getNumberOfPages(); i++) {
  PdfDictionary dic = reader.getTrailer();

    for (Iterator it = dic.getKeys().iterator(); it.hasNext();) {
      PdfName name = (PdfName) it.next();

      PdfObject pdobj = dic.get(name);
      
      //check that the object has /Filter
      if ("Filter".equalsIgnoreCase(PdfName.decodeName(name.toString()))) {   

        PRStream content = (PRStream)pdobj;
        byte[] contentstream = reader.getStreamBytes(content);
        
        FileOutputStream fostemp = new FileOutputStream("decoded.txt");
        fostemp.write(contentstream);
        }
    }
}

But I am getting error in the bold code.
Can anyone tell me how I should do this?
-- 
View this message in context: 
http://www.nabble.com/Need-Help-in-Decoding-Xref-Stream-tp22736753p22736753.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to