Hi,
Here you are the sample code and the sample image-on-text pdf that generates
the exception.
string documentName = @"C:\Temp\pdf\22568 20.pdf";
string extractFolder = @"C:\Temp\extractedImages";
string imageName = extractFolder + Path.DirectorySeparatorChar +
Path.GetFileNameWithoutExtension(documentName) + "_{0:000}.{1}";
             PdfReader reader = new PdfReader(documentName);

             PdfReaderContentParser parser = new
PdfReaderContentParser(reader);
 int i = 1;           
                 try
                 {
                    
                     string imgpath = String.Format(imageName, i, "{0}");

                     parser.ProcessContent(i, new
ImageRenderListener(imgpath));
                 }
                 catch (Exception ex)
                 {
                    MessageBox.Show("Cannot process content of " +
String.Format(imageName, i) + ex.Message);
                 }

the ImageRenderListener is a direct implementation of the IRenderListener
interface just to save the image content of the pdf file.
 The stack trace is as follows:
at iTextSharp.text.pdf.CMapAwareDocumentFont.GetWidth(Int32 char1)
   at iTextSharp.text.pdf.parser.TextRenderInfo.GetStringWidth(String str)
   at iTextSharp.text.pdf.parser.TextRenderInfo.GetUnscaledWidth()
   at
iTextSharp.text.pdf.parser.PdfContentStreamProcessor.DisplayPdfString(PdfString
str)
   at
iTextSharp.text.pdf.parser.PdfContentStreamProcessor.ShowText.Invoke(PdfContentStreamProcessor
processor, PdfLiteral oper, List`1 operands)
   at
iTextSharp.text.pdf.parser.PdfContentStreamProcessor.InvokeOperator(PdfLiteral
oper, List`1 operands)
   at
iTextSharp.text.pdf.parser.PdfContentStreamProcessor.ProcessContent(Byte[]
contentBytes, PdfDictionary resources)
   at
iTextSharp.text.pdf.parser.PdfContentStreamProcessor.FormXObjectDoHandler.HandleXObject(PdfContentStreamProcessor
processor, PdfStream stream, PdfIndirectReference refi)
   at
iTextSharp.text.pdf.parser.PdfContentStreamProcessor.DisplayXObject(PdfName
xobjectName)
   at
iTextSharp.text.pdf.parser.PdfContentStreamProcessor.Do.Invoke(PdfContentStreamProcessor
processor, PdfLiteral oper, List`1 operands)
   at
iTextSharp.text.pdf.parser.PdfContentStreamProcessor.InvokeOperator(PdfLiteral
oper, List`1 operands)
   at
iTextSharp.text.pdf.parser.PdfContentStreamProcessor.ProcessContent(Byte[]
contentBytes, PdfDictionary resources)
   at
iTextSharp.text.pdf.parser.PdfReaderContentParser.ProcessContent[E](Int32
pageNumber, E renderListener)
   at TestApp.Form1.btnTest_Click(Object sender, EventArgs e) in
C:\SVNLocal\trunk\src\Test Projects\TestApp\Form1.cs:line 474
Here is the sample PDF file:  22568_20.pdf
<http://itext-general.2136553.n4.nabble.com/file/n4657075/22568_20.pdf>  

Thanks in advance.



--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/How-to-skip-text-rendering-when-parsing-image-on-text-pdf-file-tp4655822p4657075.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to