pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: PDFMergerUtility maximum file size limit?
Date Sat, 06 Dec 2014 23:50:54 GMT
I tried with this code without trouble:

         try
         {
             PDFMergerUtility pdfMerger = new PDFMergerUtility();
             for (int i = 0; i < 30; ++i)
             {
                 String pdfFilename = "test.pdf";
                 pdfMerger.addSource(pdfFilename);
             }
             pdfMerger.setDestinationFileName("dest.pdf");
             pdfMerger.mergeDocuments();
             System.out.println("merged documents");
         }
         catch (Exception ex)
         {
             ex.printStackTrace();
         }

What JDK are you using? I'm using 1.7.0_71.
Tilman




Am 07.12.2014 um 00:05 schrieb Gilad Denneboom:
> New issue with PDFMergerUtility: Take the attached file and make 25
> identical copies of it and merge them. Works fine. Add 5 more copies and
> you get the following (or something similar):
>
> java.lang.IndexOutOfBoundsException: Index: 728, Size: 728
>          at java.util.ArrayList.rangeCheck(Unknown Source)
>          at java.util.ArrayList.get(Unknown Source)
>          at
> org.apache.pdfbox.io.RandomAccessBuffer.seek(RandomAccessBuffer.java:
> 112)
>          at
> org.apache.pdfbox.io.RandomAccessFileOutputStream.write(RandomAccessF
> ileOutputStream.java:108)
>          at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
>          at java.io.BufferedOutputStream.flush(Unknown Source)
>          at java.io.FilterOutputStream.close(Unknown Source)
>          at
> org.apache.pdfbox.pdfparser.NonSequentialPDFParser.parseCOSStream(Non
> SequentialPDFParser.java:1890)
>          at
> org.apache.pdfbox.pdfparser.NonSequentialPDFParser.parseObjectDynamic
> ally(NonSequentialPDFParser.java:1514)
>          at
> org.apache.pdfbox.pdfparser.NonSequentialPDFParser.parseObjectDynamic
> ally(NonSequentialPDFParser.java:1441)
>          at
> org.apache.pdfbox.pdfparser.NonSequentialPDFParser.parseDictObjects(N
> onSequentialPDFParser.java:1417)
>          at
> org.apache.pdfbox.pdfparser.NonSequentialPDFParser.initialParse(NonSe
> quentialPDFParser.java:544)
>          at
> org.apache.pdfbox.pdfparser.NonSequentialPDFParser.parse(NonSequentia
> lPDFParser.java:1013)
>          at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1035)
>          at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:966)
>          at
> org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtili
> ty.java:187)
>
> I tried to pin-point the exact number of files that cause the error but it
> sometimes with 26 and failed with 27, but other times 27 worked and 28
> failed... Very odd behaivour, but it always happens around the 500MB mark.
> ​
>   test.pdf
> <https://docs.google.com/file/d/0B_eBFHMNjkhsTE90dnctN0R5LUk/edit?usp=drive_web>
> ​


Mime
View raw message