pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gstöttner Siegfried <siegfried.gstoett...@sbg.ac.at>
Subject WG: Problem with PDFMergerExample()
Date Wed, 27 Jul 2016 12:53:01 GMT
Hello all!

I forgot something:
        // Merge all
        PDDocument docMain;
        PDFMergerExample mergerEx = new PDFMergerExample();
        docMain = PDDocument.load(mergerEx.merge(getMergedPDF()));

-----Ursprüngliche Nachricht-----
Von: Gstöttner Siegfried [mailto:siegfried.gstoettner@sbg.ac.at] 
Gesendet: Mittwoch, 27. Juli 2016 14:43
An: users@pdfbox.apache.org
Betreff: Problem with PDFMergerExample()

Hello all!

I am using the original example from
and get an End-of-File-Error at the line pdfMerger.mergeDocuments(MemoryUsageSetting.setupMainMemoryOnly());
public InputStream merge(List<InputStream> sources) throws IOException {...}

Snippets of my code are:

    private final List<InputStream> mergedPDF = new ArrayList<InputStream>();
    public List<InputStream> getMergedPDF() {
        return mergedPDF;

Load a pdf:
PDDocument docPer = PDDocument.load(new File("..."));

Adding items to the List in a loop:

Compute docPer:
    private InputStream oneDocSerial(PDDocument doc) throws IOException {
        // do something with doc
        PDStream ps = new PDStream(doc);
        InputStream output = ps.createInputStream();
        return output;

Could anybody please tell me what to do...? If possible in a more detailed manner, I'm a beginner...

Kind regards from Salzburg, Austria,
Siegfried Gstöttner

To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org

View raw message