help for graphexportpdf

Improved support for saving graphs as pdf

graphexportpdf newfilename[, dropeps]


graphexportpdf is an alternative to the standard graph export syntax, which produces unsatisfactory pdf files in Mac and does not support pdf for Linux or Solaris at all. graphexportpdf provides superior pdf output for UNIX-like systems (sorry, no Windows support) by first saving as eps then translating to pdf.


The program works by first using Stata's excellent support for eps, then using the shell to convert eps to pdf. Because it relies on the shell for the latter step, the ado-file only runs on UNIX-like systems (Mac, Linux, Solaris). If run on a Windows computer it will just produce an eps.

"Replace" is assumed so both newfilename.eps and newfilename.pdf will be overwritten if they already exist.

This command runs slower than using "graph export newfilename.pdf" on Stata for Mac (the only version that supports that syntax), but the output is much more attractive, especially for line graphs and kernel density plots.

Options dropeps specifies that newfilename.eps (which is created as an intermediate step) will be deleted.


. graphexportpdf pricempg dropeps

. sysuse auto, clear . twoway scatter price mpg . graphexportpdf pricempg, dropeps


Gabriel Rossman, UCLA rossman@soc.ucla.edu

Also see

On-line: help for graph export, help for shell