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 <terracol@univ-paris1.fr>
To   statalist@hsphsun2.harvard.edu
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
(http://www.ctan.org/tex-archive/support/eps2pdf/) 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)"
end




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\
folder.

Best,
Antoine.


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:
>
>   http://www.adobe.com/support/techdocs/321090.html
>
>   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:
>
>   http://www.pathcom.com/~kujira/pdf6.htm
>
>
>   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:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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