Hi! I'm testing the PDF compression feature in PDFCraft and I'm trying to understand how the different compression levels are expected to work.
I tested the Low compression option on a PDF containing a significant amount of content/images, but the resulting file was only about 1 MB smaller than the original.
For example:
Original PDF: XX MB
Low compression: XX MB
Reduction: ~1 MB
I investigated the Docker image and found that workers/compress.worker.js uses coherentpdf:
coherentpdf.compress(pdf);
coherentpdf.squeezeInMemory(pdf);
For low, it then generates and compresses object streams:
coherentpdf.toMemoryExt(
pdf,
false,
false,
false,
true,
true
);
From what I can see, this appears to optimize PDF streams and structure, but it does not seem to perform image downsampling or JPEG recompression.
I also noticed that the project includes PyMuPDF WASM, Pillow, OpenCV, and QPDF WASM, so I was wondering whether there is another image-compression step elsewhere in the application.
Questions
- Is the current
Low compression level expected to only perform structural/stream compression?
- Does PDFCraft currently perform any image downsampling or JPEG/PNG recompression when using
Low, Medium, or High?
- If not, is image recompression planned for the compression feature?
- What is the intended difference in compression behavior between
Low, Medium, and High?
- Is there a recommended way to achieve significantly smaller PDFs, especially for PDFs containing scanned pages or high-resolution images?
For example, I would expect something along these lines for image-heavy PDFs:
Low: aggressive image compression / downsampling
Medium: balanced compression
High: higher quality with moderate compression
Maximum: preserve original image quality
I'm asking because a PDF that is, for example, 30–50 MB may only become approximately 1 MB smaller with Low, which seems much less than what I would expect from a PDF compression tool.
Thanks!
Hi! I'm testing the PDF compression feature in PDFCraft and I'm trying to understand how the different compression levels are expected to work.
I tested the Low compression option on a PDF containing a significant amount of content/images, but the resulting file was only about 1 MB smaller than the original.
For example:
I investigated the Docker image and found that
workers/compress.worker.jsusescoherentpdf:For
low, it then generates and compresses object streams:From what I can see, this appears to optimize PDF streams and structure, but it does not seem to perform image downsampling or JPEG recompression.
I also noticed that the project includes PyMuPDF WASM, Pillow, OpenCV, and QPDF WASM, so I was wondering whether there is another image-compression step elsewhere in the application.
Questions
Lowcompression level expected to only perform structural/stream compression?Low,Medium, orHigh?Low,Medium, andHigh?For example, I would expect something along these lines for image-heavy PDFs:
I'm asking because a PDF that is, for example, 30–50 MB may only become approximately 1 MB smaller with
Low, which seems much less than what I would expect from a PDF compression tool.Thanks!