Question

I use this command link to merge bunch of ps file and convert them to pdf in linux but the size of output pdf file shrinks from page 2 and almost vanishes by the last page.

gs  -dBATCH -dSAFER -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=output.pdf input.rg=4.0*.ps

Any tips what could cause the problem and how could it get fixed?

Was it helpful?

Solution

convert each ps file into pdf separately.

i=1
ls *4.0*.ps |while read line
do
  gs  -dBATCH -dSAFER -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=new.${i}.pdf ${line}
  i=$(($i+1))
done

Then use pdftk-server (http://www.pdflabs.com/tools/pdftk-server/) to merge all pdf files into one pdf.

pdftk new.*.pdf output output.pdf
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top