How can I compress many PDF Files into a single 7z using LZMA in JAVA

2.4k views Asked by At

I'm trying to Zip many PDF files (representing tne same report containing same images and titles. Only some numbers differ from a PDF to another ) into a single "7z" (or any other extention) file using LZMA.

I'm using the java lzma SDK (which functions with only one file and creates only one result file).

Notice that I tried to compress my PDFs (60 files) with 7-zip, and the size (of all files ) decreased from 133Mo to 1,7Mo. I want to implement this on Java.

Thank you very much for help.

4

There are 4 answers

1
Matt Ball On

Does it have to be 7z? What about a regular-ol' zip? TrueZip is excellent for this.

0
prunge On

The LZMA library LZMA-java can create lzma files. If you combine this with TarArchiveOutputStream from Apache Commons Compress library you can create a .tar.lzma file, an archive readable by 7-zip and many other archiver programs that uses LZMA compression. It will also give you solid compression, which it sounds like is what you want if the PDF files are very similar.

The java lzma SDK you are using will probably work just as well as LZMA-java, I only have experience with LZMA-java.

0
wtablet On

it is more a question than an answer:

processing a pdf with 7zip I only get the correct number of pages, but all are empty.....

My goal is a password proteced stick with important documents of all kinds. As I did not get an answer one the portableapps forum I now use bitlocker on windows 8.1.

0
Xian Stannard On

There's a Java port of 7zip on sourceforge. I know it exist but not much more.