0

I am trying to compress the pdf files(sometimes images). I need a compressor in java which will help me compress my files. I need the size to be less than half the size of the original document. I tried deflator given in java apis. But it was not very successful. Please help me on this.

Droidme
  • 1,223
  • 6
  • 25
  • 45
  • 2
    There are hard limits on how much a given bunch of data can be compressed. The compressed size may not be smaller than the information content of the data, and that's the ideal result - real world results will be worse than that. It's entirely possible that the PDF files are already as compressed as they reasonably can be. (The PDF supports compression internally.) – millimoose Aug 13 '12 at 11:55

2 Answers2

5

You need to compress the images individually more than they are already (which can reduce quality) Trying to compress images with a general lossless compression program won't be very successful as the data is compressed already.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
1

I am sure you would have already explored open source solution but LZMA is one of the best in compressing the files to a greater extent. Try the Java library for 7zip in the below link.
http://www.7-zip.org/sdk.html

sundar
  • 1,760
  • 12
  • 28
  • 1
    Using LZMA would maybe help if the documents were mostly textual and not compressed already. As impressive as the algorithm is, I doubt it can recompress data with any significant space savings. – millimoose Aug 13 '12 at 11:56