0

My org file consists of mainly images. The exported latex is ~60MB. Currently I'm using a subsequent ghostcript shell script to shrink the pdf's filesize to ~6MB. Does emacs offer some hidden superpower to achieve a similar result after exporting e.g. org exported pdf hook[0] ?

[0] pseudocode

1
  • Did you see the answer to this question? Did you try it? Did it work? Inquiring minds ...
    – NickD
    Commented Feb 26, 2022 at 23:20

1 Answer 1

1

Let's say your shell script is called pdf-compact and is invoked with the name of the PDF file:

pdf-compact myfile.pdf

It may replace myfile.pdf with a new version (maybe saving the original for safety until you are satisfied that it is safe), or it may produce a new file, say myfile-C.pdf (C for compact).

You can modify the org-latex-pdf-process variable like this:

(add to-list 'org-latex-pdf-process "pdf-compact %b.pdf" t)

The last argument t says to add the new element at the end of the list org-latex-pdf-process. The %b is replaced by the file base name (e.g myfile in the example above).

See the doc string of org-latex-pdf-process (C-h v org-latex-pdf-process) for other replacement values that are triggered by a %b-like mechanism.

Untested.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.