You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by "Huber, Michael" <Mi...@bayernlb.de> on 2013/02/06 11:31:11 UTC

PDFMergerUtility produces Garbage

Hello all,

i'am using the PDFMergerUtility to merge a bunch of pdf files created by graphviz into one pdf. The pdf files created by graphviz are readable by acrobat reader X.

Problem:
The merged output pdf is fine when run under Eclipse Juno SR1, Java 1.6 runtime.
The output is garbage when run from executable jar from windows cmd line.

Any Idea?

Thanks in advance,

Michael

Java code:
The Vector "images" simply contains a list of fqdn to pdf files created by graphviz

      public void addToMainPdf(Vector<String> images) throws COSVisitorException, IOException {

            File mpdf = new File(mainPdfFile);
            mpdf.delete();

            PDFMergerUtility pdfMergerUtility = new PDFMergerUtility();
            pdfMergerUtility.setDestinationFileName(mainPdfFile);
            log.info("Erzeuge pdf " + mainPdfFile);

            for (String imagePdf : images) {
                  log.info("Lade Seite: " + imagePdf);
                  pdfMergerUtility.addSource(imagePdf);
            }
            pdfMergerUtility.mergeDocuments();
            log.info("pdf wurde erzeugt: " + mainPdfFile);
      }