0 Replies Latest reply: Jul 22, 2013 6:29 PM by 44b36db3-b9f7-4e8f-a34e-748c39f15b74 RSS

    Getting NULLPointerException while merging pdf files using PDFDocMerger

    44b36db3-b9f7-4e8f-a34e-748c39f15b74

      Hi,

      I am using BI Publisher 11.1.1.7 Version Jar Files to use PDFDocMerger Class in Jdeveloper and my requirement is,

      need to merge pdf files taking from the third party server.So, I am passing url as an input to PDFDocMerger(As per BIP documentation we can pass url as an input to PDFDocMerger using Object Class) but I am getting NULLPointerException.

       

      I am using below code:

      import java.io.File;
      import java.io.FileOutputStream;
      import oracle.xdo.common.pdf.util.PDFDocMerger;

      public class PDFMerger
      {
      public PDFMerger() {
      }
           public void pdfDocumentMerger() {
      try {
      System.out.println("Testing1");
               
                        Object[] f = new Object[2];
                  f[0]= ("http://docs.mytxi.com/downloads/Invoices/OE/06082013/02599553.PDF");
                  f[1]= ("http://docs.mytxi.com/downloads/Invoices/OE/06082013/02599553.PDF");
                  FileOutputStream output;
                  output = new FileOutputStream("c:\\docs\\OutputPDF.pdf");
           System.out.println("Testing3" + f[0]);
                  PDFDocMerger pdfMerger;
                  pdfMerger = new PDFDocMerger(f, output);
           System.out.println("Testing4");
            pdfMerger.process();
           System.out.println("Testing5");
      pdfMerger = null;
      output.close();
           }//try
            catch (Exception e)
            {
            System.out.println(" Exception " + e.getMessage()) ;
            e.printStackTrace() ;
            }
            System.out.println("End") ;
      }

         public static void main(String[] argv) {
      PDFMerger xmlPublisher;
      xmlPublisher = new PDFMerger();
      xmlPublisher.pdfDocumentMerger();
      }
      }

       

       

      Error:

      Testing1
      Testing3http://docs.mytxi.com/downloads/Invoices/OE/06082013/02599553.PDF
      Testing4
      Jul 22, 2013 10:22:22 PM oracle.xdo.common.pdf.util.PDFDocMerger$PDFUtility <init>
      SEVERE: The first input to be merged has problem and caused stopping merging
      Jul 22, 2013 10:22:22 PM oracle.xdo.common.log.Logger log
      WARNING: java.lang.NullPointerException
      at oracle.xdo.template.pdf.util.PDFObjectDictionary.<init>(PDFObjectDictionary.java:36)
      at oracle.xdo.common.pdf.util.PDFDocMerger$PDFUtility.checkIfDupFields(PDFDocMerger.java:2438)
      at oracle.xdo.common.pdf.util.PDFDocMerger$PDFUtility.processWithNoOut(PDFDocMerger.java:2932)
      at oracle.xdo.common.pdf.util.PDFDocMerger.generateMergedPDF(PDFDocMerger.java:623)
      at oracle.xdo.common.pdf.util.PDFDocMerger.mergeDocs(PDFDocMerger.java:551)
      at oracle.xdo.common.pdf.util.PDFDocMerger.process(PDFDocMerger.java:506)
      at xxtxi.oracle.apps.ar.iex.server.PDFMerger.pdfDocumentMerger(PDFMerger.java:24)
      at xxtxi.oracle.apps.ar.iex.server.PDFMerger.main(PDFMerger.java:40)

      Exception java.lang.Exception: Document #2 looks corrupted.
      oracle.xdo.XDOException: java.lang.Exception: Document #2 looks corrupted.
      at oracle.xdo.common.pdf.util.PDFDocMerger.process(PDFDocMerger.java:510)
      at xxtxi.oracle.apps.ar.iex.server.PDFMerger.pdfDocumentMerger(PDFMerger.java:24)
      at xxtxi.oracle.apps.ar.iex.server.PDFMerger.main(PDFMerger.java:40)
      End
      Process exited with exit code 0.

       

       

      It would be great, if any one provide solution on this issue.

       

       

      Thanks,

      Irfan.