culturenomad.blogg.se

How to reduce size of pdf with ghostscript
How to reduce size of pdf with ghostscript








how to reduce size of pdf with ghostscript how to reduce size of pdf with ghostscript

Rem loop over all directories defined in filesDir arrayįor /f "tokens=2 delims=" %%d in ('set filesDir[') do ( Rem file prefix for new files (if they should be created) Rem new file be creation or input file overwrite If the outcomming sizes are not small enough play with these ghostscript command switch: -dPDFSETTINGS=/printer, it is explained below.

#HOW TO REDUCE SIZE OF PDF WITH GHOSTSCRIPT WINDOWS#

It will only overwrite the input pdf file if the new file is smaller in size.įurther the ghostscript command is substituted by a variable with the same name because under Windows it can be either gswin64c (64 bit) or gswin32c (32 bit). To select between these to options change the createNewPDFs variable to 1 (new files) or 0 (overwrite).īecause ghostscript can't write to the input file the output file will be written at the users temporary path ( %TEMP%) and moved to the original input file to overwite this file. I changed the script as requested by the comments to either write new pdf files or overwrite the input pdf file. fileabc.pdf with a new name: compr_fileabc.pdf.

how to reduce size of pdf with ghostscript

It will loop over all these directories and search for all pdf files in all directories including subdirectories.įor all found pdf files it will use this ghostscript command (GitHub) and output the file with name e.g. With the following script you can define all directories needed in the array variable filesDir.










How to reduce size of pdf with ghostscript