Ask Your Question

converting ps file to pdf

asked 2019-04-29 10:26:57 -0500

RJG@PSM gravatar image

When plotting dynamic simulations I prefer to generate ps type of files (like the resolution).did anyone find an easy way to convert *.ps to a *.pdf file? I tried using os and ps2pdf but it does no work, it does not give any error message but also does not create the pdf file.
the code could not be simpler.

import os os.system ('ps2pdf dynamicplot.pdf')

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2019-05-14 10:52:54 -0500

drsgao gravatar image

updated 2019-05-15 03:37:20 -0500

Is PS Post Script? If it is then there are a lot of options. One of then is ImageMagick, which you can run in command line. It can also convert SVG to EMF (inkScape can also do it), helps when you have to use MS Word.

A simpler way is to just use GhostScript (the command line is simpler and it's free also, like ImageMagick and inkScape). Here are the steps:

  1. Download and install it from the official web : GhostScript
  2. Add the "bin" and the "lib" folder of the installed GhostScript to the "PATH" environmental variable. This makes the cmd able to find the utility we need to use later. If you do not add the paths, you can still call the utility by using the full path.
  3. After adding to "PATH" (assuming Windows and enough user right), open a cmd window in your target PS file folder.
  4. Use the cmd line: "ps2pdf output.pdf"

There is quite a good tutorial here : How To Convert PostScript (eps/ps) to PDF with Ghostscript on Windows 10

In Python, you could use something like to run the cmd, or make a buch of cmd strings, write them into a temp CMD/BAT file; then use Python to run that temp file and delete it after finish.

The doct for the "ps2pdf" utility is here :

edit flag offensive delete link more


thank you. I did not know of ImageMagick. I was trying to do it first with Python but when executing the two lines illustrated above I get nothing, not even an error message, may be it is something very small that I am overlooking (with google I found very similar codes that seems to work)

RJG@PSM gravatar imageRJG@PSM ( 2019-05-14 13:42:23 -0500 )edit

what is the ImageMagick (using ImageMagick-7.0.8-Q16) command line to convert to aa.pdf?

jconto gravatar imagejconto ( 2019-05-14 22:36:17 -0500 )edit

Actually, now I think it is easier just to use GhostScript (simpler cmd). Download and install it first, then add its "bin" and "lib" folder path to the environ. variable; them, call it like "ps2pdf outputFile.pdf". I am gonna edit my answer for it.

drsgao gravatar imagedrsgao ( 2019-05-15 03:23:21 -0500 )edit

answered 2019-04-30 19:49:18 -0500

jconto gravatar image

ps2pdf has been reported as problematic under windows.
One other method is to use Distiller, an application that comes with Adobe Acrobat Standard or the Pro version. PSSPLT creates the *.ps file and distiller grab the ps filename to create a pdf file. You can set watch folders that when a ps file 'arrives' (save folder used by PSSPLT), it gets converted to pdf automatically, avoiding user intervention. Additional code would move the pdf files to the final folder destination. Distiller can also run from the command line, therefore it can be called by the same application that called PSSPLT, and convert the ps file to pdf as part of a loop process.

A second option is to use python to extract data from the *.out files and plot them using matplotlib, saving the picture to pdf format. The user will have to set/deal with plotting options such as titles, legends, curves per plot, plots per page, etc. "Channels" is a tool that will create pdf for selected channels set by the user. Search for channels in this forum for downloading.

edit flag offensive delete link more


Thank you. I used Distiller in a previous job but as far as I know it has been discontinued more than 10 years ago. I was looking for the option in which I do not need to be extra for software I rarely use. do you know where to get distiller from? thanks in advance

RJG@PSM gravatar imageRJG@PSM ( 2019-05-14 10:04:53 -0500 )edit

Distiller comes with Adobe Acrobat Standard or the Pro version.

jconto gravatar imagejconto ( 2019-05-14 12:03:10 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower


Asked: 2019-04-29 10:26:57 -0500

Seen: 66 times

Last updated: May 15