2

I am looking to reduce the file size of the final version of my thesis as much as possible without real hassle and any loss of quality. At the moment it is around 7 MB. I read much about it (pdfsizeopt, gs, PGF/TikZ, \pdfcompresslevel) but still feel like you can give helpful advice.

One main issue is the Libertinus font set, which adds up to 3 MB, and how to avoid this. Consequently I am looking for a way to embed my graphics without accumulating redundant font data.

Preconditions:

  • Loss in quality is generally no option for me since I am a perfectionist ;-)
  • Windows, TeXLive, pdflatex, KOMA Script, matplotlib, Libertinus font set. I own Adobe CS4 with Acrobat 9.0, PS, AI, ID, Affinity Suite and am experienced in (vector) graphics.

Relevant LaTeX packages:

\usepackage{siunitx}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[firstpage=true]{background} + setup
\usepackage{textgreek}
\usepackage[osf]{libertinus}
\usepackage{libertinust1math}
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
\usepackage[colorlinks=false, pdfborder={0 0 0}, unicode]{hyperref}

I import:

  • A background with many vector circles for my title pages
  • A Python generated .svg file, converted to .pdf for simplicity (not using .svg import in LaTeX; .svg is 600kB, .pdf 300kB.) I think I could shrink the effective file size by using less of the pattern and substitute the rest with transformed variants (like rotated or flipped); but that would require much work in LaTeX. Perhaps I could try to make a .pdf which can "deduplicate" that?
  • University's logo (PDF), text is already paths, 300kB. I could just manipulate the curves to be simpler, but that also would touch copyright, I think.
  • Two photos with some marks (vector). Done in Affinity Photo, exported as .pdf to keep vector marks. Photo data is compressed with JPG at export. Perhaps e.g. Adobe software could use JPG2000 algorithm to squeeze the last bits out of it? They are around 800kB now, perhaps I can reduce quality a bit more
  • A diagram, made with LucidChart. 32kB and strange.
  • Libertinus Sans` without special characters. Font file size (300 bits!) and AI say, that the text is also paths. Acrobat can copy the text, so I think there is a meta-overlay like in OCR documents. The embedded font and font shown when editing with Acrobat is Helvetica. SVG export has also text as paths. But ok, 32kB should not inflate my final PDF so much.
  • Two drawings made with Affinity Designer. 80kB, 62 kB from fonts: embedded subgroups of Libertinus Sans and Lato (Type 1) + Arial MT from embedded element (TrueType CID, Identity-H).
  • A figure made with some AngularJS package.HTML +CSS with JS, that generates a SVG element. When copying the SVG code from Chrome Inspector, I get errors in any other graphic software, even if handling CSS correctly. So I use print to PDF from Chrome and to some tweaks this Affinity Publisher then. File is 120kB with 100kB from Libertinus Sans (regular and italic)
  • Dozens of plots from matplotlib. I use text.usetex: True and a subset of my preamble to get my Libertinus look. Export as PDF, pdf.compress 9, font type 42 (as this shall make less trouble with later editing; but I will not need this I think). Each is around 1.6MB with 98% from fonts since Libertinus Sans and LibertinusT1Math are fully embedded. Using Acrobat optimizer, I get 1MB total (fonts subset, T1, for Sans additionally CID + Identity-H) but it breaks any whitespaces. And pdflatex does it job since the size does not accumulate obviously and there is just one fontset in Acrobat for each style.

One option is to use PGF/TikZ to get the plots into pdflatex with minor overhead. For my final version this is of course an option, for every day use I would prefer PDFs since I can quickly view and share them. xpdf export for PS does not work on Windows for me (running this on Linux is possible if it is worth it). But PS anyway seems to be odd if using pdflatex.

When finished, I definitely will try pdfsizeopt, gs and optimize in Acrobat. But some options break hyperlinks and bookmarks.

tl;dr Do you prefer PDF or SVG (and if possible PGF/TikZ) to get a small output PDF if handling large fontsets?

What I already read:

How to make the PDFs produced by pdfLaTeX smaller?

How to create small PDF files for the Internet

Reduce pdf file size for large image produced by pgfplots

How do I make smaller pdf file sizes with pdflatex? (Or, how do I make pdflatex use CFF fonts?)

moderncv - filesize of pdf too big

ACCakut
  • 31
  • 2
    So what if your thesis has ~7 MB? Is there a size limit? Even if you were able to bring it down to, say 6.2 MB without noticeable loss of quality, would anybody care? – Ingmar Aug 09 '22 at 15:32
  • No, there is no limit. It is 90% curiosity and learning for later publications. I personally do not like 20MB PDFs wasting my downloads folder and literature database.

    Once I hit 8MB, I cannot use our Rocket.Chat.

    – ACCakut Aug 09 '22 at 15:44

0 Answers0