Search code examples
javapdfbox

pdfbox git merge example. Where the final merged file is stored?


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?


Solution

  • 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
    

    https://www.baeldung.com/convert-input-stream-to-a-file