0
votes

While trying to create a pdf from ps2pdf command on SUSE v12 (tried on centos 7 too), the resulting image is cropped. Command -

convert atms_npp.omgnbc_region4_fr2.png file.ps
ps2pdf file.ps file.pdf

If convert command is used, the resulting file is correct. -

 ps2pdf file.ps file_conv.pdf

Do i need to provide additional flags to ps2pdf command ?. I would like to avoid hardcoding resolution with ps2pdf (example: -sPAPERSIZE=) as it is possible that the input png have different resolution.

Please let me know if i can provide more information on this issue.

Here are relevant files - https://bitbucket.org/puneet336/ps2pdf/src/master/.

1
There's no possible way anyone can help you with this problem without seeing the original PostScript file. It would probably also be a decent idea to mention the operating system, and the version of Ghostscript you are using, as well as any back channel outptu from Ghostscript. - KenS
Thanks & Sorry. i had uploaded files on bitbucket, forgot to share the link. will update my post. - puneet336

1 Answers

0
votes

Your PostScript program doesn't request a media size. In the absence of a media size request Ghostscript uses its default, the exact value of which which depends on the operating system and the presence or not of libpaper.

Adding -sPAPERSIZE does not 'hardcode the resolution' it simply sets the media size. You're going to have to use that, or the DEVICEWIDTHPOINTS/DEVIEHEIGHTPOINTS settings to tell Ghostscript that you want to use some size other than the default.

Although it doesn't affect this file, you are also using an old version of Ghostscript, 9.15. The current version is 9.23 and will be superseded by 9.24 in about a month. Your version is 3 years old.