[Gambas-user] How to reduce the size of PDFs generated with PDFSurface/Cairo
Claus Dietrich
claus.dietrich at freenet.de
Wed Oct 11 19:42:13 CEST 2023
Hi Fabien and Voutt
Am 10.10.23 um 10:00 schrieb Fabien Bodard:
> I use this old class in my project to generate simple picture pdf.
>
Am 10.10.23 um 13:04 schrieb vuott--- via User:
> Ehmmm...I got this simple and short code by using GhostScript external
> resources:
Thanks a lot for sharing your solutions. I put both into my treasure
box. They provided me with the confidence that I am not on the wrong
track. The PDFWriter class is a real PDF "killer class". Its scope of
capabilities is amazing and worth a very detailed look. Voutt's solution
is actually doing what I needed in my program. It does the same as my
single line Shell command. Here an example of my Shell command for a PDF
scanned with 300 dpi (A4 size) converted to 150dpi (=/ebook):
gs -dBATCH -dNOPAUSE -q -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=842
-sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -sOutputFile=outputpath.pdf
inputpath.pdf
All relevant parameters (width, height, resolution, input.pdf-path,
output.pdf-path) can of course be inserted by a Subst command.
Best regards
Claus
More information about the User
mailing list