Using pdftops and ps2pdf
- To convert pdf to eps file
pdftops -eps filename.pdf
Converts filename.pdf to filename.eps if there is only one page
- To extract few pages from a pdf file
pdftops -f fpn -l lpn filename.pdf - | ps2pdf - filename_ext.pdf
Extract pages from fpn to lpn in the filename.pdf file and save it as filename_ext.pdf.
fpn is the number of the first page and lpn is the number of the last page to be extracted from the filename.pdf file.
pdftops extracts specified pages as ps type and pipe to ps2pdf to convert to and save as pdf file.
Using Ghostscript
- Ghostscript can be used to merge different file types into a single file. The resulted file can be of any type based on the switch we use.
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -sOutputFile=file_new.pdf file1.pdf file2.ps file3.eps
-sDevice = pdfwrite (for merged pdf file), pswrite (for ps file), epswrite(for eps file) , psmono( for black and white ps file), etc.,
- To extract specific pages from a series of different file types
gs -sDEVICE=epswrite -dNOPAUSE -dBATCH -dSAFER -sOutputFile=file_ext%02d.eps 2page-file1.pdf 8page-file2.ps 1page-file.eps |
Extract page2 of file1.pdf , page8 of file2.ps and page1 of file3.eps and save as file_ext01.eps, file_ext02.eps and file_ext03.eps respectively