Skip to content

Instantly share code, notes, and snippets.

@cwg999
Created November 14, 2017 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwg999/0afe23840460ca9ff0ad9d59f43c1eb8 to your computer and use it in GitHub Desktop.
Save cwg999/0afe23840460ca9ff0ad9d59f43c1eb8 to your computer and use it in GitHub Desktop.
Ghostscript Node execFile (util.promisify) Compress PDF
await execFile(GHOST_SCRIPT_PATH,[
`-q`,`-dNOPAUSE`, `-dBATCH`,`-dSAFER `,
`-sDEVICE=pdfwrite`,
`-dCompatibilityLevel=1.3`,
`-dPDFSETTINGS=/screen `,
`-dEmbedAllFonts=true`,
`-dSubsetFonts=true`,
`-dColorImageDownsampleType=/Bicubic`,
`-dColorImageResolution=300`,
`-dGrayImageDownsampleType=/Bicubic`,
`-dGrayImageResolution=300`,
`-dMonoImageDownsampleType=/Bicubic`,
`-dMonoImageResolution=300`,
`-sOutputFile=${outputPath}`,
`${inputPath}`
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment