It's probably a bug in failing to copy a null pdf object. Can you send me
privately one on those pdf files?
Best Regards,
Paulo Soares
> -----Original Message-----
> From: David Nielsen [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, February 17, 2003 17:08
> To: [EMAIL PROTECTED]
> Subject: [iText-questions] Is it a bug ?
>
> In trying to do do this:
>
> import com.lowagie.text.*;
> import com.lowagie.text.pdf.*;
> import java.io.FileOutputStream;
>
> public class Split {
> public Split() {
> }
> public void doSplit(String filename) {
> try {
> PdfReader reader = new PdfReader(filename);
> int numberOfPages = reader.getNumberOfPages();
> for(int i = 1; i <= numberOfPages; i++) {
> String newFilename = "C:/page" + i + ".pdf";
> Document document = new
> Document(reader.getPageSize(i));
> PdfCopy writer = new PdfCopy(document,new
> FileOutputStream(newFilename));
> document.open();
> PdfImportedPage page =
> writer.getImportedPage(reader, i);
> writer.addPage(page);
> document.close();
> writer.close();
> System.out.println("Done with page: " + i);
> }
> } catch(Exception e) {
> System.out.println("Exception cauth");
> e.printStackTrace();
> }
> }
> // Test main
> public static void main(String[] args) {
> Split split = new Split();
> String filename = "C:/A3017081.PDF";
> split.doSplit(filename);
> }
> }
>
>
>
>
>
> I have tryed it with several pdf files but its only some of them that do
> it
> and this Exception is thrown:
>
> CANNOT COPY type 0
>
> java.lang.NullPointerException
> void com.lowagie.text.pdf.PdfIndirectObject.<init>(int, int,
> com.lowagie.text.pdf.PdfObject, com.lowagie.text.pdf.PdfWriter)
> PdfIndirectObject.java:125
> com.lowagie.text.pdf.PdfIndirectObject
> com.lowagie.text.pdf.PdfWriter$PdfBody.add(com.lowagie.text.pdf.PdfObject,
> com.lowagie.text.pdf.PdfIndirectReference)
> PdfWriter.java:248
> com.lowagie.text.pdf.PdfIndirectReference
> com.lowagie.text.pdf.PdfCopy.copyIndirect(com.lowagie.text.pdf.PRIndirectR
> ef
> erence)
> PdfCopy.java:168
> com.lowagie.text.pdf.PdfObject
> com.lowagie.text.pdf.PdfCopy.copyObject(com.lowagie.text.pdf.PdfObject)
> PdfCopy.java:236
> com.lowagie.text.pdf.PdfArray
> com.lowagie.text.pdf.PdfCopy.copyArray(com.lowagie.text.pdf.PdfArray)
> PdfCopy.java:222
> com.lowagie.text.pdf.PdfObject
> com.lowagie.text.pdf.PdfCopy.copyObject(com.lowagie.text.pdf.PdfObject)
> PdfCopy.java:238
> com.lowagie.text.pdf.PdfDictionary
> com.lowagie.text.pdf.PdfCopy.copyDictionary(com.lowagie.text.pdf.PdfDictio
> na
> ry)
> PdfCopy.java:191
> com.lowagie.text.pdf.PdfObject
> com.lowagie.text.pdf.PdfCopy.copyObject(com.lowagie.text.pdf.PdfObject)
> PdfCopy.java:234
> com.lowagie.text.pdf.PdfIndirectReference
> com.lowagie.text.pdf.PdfCopy.copyIndirect(com.lowagie.text.pdf.PRIndirectR
> ef
> erence)
> PdfCopy.java:167
> com.lowagie.text.pdf.PdfObject
> com.lowagie.text.pdf.PdfCopy.copyObject(com.lowagie.text.pdf.PdfObject)
> PdfCopy.java:236
> com.lowagie.text.pdf.PdfArray
> com.lowagie.text.pdf.PdfCopy.copyArray(com.lowagie.text.pdf.PdfArray)
> PdfCopy.java:222
> com.lowagie.text.pdf.PdfObject
> com.lowagie.text.pdf.PdfCopy.copyObject(com.lowagie.text.pdf.PdfObject)
> PdfCopy.java:238
> com.lowagie.text.pdf.PdfDictionary
> com.lowagie.text.pdf.PdfCopy.copyDictionary(com.lowagie.text.pdf.PdfDictio
> na
> ry)
> PdfCopy.java:191
> void
> com.lowagie.text.pdf.PdfCopy.addPage(com.lowagie.text.pdf.PdfImportedPage)
> PdfCopy.java:315
> void dk.pbms.nod.pdfmodifyer.Split.doSplit(java.lang.String)
> Split.java:22
> void dk.pbms.nod.pdfmodifyer.Split.main(java.lang.String[])
> Split.java:36
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions