Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Printing graphs to pdf under program control

From   Antoine Terracol <[email protected]>
To   [email protected]
Subject   Re: st: Printing graphs to pdf under program control
Date   Sun, 17 Oct 2004 14:56:37 +0200

Dear all,

As an alternative to Distiller, one can use the eps2pdf freeware
( which uses
ghostscript to convert files from eps to pdf.

It can be called from the command line.

The following piece of code defines a -epspdf- command that exports the
current graph into eps format, then converts it to pdf.

program define epspdf
graph export "`1'.eps"
winexec "C:\program files\eps2pdf\eps2pdf.exe" /f="`1'"
di as text "(file `1'.eps converted to PDF format)"

When calling -epspdf-, do not specify the .eps extension :

. twoway scatter price mpg
. epspdf "C:\temp\my graphics\foo"
(file C:\temp\my graphics\foo.eps written in EPS format)
(file C:\temp\my graphics\foo.eps converted to PDF format)

both files foo.eps and foo.pdf are created in the C:\temp\my graphics\


Le 17/10/2004 13:37, Ian Watson a �crit :

> Dear Alan,
>   Thanks for looking into this. Your suggested syntax worked fine, but
>   Acrobat Distiller stayed open after processing the the eps file.
>   Fortunately, your suggested link to:
>   provided the answer. If one uses the command line
>   !"C:\Program Files\Adobe\Acrobat 5.0\Distillr\acrodist.exe"
>        /n /q /o c:\temp\mytest.pdf c:\temp\mytest.eps
>   (note the addition of /n /q) Distiller closes after processing the
>   eps file.
>   Also, if one uses winexec instead of the shell command (the !), then
>   one avoids the OS window opening also.
>   In the course of hunting down command line options (using Google) I
>   also came across a useful discussion on creating PDFs from PS files
>   under Linux:
>   Of course, as Kit mentioned, the other option is to move to a
>   Mac OS X system.
> Kind regards
> Ian

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index