I want to use the pdfbox library for java to merge thousands of small pdf files. Looking for an example I found one on the pdfbox site and specifically in the examples it has(PDFMergerExample). But where the final merged file is saved?
Asked
Active
Viewed 38 times
1 Answers
1
It's just a class, not a complete sample... The entry method returns an InputStream, from there you can read the result and store ist to e.g. a file.
public InputStream merge(final List<RandomAccessRead> sources) throws IOException

Marc Stroebel
- 2,295
- 1
- 12
- 21
-
I overlooked that it had a return type. Thanks. But at the end it didn't work. With 500 files or more it throws "java.lang.OutOfMemoryError: Java heap space". – Sep 13 '22 at 12:02
-
-Xmx
set maximum Java heap size – Marc Stroebel Sep 13 '22 at 12:10 -
or try merging in slices of x files – Marc Stroebel Sep 13 '22 at 12:11
-
I am using Eclipse. Where should i change the max of Java heap size? – Sep 13 '22 at 13:01
-
1How to increase application heap size in Eclipse? https://stackoverflow.com/questions/15313393/how-to-increase-application-heap-size-in-eclipse – Marc Stroebel Sep 13 '22 at 13:25
-
Thanks a lot. I couldn't use more than 1750m but this was a 32bit JRE restriction. When I changed to 64bit was ok. – Sep 13 '22 at 14:26