Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: release: multiple graphs -> single PDF


From   "Kyle J. Foreman" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: release: multiple graphs -> single PDF
Date   Wed, 14 Oct 2009 14:15:38 -0700

I have written a program which allows you to automate the process of exporting all your graphs into a single PDF file. The resulting PDF is made from postscript files, so it's both high quality and low file size.

The first command, -pdfstart-, creates all the temporary files (the directories, the main .ps file, and a .do file) necessary for making the PDF. You input the path and filename of the pdf you want to create. You can optionally specify an alternate location for Acrobat Distiller (by default it looks for it in the Acrobat 9.0 program folder).

The second command, -pdfappend-, makes a .ps file out of whatever is open in the graph window and adds that .ps file as a new page in the main .ps file. Use this where you would normally use -graph export-.

The last command, -pdffinish-, runs Acrobat Distiller to turn the graphs into a single PDF. It then deletes all the temporary files that were created. You can optionally specify [, view] to open the PDF once it's complete.

The programs are located here:
http://staff.washington.edu/kfor/pdfappend.ado
http://staff.washington.edu/kfor/pdffinish.ado
http://staff.washington.edu/kfor/pdfstart.ado

An example of how to use the program would be:

sysuse auto
pdfstart using "C:/temp/auto_graphs.pdf", distexe("C:/Program Files/Adobe/Acrobat 9.0/Acrobat/acrodist.exe")
foreach var in price mpg rep78 headroom trunk {
	hist `var'
	pdfappend
}
pdffinish, view


Distiller will sometimes orient the PDF in the wrong direction, but this can easily be fixed by hitting shift+ctrl+R in Acrobat. Additionally, I have only tested this for Acrobat 9.0 (both 32 and 64-bit) on Windows (both XP and Server 2008). 


Kyle Foreman
[email protected]

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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