[
https://issues.apache.org/jira/browse/PDFBOX-2226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14069881#comment-14069881
]
Tilman Hausherr commented on PDFBOX-2226:
-----------------------------------------
So, the merge problem no longer happens with 1.8.7, correct? And multiline
fields are also OK there?
The " ) Tj 0 - 13 Td (" problem did happen with the 2.0 version, what did you
do? Did you use the code from PDFBOX-283 or a different code? I'm asking
because I'm using the 2.0 version right here and don't have the problem. (If
you had used the original code from PDFBOX-283, it wouldn't have worked at all,
because PDTextbox doesn't exist in 2.0. I'm also asking because I thought we
had fixed that problem and now I'm scared that we didn't.)
{code}
String filePath = "acroform.pdf";
String textboxFieldName = "multiline_textbox";
PDDocument pdfDocument = PDDocument.load(filePath);
PDAcroForm acroForm = pdfDocument.getDocumentCatalog().getAcroForm();
PDVariableText textbox = (PDVariableText)
acroForm.getField(textboxFieldName);
textbox.setMultiline(true);
acroForm.getField(textboxFieldName).setValue("One\nTwo\nThree");
pdfDocument.save("acroform2.pdf");
pdfDocument.close();
{code}
> IndexOutOfBoundsException when merging many PDFs in memory
> ----------------------------------------------------------
>
> Key: PDFBOX-2226
> URL: https://issues.apache.org/jira/browse/PDFBOX-2226
> Project: PDFBox
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 1.8.6
> Environment: Windows 7 64-bit, JDK8
> Reporter: Brandon Lyon
> Attachments: foo2_1_1.pdf, foo_1_1.pdf
>
>
> An IndexOutOfBoundsException occurs when attempting to merge many (at least
> 10) PDF documents together. All PDFs exist in byte arrays in memory, not as
> files. The stack trace looks as follows (irrelevant details redacted):
> 2014-07-18 11:48:22,858 ERROR [io.undertow.servlet] (default task-5) ****:
> Uncaught exception: : ****
> ****
> Caused by: org.apache.pdfbox.exceptions.WrappedIOException
> at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:267)
> [pdfbox-1.8.6.jar:]
> at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1216)
> [pdfbox-1.8.6.jar:]
> at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1183)
> [pdfbox-1.8.6.jar:]
> at
> org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:236)
> [pdfbox-1.8.6.jar:]
> at
> org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:185)
> [pdfbox-1.8.6.jar:]
> at ****
> ... 29 more
> Caused by: java.lang.IndexOutOfBoundsException: Index: 145, Size: 145
> at java.util.ArrayList.rangeCheck(ArrayList.java:638) [rt.jar:1.8.0_05]
> at java.util.ArrayList.get(ArrayList.java:414) [rt.jar:1.8.0_05]
> at
> org.apache.pdfbox.io.RandomAccessBuffer.seek(RandomAccessBuffer.java:110)
> [pdfbox-1.8.6.jar:]
> at
> org.apache.pdfbox.io.RandomAccessFileOutputStream.write(RandomAccessFileOutputStream.java:106)
> [pdfbox-1.8.6.jar:]
> at
> java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
> [rt.jar:1.8.0_05]
> at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
> [rt.jar:1.8.0_05]
> at java.io.FilterOutputStream.close(FilterOutputStream.java:158)
> [rt.jar:1.8.0_05]
> at
> org.apache.pdfbox.pdfparser.BaseParser.parseCOSStream(BaseParser.java:634)
> [pdfbox-1.8.6.jar:]
> at
> org.apache.pdfbox.pdfparser.PDFParser.parseObject(PDFParser.java:609)
> [pdfbox-1.8.6.jar:]
> at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:194)
> [pdfbox-1.8.6.jar:]
> ... 34 more
--
This message was sent by Atlassian JIRA
(v6.2#6252)