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

Implement write support for compressed object streams

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.8.8, 1.8.9, 2.0.0
    • None
    • Writing
    • None
    • PDFBox 1.8.8, Java8u25, Windows 8.1

    Description

      I am using PDFBox 1.8.8 to manipulate existing PDF files. After saving a document, the output file becomes several times larger than the original. This is undesirable.

      How to reproduce my problem:

      In the following code, PDFBox simply loads an existing PDF and then save it. Nothing else is done. Yet the file size still becomes several times larger.

      import java.io.*;
      import org.apache.pdfbox.pdmodel.*;
      import org.apache.pdfbox.exceptions.*;
      
      class Test 
      {
          public static void main(String[] args) throws IOException, COSVisitorException {
      
          PDDocument document = PDDocument.load("input2.pdf");
          document.save("input2-after-save.pdf");
          document.close();       
          }
      }   
      

      Attached are two sample PDF files. input2.pdf is an original, unprocessed PDF. input2-after-save.pdf is processed by the code above. After processing, file size increases from 416kB to 1.25MB.

      Attachments

        1. input2-after-save.pdf
          1.25 MB
          Tilman Hausherr
        2. input2.pdf
          416 kB
          Tilman Hausherr

        Activity

          People

            Unassigned Unassigned
            brianlwh Brian Liu
            Votes:
            10 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: