GhostScript Command

This doc describes tips on how to utilize command line Ghostscript client. Ghostscript is usually utilized like a standard engine on the inside different purposes (for seeing data files pertaining to example). Remember to consider the particular certification for anyone purposes pertaining to using Ghostscript throughout different contexts.

gpl-ghostscript-3_opt

The command range for you to invoke Ghostscript is basically a similar upon almost all techniques, although the title from the executable system per se could differ among techniques. As an illustration, for you to invoke Ghostscript upon unix-like techniques sort.

Use following commands to convert pdf:

  • Use follwoing command to convert pdf file to pdf with compatibility 1.4 and It will close auto rotate of pdf
    gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -dAutoRotatePages=/None -sOutputFile=/DESTINATION/OUTPUT.pdf /SOURCE/INPUT.pdf
    
  • Use following command to convert color pdf to grey scale
    gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite \ -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray \ -sOutputFile=/DESTINATION/OUTPUT.pdf /SOURCE/INPUT.pdf
    
  • Use following command to convert color pdf to cmyk
    gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite \ -sColorConversionStrategy=CMYK -dProcessColorModel=/DeviceCMYK \ -sOutputFile=/DESTINATION/OUTPUT.pdf /SOURCE/INPUT.pdf
    
  • Use following command to convert color pdf to image
    gs -q -dBATCH -dNOPAUSE -dFirstPage=1 -dLastPage=1 -sDEVICE=jpeg \ -r -sOutputFile=/DESTINATION/OUTPUT.jpg /SOURCE/INPUT.pdf
    
  • Use following command to normalize pdf using Ghostscript
    gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=/DESTINATION/OUTPUT.pdf /SOURCE/INPUT.pdf
    
  • Some time we need to set password in pdf files, so we can set password using following command:
    gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOwnerPassword=password -sUserPassword=passowrd -dAutoRotatePages=/None -sOutputFile=/DESTINATION/OUTPUT.pdf /SOURCE/INPUT.pdf
    
  • Note: We can open pdf using both (-sUserPassword & -sOwnerPassword) password. So If we want to give same password then we can set.

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

    The reCAPTCHA verification period has expired. Please reload the page.