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>
​

On Sat, Dec 6, 2014 at 7:30 PM, Tilman Hausherr <[email protected]>
wrote:

> I suspect it is related to whether there are intermediate page nodes, i.e.
> kid nodes that have kids. You can see this with PDFDebugger.
>
> Tilman
>
> Am 06.12.2014 um 16:09 schrieb Gilad Denneboom:
>
>> Yes, it happens with a lot of files, but not all. I did get it to work
>> with
>> some files.
>>
>> On Sat, Dec 6, 2014 at 3:51 PM, Tilman Hausherr <[email protected]>
>> wrote:
>>
>>  Interesting. It happens also when merging the spec and any other file.
>>>
>>> Tilman
>>>
>>> Am 06.12.2014 um 14:49 schrieb Gilad Denneboom:
>>>
>>>   First problem: Download the PDF ISO Specs file (
>>>
>>>> http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf), make 3
>>>> copies
>>>> of it in the same folder and attempt to merge it using PDFMergerUtility.
>>>> The result is this:
>>>>
>>>> java.lang.IllegalArgumentException: resourceDictionary is null
>>>> Combined as:
>>>>       at org.apache.pdfbox.pdmodel.PDResources.<init>(
>>>> PDResources.java:68)
>>>>       at
>>>> org.apache.pdfbox.util.PDFMergerUtility.appendDocument(
>>>> PDFMergerUtility.java:439)
>>>>       at
>>>> org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(
>>>> PDFMergerUtility.java:189)
>>>>
>>>>
>>>>
>>>> On Fri, Dec 5, 2014 at 5:24 PM, Gilad Denneboom <
>>>> [email protected]>
>>>> wrote:
>>>>
>>>>   Thanks, try it out now (this also seems to solve my other issue with
>>>> the
>>>>
>>>>> INFO statements)...
>>>>>
>>>>> On Fri, Dec 5, 2014 at 5:01 PM, Maruan Sahyoun <[email protected]
>>>>> >
>>>>> wrote:
>>>>>
>>>>>   http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/
>>>>>
>>>>>> main/java/org/apache/pdfbox/examples/pdmodel/
>>>>>> AddImageToPDF.java?view=markup
>>>>>>
>>>>>> BR
>>>>>> Maruan
>>>>>>
>>>>>> Am 05.12.2014 um 16:55 schrieb Gilad Denneboom <
>>>>>> [email protected]
>>>>>>
>>>>>>  :
>>>>>>> OK... Another issue I have with this snapshot is that PDJpeg seems to
>>>>>>> be
>>>>>>> gone. How do I draw an image onto a PDPageContentStream from a
>>>>>>> FileInputStream?
>>>>>>>
>>>>>>> On Fri, Dec 5, 2014 at 4:49 PM, Maruan Sahyoun <
>>>>>>> [email protected]
>>>>>>> wrote:
>>>>>>>
>>>>>>>   with PDFBox 2.0 the NonSequential Parser will be the standard
>>>>>>> parser.
>>>>>>> As a
>>>>>>> result mergeDocuments() is the method you are looking for.
>>>>>>>
>>>>>>>> BR
>>>>>>>> Maruan
>>>>>>>>
>>>>>>>> Am 05.12.2014 um 16:44 schrieb Gilad Denneboom <
>>>>>>>>
>>>>>>>>  [email protected]
>>>>>>> :
>>>>>>>
>>>>>>>> I got the latest snapshot (pdfbox-2.0.0-20141205.082231-763.jar),
>>>>>>>>> but
>>>>>>>>>
>>>>>>>>>  now
>>>>>>>>
>>>>>>> mergeDocumentsNonSeq seems to be completely gone... Am I missing
>>>>>>>
>>>>>>>> something
>>>>>>>>
>>>>>>>>  here?
>>>>>>>>>
>>>>>>>>> On Fri, Dec 5, 2014 at 4:21 PM, Maruan Sahyoun <
>>>>>>>>>
>>>>>>>>>  [email protected]>
>>>>>>>>
>>>>>>> wrote:
>>>>>>>
>>>>>>>>   Hi,
>>>>>>>>>
>>>>>>>>>> from that information alone I can't tell - could you try the 1.8.8
>>>>>>>>>> or
>>>>>>>>>>
>>>>>>>>>>  2.0
>>>>>>>>> Snapshots [1]? There were some enhancements to the non sequential
>>>>>>>>> parser.
>>>>>>>>> Otherwise we'd need a unit test and test documents to reproduce the
>>>>>>>>> issue.
>>>>>>>>> BR
>>>>>>>>>
>>>>>>>>>> Maruan
>>>>>>>>>>
>>>>>>>>>> [1] https://pdfbox.apache.org/download.cgi#snapshots
>>>>>>>>>>
>>>>>>>>>> Am 05.12.2014 um 16:05 schrieb Gilad Denneboom <
>>>>>>>>>>
>>>>>>>>>>  [email protected]
>>>>>>>>> :
>>>>>>>>>
>>>>>>>>>> Sorry, I forgot... Here it is: http://imgur.com/XegljjS
>>>>>>>>>>>
>>>>>>>>>>> On Fri, Dec 5, 2014 at 3:43 PM, Maruan Sahyoun <
>>>>>>>>>>>
>>>>>>>>>>>  [email protected]
>>>>>>>>>>
>>>>>>>>> wrote:
>>>>>>>
>>>>>>>>   Hi Gilad,
>>>>>>>>>>>
>>>>>>>>>>>> attachments don't make it through on the mailing list. Could you
>>>>>>>>>>>>
>>>>>>>>>>>>  upload
>>>>>>>>>>>
>>>>>>>>>> it
>>>>>>>>>
>>>>>>>>>> to a public location?
>>>>>>>>>>>
>>>>>>>>>>>> BR
>>>>>>>>>>>>
>>>>>>>>>>>> Maruan
>>>>>>>>>>>>
>>>>>>>>>>>> Am 05.12.2014 um 15:31 schrieb Gilad Denneboom <
>>>>>>>>>>>>
>>>>>>>>>>>>  [email protected]
>>>>>>>>>>> :
>>>>>>>>>>>
>>>>>>>>>>>> Hi Maruan,
>>>>>>>>>>>>>
>>>>>>>>>>>>> That's good to know, thanks.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I only have it as a screenshot at the moment... I'm using
>>>>>>>>>>>>>
>>>>>>>>>>>>>  mergeDocumentsNonSeq, as you can see.
>>>>>>>>>>>>
>>>>>>>>>>>>  Gilad
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Fri, Dec 5, 2014 at 3:07 PM, Maruan Sahyoun <
>>>>>>>>>>>>>
>>>>>>>>>>>>>  [email protected]
>>>>>>>>>>>>
>>>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hi Gilad,
>>>>>>>>>>>>>
>>>>>>>>>>>>> not that I'm aware of (official or not). What's the exception
>>>>>>>>>>>>>
>>>>>>>>>>>>>  you're
>>>>>>>>>>>>
>>>>>>>>>>> getting?
>>>>>>>
>>>>>>>> BR
>>>>>>>>>>>>>
>>>>>>>>>>>>> Maruan
>>>>>>>>>>>>>
>>>>>>>>>>>>> Am 05.12.2014 um 14:39 schrieb Gilad Denneboom <
>>>>>>>>>>>>>
>>>>>>>>>>>>>  [email protected]>:
>>>>>>>>>>>>
>>>>>>>>>>>>  Hi all,
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Does anyone know if the PDFMergerUtility has a maximum file
>>>>>>>>>>>>>> size
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>  limit? I'm
>>>>>>>>>>>>> encountering strange exceptions when the file size exceeds
>>>>>>>>>>>>> 500MB
>>>>>>>>>>>>> on
>>>>>>>>>>>>>
>>>>>>>>>>>> a
>>>>>>>
>>>>>>>> Windows 7 computer (NTFS file system), and was wondering if
>>>>>>>>>
>>>>>>>>>> there's
>>>>>>>>>>>>>
>>>>>>>>>>>> some
>>>>>>>
>>>>>>>> kind of file-size limitation (using PDFBox 1.8.7), official or
>>>>>>>>>>>>> not?
>>>>>>>>>>>>>
>>>>>>>>>>>> Regards, Gilad.
>>>>>>>
>>>>>>>>
>>>>>>>>>>>>>
>

Reply via email to