4

I would like to compress PDF files in my Node.JS application which will be generated by electron. I tried to compress these files with Ghostscript which worked fine btw but I cannot use this commercially without paying for it.

Is there any good command line based solution alternative free for commercially use?

PS: I already tried compressing with LibreOffice Draw, but this cant handle included fonts :/

ponsfrilus
  • 596
  • 1
  • 5
  • 17

2 Answers2

3

You can use pdftk to compress a pdf using the following command

pdftk file1.pdf output file2.pdf compress

To this first, you need pdftk installed on you computer, install it by typing

    sudo apt-get update
    sudo apt-get install pdftk
1

What I got from this link is that you can use ghostscript in you application if you're going to use it as a library (i.e. you won't copy the source code of ghostscript into your own source code).

Even if you're going to modify ghostscript and use that modified version as a library, you will only have to make the source code of the modified ghostscript available.