Oracle PDFMerger API does not support PDF format beyond 2004

12 Sep 2016

I recently encountered a problem where I was asked to merge PDF Files as part of an EBS customisation. Considering that most of Oracle’s tools support exporting in PDF Format and that Oracle EBS contains a Java library for merging PDFs you would have thought it would be kept up to date. However after some investigation and queries on metalink it appears Oracle have not bothered updating their PDFMerger API to support PDF formats from 2005 onwards and I am posting this in 2016.

However Apache Opensource libraries come to the rescue and if you choose PDFBox you get to use a Java Library that works with the latest PDF Formats and is maintained

So rather than the Oracle API below

import oracle.apps.xdo.common.pdf.util.PDFDocMerger;

PDFDocMerger pdfMerger = new PDFDocMerger(inpFiles, outFile);

Use the Apache PDFBox library


import org.apache.pdfbox.multipdf.PDFMergerUtility;

mergePDF = new PDFMergerUtility();
for (File string : inStreams)
{
          mergePDF.addSource(string);
} 

Published on 12 Sep 2016 Find me on Twitter!