I'll have to check it although I find it strange that it works in Java (it 
shouldn't) and not in C#.

Paulo 

-----Original Message-----
From: Keith O [mailto:[email protected]] 
Sent: Monday, June 28, 2010 1:53 AM
To: [email protected]
Subject: [iText-questions] iTextSharp - problem with PdfReader


Converting the chapter 6 example from the new book here:

http://itextpdf.com/examples/index.php?page=example&id=109

to C#. C# code and PDF used by PdfReader attached. An Exception is thrown:

============================================================================
Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object.
   at iTextSharp.text.pdf.PdfReader.GetNormalizedRectangle(PdfArray box)
   at iTextSharp.text.pdf.PdfImportedPage..ctor(PdfReaderInstance readerInstance
, PdfWriter writer, Int32 pageNumber)
   at iTextSharp.text.pdf.PdfReaderInstance.GetImportedPage(Int32 pageNumber)
   at iTextSharp.text.pdf.PdfCopy.GetImportedPage(PdfReader reader, Int32 
pageNumber)
   at SelectPages.manipulateWithCopy(PdfReader reader)
   at SelectPages.Main(String[] args)
============================================================================

Also tried using the latest code from SVN, with the same result. The
PdfArray passed to GetNormalizedRectangle() is null if the PdfReader is used
more than once - if either manipulateWithStamper() or manipulateWithCopy()
is commented out the example works. If two separate instances of PdfReader
are used the example works. The second (and first?) book mentioned that a
single PdfReader object must only be used with one PdfStamper object, but
am guessing this doesn't apply here, since PdfStamper/PdfCopy are used and
the Java example works?

Thanks, keith
                                          
_________________________________________________________________
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
informação confidencial ou legalmente protegida. A incorrecta transmissão desta 
mensagem não significa a perca de confidencialidade. Se esta mensagem for 
recebida por engano, por favor envie-a de volta para o remetente e apague-a do 
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de 
usar, revelar ou distribuir qualquer parte desta mensagem. 

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain 
confidential or legally protected information. The incorrect transmission of 
this message does not mean the loss of its confidentiality. If this message is 
received by mistake, please send it back to the sender and delete it from your 
system immediately. It is forbidden to any person who is not the intended 
receiver to use, distribute or copy any part of this message.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
iText-questions mailing list
[email protected]
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/

Reply via email to