First of all, I tried to run Acrobat 9.4 pro's PDF Syntax Check on
1.pdf:  It FAILED!  The error message stated that you had an illegal
content stream.  I looked through the content stream and found the
following:
 
1) Everything is in picas (1/20 of a point), so some of the coordinates
are Quite Large... though none are so large that they should cause a
problem (> 0xFFFF).  The original coordinate system crystal reports used
was "y increases from bottom to top", whereas PDF uses "top to bottom".
None of this is all that unusal.
2) The fonts are all custom-encoded subsets without legal subset names.
"Arial+0" and "Arial-Bold+1" instead of the usual "FontName+<six UPPER
CASE characters>" that is the Declared Standard way of doing things.
Again, not a huge deal, but not great.
3) One of the fonts is named "9".  I don't think that's a legal resource
name... /9 is a perfectly valid PdfName... I don't see anything about
restricting font names to "valid variable names" as you'd see in C-esque
languages.  A bug in the PDF validator perhaps?  The PDF renders fine.
 
 
The first exception is a failure to read an array in a content stream.
That only happens within "kerned" text (google "kerning" if you'd like
to know more).  Between the odd encoding and the kerning, it sounds like
CrystalReports created an illegal content stream.  This may well be
what's choking the Pdf Validator.
 
 
In the case of the second exception, you're adding something as a direct
object when it should be added as a reference.  For Example:
 
PdfDictionary myDict = new PdfDictionary();
someOtherDict.put( PdfName.SOME_KEY, myDict ); // added directly
someOtherDict.put( PdfName.ANOTHER_KEY, myWriter.addToBody( myDict ) );
// added as a reference
 
Only PdfWriter.addToBody() returns a PdfIndirectReference, not a
PRIndirectReference... Same concept, but your code will be different.
That's why we need to see it.  Could you please post your code to the
list?
 
 
--Mark Storer
  Senior Software Engineer
  Cardiff.com
 
import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;
 
 


________________________________

        From: Modesto Aguirre Gomez [mailto:modestoagui...@hotmail.com] 
        Sent: Friday, October 15, 2010 12:46 AM
        To: Mail list iText
        Subject: Re: [iText-questions] Reading text from PDF
        
        
        I tired to solve this problem for myself during a month but I
could not.
        
        The PDF that I have the problem with is called 1.pdf. I hope
that you can solve it.
        
        What I pretend is to read the text of the PDF or directly remove
the regionClip that i think is giving me the problem.
        
        This is the error:
        
        java.lang.NullPointerException
                at
com.itextpdf.text.pdf.PdfContentParser.readArray(PdfContentParser.java:1
48)
                at
com.itextpdf.text.pdf.PdfContentParser.readPRObject(PdfContentParser.jav
a:173)
                at
com.itextpdf.text.pdf.PdfContentParser.parse(PdfContentParser.java:89)
                at
com.itextpdf.text.pdf.parser.PdfContentStreamProcessor.processContent(Pd
fContentStreamProcessor.java:338)
                at
com.itextpdf.text.pdf.parser.PdfReaderContentParser.processContent(PdfRe
aderContentParser.java:41)
                at
com.itextpdf.text.pdf.parser.PdfTextExtractor.getTextFromPage(PdfTextExt
ractor.java:73)
                at
com.itextpdf.text.pdf.parser.PdfTextExtractor.getTextFromPage(PdfTextExt
ractor.java:88)
                at mailpdf.Main.main(Main.java:41)
        
        I tried skip the error before by generating the PDF in a pdf
print. This works but later i find a diferent error. This error 
        
        is caused when i try to close the file after inserting a
picture. "stamper.close();". The PDF that i have the problem with is 
        
        called 2.pdf
        
        java.lang.ClassCastException:
com.itextpdf.text.pdf.PdfDictionary cannot be cast to
com.itextpdf.text.pdf.PRIndirectReference
                at
com.itextpdf.text.pdf.PdfStamperImp.close(PdfStamperImp.java:209)
                at
com.itextpdf.text.pdf.PdfStamper.close(PdfStamper.java:189)
                at Util.EditorTC2.InsertaImagenTC2(EditorTC2.java:171)
                at Util.EditorTC2.SeparaPorCIF(EditorTC2.java:74)
                at Util.Ejecutar$ejecuta.<init>(Ejecutar.java:105)
                at Util.Ejecutar$1.construct(Ejecutar.java:45)
                at Util.SwingWorker$2.run(SwingWorker.java:60)
                at java.lang.Thread.run(Thread.java:619)
        
        From the beginning my intention has been read the PDF and to
insert it a picture that i want.
        
        Thank you.
        
        > Date: Wed, 8 Sep 2010 17:26:22 -0700
        > From: ke...@trumpetinc.com
        > To: itext-questions@lists.sourceforge.net
        > Subject: Re: [iText-questions] Reading text from PDF
        > 
        > 
        > Another option would be to use
        > com.itextpdf.text.pdf.parser.PdfContentReaderTool to obtain
the content
        > stream for the page that is causing problems. The tool should
actually fail
        > with the null pointer exception, but you'll get the content
stream output
        > before then.
        > 
        > Replace the text extraction strategy (which is specified in
line 181 of
        > PdfContentReaderTool) with your own TextExtractionStrategy
implementation (I
        > would just print the text content to sysout for each call to
renderText() ). 
        > The last text emitted before the NPE will be the string to
search on in the
        > content stream to find the bad array.
        > 
        > 
        > -- 
        > View this message in context:
http://itext-general.2136553.n4.nabble.com/Reading-text-from-PDF-tp25289
25p2532215.html
        > Sent from the iText - General mailing list archive at
Nabble.com.
        > 
        >
------------------------------------------------------------------------
------
        > This SF.net Dev2Dev email is sponsored by:
        > 
        > Show off your parallel programming skills.
        > Enter the Intel(R) Threading Challenge 2010.
        > http://p.sf.net/sfu/intel-thread-sfd
        > _______________________________________________
        > iText-questions mailing list
        > iText-questions@lists.sourceforge.net
        > https://lists.sourceforge.net/lists/listinfo/itext-questions
        > 
        > Buy the iText book: http://www.itextpdf.com/book/
        > Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
        > You can also search the keywords list:
http://1t3xt.info/tutorials/keywords/
        

        No virus found in this incoming message.
        Checked by AVG - www.avg.com
        Version: 9.0.862 / Virus Database: 271.1.1/3196 - Release Date:
10/14/10 11:34:00
        

        

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

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