How to Reduce File Size of PDF Version of a Live Script?

20 次查看(过去 30 天)
I have a live script (*.mlx) file that is about 800 kB. When I "save as PDF", the PDF file is almost 4 MB.
Now, I understand that my Live Script generates several plots, so I think that is why the file size is so bloated.
However, I would like some options to reduce this size. For example, the figures need not be at maximum quality. Also, if it takes less memory to save them as a raster scan (e.g., a *.PNG) instead of a vector graphic (e.g., a *.EPS), I would like to be able to do so. [That's just an example; I just want a means to reduce file size.]
(To answer why I care: the Live Script is part of a deliverable MATLAB toolbox (*.mltbx), and the file size of the package is important. I don't want to add 4 MB unless there's no other choice.)
My backup option is to only deliver the *.MLX file and not the *.PDF (right now we deliver both), but many users like the *.PDF version because it shows the outputs without having to run the code, and it shows what the outputs look like without errors.

采纳的回答

Nick Patterson
Nick Patterson 2019-8-2
One person suggested using an external tool (I was trying to find a MATLAB setting).
I found the following Bash command worked amazing (form 3007 kB to 277 kB):
  • gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output_small.pdf input_large.pdf
The image quality drops substantially, but the text and text colors all look great. The figures are still good enough, and a file size reduction factor of 10 is impressive. This is exactly what I needed.

更多回答(1 个)

Lilian Smith
Lilian Smith 2019-7-31
if you want to comoress your pdf , try FoneDog PDF Compressor

类别

Help CenterFile Exchange 中查找有关 Printing and Saving 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by