Your code is wrong. You should have:
if (document == null){
document = new Document(docreader.getPageSizeWithRotation(1));
copywriter = new PdfCopy(document, outputbaos);
document.open();
}
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of [EMAIL PROTECTED]
> Sent: Monday, October 24, 2005 5:19 PM
> To: [email protected]
> Subject: RE: [iText-questions] Pdf Concatenation:
> NullPointerException on PdfWriter.getPdfIndirectReference
>
> Hi all,
>
> I sent to Paulo Soares a zip (14ko) which generate the error
> i meet during a pdf concatenation (see below).
> If anyone want also investigate i can send him the zip.
>
> Hope it helps.
> Best Regards.
>
> -----Message d'origine-----
> De : [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] De la
> part de [EMAIL PROTECTED]
> Envoyé : vendredi 21 octobre 2005 20:10
> À : [email protected]
> Objet : RE: [iText-questions] Pdf Concatenation:
> NullPointerException on PdfWriter.getPdfIndirectReference
>
> Well,
>
> After testing with last iText v1.3.5, the problem is still
> available :-(
>
> I will give you next monday some pdf samples.
> But i rather think that the problem comes from the fact that
> we pass only by ByteArrayOutputStreams.
>
> For a first check, perhaps you could try this :
> - create 2 pdfs and put them directly into
> ByteArrayOutputStream() (not FileOutputStream),
> - close/flush all, null all variables except both 2
> byteArrayOutputStreams,
> - use a docreader = PdfReader(new
> java.io.ByteArrayInputStream(byteArrayOutputStream1.toByteArray()));
> + use a new Document(docreader.getPageSizeWithRotation(1));
> - try to concatenate this with the 2nd
> byteArrayOutputStream2. Destination is again a
> byteArrayOutputStream3 by a new PdfCopy(document, notcryptedbaos);
> - well the idea is not to pass by files.
>
> I will try to give you some more stuff later.
>
> -----Message d'origine-----
> De : [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] De la
> part de [EMAIL PROTECTED]
> Envoyé : vendredi 21 octobre 2005 14:09
> À : [email protected]
> Objet : RE: [iText-questions] Pdf Concatenation:
> NullPointerException on PdfWriter.getPdfIndirectReference
>
> Yes, i was thinking like you after posting this email.
> I'm currently using 1.3.0 iText version.
> I will try with the last 1.3.5 version. But unfortunately
> Sourceforge download service seems to be in heavy charge (no
> possibility to download itext-1.3.5.jar from
> http://prdownloads.sourceforge.net/itext/. Is there any
> alternative spot to obtain this version ?
>
> Again thanks for your precious time.
>
>
> -----Message d'origine-----
> De : Paulo Soares [mailto:[EMAIL PROTECTED] Envoyé :
> vendredi 21 octobre 2005 12:40 À : Nigaud, Christophe
> PH/FR/EXT; [email protected]
> Objet : RE: [iText-questions] Pdf Concatenation:
> NullPointerException on PdfWriter.getPdfIndirectReference
>
> Are you using the latest release 1.3.5? If you are post the PDF.
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of
> > [EMAIL PROTECTED]
> > Sent: Friday, October 21, 2005 11:23 AM
> > To: [email protected]
> > Subject: [iText-questions] Pdf Concatenation:
> > NullPointerException on PdfWriter.getPdfIndirectReference
> >
> > Hi all,
> >
> > The sourceforge seems to be really slow... So, sorry if
> this question
> > has been already ask :
> > I had a NullPointerException during a Pdf concatenation script, but
> > nothing seems to be really null outside the iText api ?
> >
> > Is it possible because i use ByteArrayOutputStream instead of
> > FileOutputStream ?
> >
> > java.lang.NullPointerException
> > at
> > com.lowagie.text.pdf.PdfWriter.getPdfIndirectReference(Unknown
> > Source)
> > at com.lowagie.text.pdf.PdfImportedPage.<init>(Unknown Source) at
> > com.lowagie.text.pdf.PdfReaderInstance.getImportedPage(Unknown
> > Source)
> > at com.lowagie.text.pdf.PdfCopy.getImportedPage(Unknown Source)
> >
> > Here is part of the code...
> >
> > Document document = null;
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads,
> discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads,
> discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.
> Get Certified Today * Register for a JBoss Training Course
> Free Certification Exam for All Training Attendees Through End of 2005
> Visit http://www.jboss.com/services/certification for more information
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions