0

When I open some PDFs (that were created with Tex) as text files I noticed that sometimes the content is more or less human readable. For some documents I can read almost everything, other documents contains only something like /Length, /Type /Page, endstream or endobj for example but the rest is not readable.

Apparently this can be controlled in Tex with the \pdfcompresslevel command.

But I wonder: what is the recommended setting for a document (e.g. a scientific paper)?

Are there advantages to having the raw PDF file as human readable as possible (I assume that this however increases the file size of the PDF)? Or is it better to have as little as possible readable? Or something in between?

What are the advantages/disadvantages of these options?

3
  • 3
    uncompressing is mainly useful for debugging. For normal uses I wouldn't change the defaults. Aug 1, 2021 at 16:33
  • 1
    @SampleTime, though you can people hardly ever will view a pdf file in an ASCII editor. E.g. you can also store images, e.g. paper scans, as pdf ...
    – MS-SPO
    Aug 1, 2021 at 16:34
  • PDFs can almost always be uncompress with tools like pdftk or qpdf, so there is no real need to change the default before hand.
    – DG'
    Aug 1, 2021 at 22:56

1 Answer 1

3

If you take a peek at the PDF specification you'll see that it is a language for specifying page layout. The "programs" in PDF (that is what e.g. pdflatex writes) are some sentences giving stuff like fonts to use, and exact positions on the page, and much (perhaps most) is more or less verbatim text to be displayed. You can define macros to do much stuff, e.g. writing some repetitive text or package common settings. But in PDF you can also write programs displaying arbitrary curves on the page, or paint a picture by placing coloured dots.

I'm sure you'll find the PDF file fragment generated, say, by some complex table or hairy mathematical formulae, or even just text where TeX' line filling algorithm gets a real workout, rather less than human-readable.

For most intents and purposes, consider it as an opaque format, much like the binary output of your compiler. You can coax many compilers to give assembly language output, but you'd hardly ever want to read it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .