Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-4475

PDFMergerUtility is very slow, almost in dead loop

    XMLWordPrintableJSON

Details

    Description

      When use PDFMergerUtility to merge PDF file, it is very slow to merge the struct tree. It seems that it in a dead loop.

      Test code:

      package com.test;
      
      import java.io.IOException;
      
      import org.apache.pdfbox.multipdf.PDFMergerUtility;
      
      
      public class TestMergeUtil {
      
        public static void main( String[] args ) throws IOException {
          PDFMergerUtility merger = new PDFMergerUtility();
          merger.addSource( "D:\\probe\\TourInventory_TourInventory_report.PDF" );
          merger.addSource( "D:\\probe\\TourInventory_TourInventory_report.PDF" );
          merger.setDestinationFileName( "D:\\probe\\TourInventory_TourInventory_report_merged.pdf" );
          merger.mergeDocuments();
        }
      }
      
      

      But after I comment bellow code, it can merge fast, but the merged PDF file size is very large.

      Attachments

        1. screenshot-1.png
          83 kB
          Derek Liu
        2. TourInventory_TourInventory_report.pdf
          1.75 MB
          Derek Liu
        3. image-2019-02-27-15-43-42-304.png
          192 kB
          Derek Liu

        Activity

          People

            tilman Tilman Hausherr
            liu1985629 Derek Liu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: