PDF: Creation, Manipulation and Compression using Command Line Interface

This forum is aimed at students with little or no programming experience. It aims to provide students with an understanding of the role computation can play in solving problems.
Forum rules
This forum aims to provide material related to computer programming languages, tools and designs.

PDF: Creation, Manipulation and Compression using Command Line Interface

Unread postby UCERD.COM » Sun Nov 02, 2014 10:54 am

Basic Usage
Convert PostScript to PDF:
Code: Select all
gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=fileout.pdf  filein.ps

Merge/combine PDF and/or PostScript files:
Code: Select all
gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=fileout.pdf  filein.ps filein2.pdf

Extract a page from a PostScript or a PDF document:
Code: Select all
gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dFirstPage=3 -dLastPage=3 -sOutputFile=fileout.pdf filein.ps

Compressing PDF File
Code: Select all
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=custom_sys.pdf custom_system.pdf

Additional Options: Compression Level

PDF optimization level selection options
Code: Select all
-dPDFSETTINGS=/screen   (screen-view-only quality, 72 dpi images)
-dPDFSETTINGS=/ebook    (low quality, 150 dpi images)
-dPDFSETTINGS=/printer  (high quality, 300 dpi images)
-dPDFSETTINGS=/prepress (high quality, color preserving, 300 dpi imgs)
-dPDFSETTINGS=/default  (almost identical to /screen)

Paper size selection options
Code: Select all
-sPAPERSIZE=letter
-sPAPERSIZE=a4
-dDEVICEWIDTHPOINTS=w -dDEVICEHEIGHTPOINTS=h (point=1/72 of an inch)
-dFIXEDMEDIA (force paper size over the PostScript defined size)

Other options
Code: Select all
-dEmbedAllFonts=true
-dSubsetFonts=false
-dFirstPage=pagenumber
-dLastPage=pagenumber
-dAutoRotatePages=/PageByPage
-dAutoRotatePages=/All
-dAutoRotatePages=/None
-r1200 (resolution for pattern fills and fonts converted to bitmaps)
-sPDFPassword=password
Please Promote Our Work and website through yoursocial and professional network. We would highly appreciate your help.
Find us on FaceBook,Like and Share Please
User avatar
UCERD.COM
Site Admin
Site Admin
 
Posts: 958
Joined: Wed Jun 20, 2012 3:01 pm
Location: Barcelona
Has thanked: 13 times
Been thanked: 14 times
Blog: View Blog (1)

Return to Computer Sciences & Programming

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest

cron