Bruno Lowagie (iText <bruno <at> lowagie.com> writes:

> 
> Sameet Lal wrote:
> > Hi,
> >  
> > I am using iText. I am creating a PDF file using PdfWriter. It works fine.
> > Now I need to read the contents of above created file, for this I am 
> > using PdfReader, but it gives me lot of extra characters.
> > I also bought your iText in Action online book and am not able to find 
> > any help as it gives only incomplete code.
> >  
> > Can you please post me the code that I can use to read contents of the 
> > above pdf file without the extra characters?
> 
> Have you read the last sentence of 3.2.1 on p80?
> "In short, creating traditional PDF is a one-way process."
> The long explanation can be found in section 18.2:
> "Extracting and editing text"
> 
> Based on the very limited information you are giving,
> I have the impression you are retrieving the content stream
> of a page containing the PDF operators and operands that
> describe how the content has to be rendered.
> 
> Of course, you're not telling us what extra characters
> you are getting, so I'm not sure if the fact that you
> mistake PDF for a Word processing format is really
> your problem.
> 
> br,
> Bruno
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> iText-questions mailing list
> iText-questions <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
> 
> 

ok, here' are the extra characters:

q BT 36 806 Td 0 -18 Td /F1 12 Tf (template test)Tj ET Q

I extract them using the following code segment:

PdfReader pdfr = new PdfReader(fullFileName);   
int fileLen = pdfr.getFileLength();   
HashMap hm = new HashMap();   
hm = pdfr.getInfo();   
int pages = pdfr.getNumberOfPages();   
byte b [] = pdfr.getPageContent(1);    
String str = new String(b);   
return str;

All I want is to read contents of PDF file i created using iText without junk 
characters and display them in web page. Please help.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to