Compress PDF files without Ghostscript
Solution 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.
Solution 2
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
user547995
Updated on September 18, 2022Comments
-
user547995 over 1 year
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 :/
-
David Foerster over 6 yearsWhat makes you believe that you can't legally use Ghostscript on your web server for commercial purposes? According to
/usr/share/doc/ghostscript/copyright
it's licensed with a combination of AGPL v3, BSD 3-clause, GPL v2, GPL v3, LGPL v2.1 and Apache 2.0 all of which allow you to use it on a web server for any purpose free of charge (as long as you publish any changes that you make to the code base in the case of AGPL). I'd vote to close as unclear if that were possible with the open bounty.
-
-
user547995 over 6 yearsI already tried pdftk, which needs a commercial licence as well
-
Hiwa Amiri over 6 yearsspecialised fonts will always be a problem in compressing pdf, even Ghostscript cannot compress with all fonts. you will have to do it via trial and error method. there are several apps in repos pdfsam, gscan2pdf, scantailor. try and see if anything helps you
-
user547995 over 5 yearsI asked for a way without gs originally, your solution uses ghostscript (
gs
)