4 ms·
Can the PDF be compressed with, say, 7z?
by MaxBarraclough 8y ago
Can the PDF be compressed with, say, 7z?
- Fnoord 8y agoYes it can be compressed (I just tried simple /usr/bin/zip w/o flags on a 10 MB PDF with results of ~10% file saving), but then it has to be uncompressed before usage. Its better to use some kind of transparent mechanic from within the OS (e.g. filesystem or compact.exe/CompactGUI [1]). [1] https://github.com/ImminentFate/CompactGUI https://github.com/ImminentFate/CompactGUI
- MaxBarraclough 8y agoNeat, I didn't know Windows 10 has an improved compression system. I presume it only works with NTFS? Surprised the page doesn't say.
- Fnoord 8y agoYep, NTFS-only. The GUI is just a frontend for the Windows command compact.exe which does mention NTFS-only [1] [2] [1] https://www.petri.com/compress-files-with-compact-exe https://www.petri.com/compress-files-with-compact-exe [2] https://stackoverflow.com/questions/7928840/how-to-use-compact-exe-the-default-windows-compression-in-a-batch-file https://stackoverflow.com/questions/7928840/how-to-use-compa...
- MaxBarraclough 8y agoHaving just googled it, I'm surprised to see that ext4 doesn't support compression. I presume that's for simplicity?
- Fnoord 8y agoI suppose, yes. Its also an older FS which largely has backwards compatibility. You could ask Theodore Ts'o, the principal author of extXfs. I suppose you already read this one [1] [1] https://serverfault.com/questions/617648/transparent-compression-filesystem-in-conjunction-with-ext4 https://serverfault.com/questions/617648/transparent-compres...
- MaxBarraclough 8y agoI hadn't, thanks for the link. I'm not particularly knowledgeable about filesystems, or indeed of deep Linux matters in general, but the idea of layering ZFS and ext4 strikes me as the bad kind of 'cute' solution. If you want compression, ext4 surely isn't the place to start.
- rzzzt 8y agoIt seems to be a front-end for compact.exe, which exposes the on-the-fly compression feature of NTFS.
- MaxBarraclough 8y agoIndeed, I hadn't meant to imply otherwise. I like the tool though. Couldn't get compact.exe to work, it reported compressing 0 of the files in the directory. CompactGUI worked fine though. Maybe it invokes compact.exe once per file, rather than across the directory.
- kccqzy 8y agoPDF internally contains compression (though your particular PDF may not use it). Running a well optimized PDF over 7z is like compressing a movie with 7z: you get no space reductions. One interesting trick I've tried, however, is to first remove all internal compression from PDF streams, and then apply LZMA to the resulting PDF. This can be a good way to compress PDFs losslessly.
- MaxBarraclough 8y ago> first remove all internal compression from PDF streams, and then apply LZMA to the resulting PDF And this out-compresses PDF's internal compression? Could PDF be updated in future to support superior compression algorithms?
- kccqzy 8y agoYes it's theoretically quite possible. PDF is designed with extensibility in mind and it's very easy (technology-wise) to introduce new compression formats. The only difficulty is whether collectively we have the willpower to implement this in enough products and ship a new ISO standard. A less ambitious alternative might be to use something like zopfli. It is totally backwards compatible so it can be used today to compress PDFs better without sacrificing compatibility.