I am trying to create PDF reports in Stata (version 17) on Windows 11. I am creating separate reports for about 50 facilities contributing data to my project. For each facility there are 14 graphs for each of three separate years (2019, 2020, 2021). First, I combine the 14 smaller graphs into a single figure using graph combine for 2019, then again for 2020 and 2021. Therefore, I have three full page figures for each facility. My next step would normally be to export these using graph export as pdf files, open the three full page figures in Adobe Acrobat and combine them manually.
My question is whether this can be done through coding in Stata. I recently discovered putpdf. For example, here is the putpdf code for a facility named "site1" having three .png files for 2019, 2020 and 2021:
. putpdf clear
. putpdf begin
. putpdf paragraph, halign(center)
. putpdf image site1_19.png
. putpdf paragraph, halign(center)
. putpdf image site1_20.png
. putpdf paragraph, halign(center)
. putpdf image site1_21.png
. putpdf save site1_192021.pdf, replace
successfully created "C:/Users//Documents/site1_192021.pdf"
While this does work, it appears that putpdf can only handle graphs exported to a .png format which results in considerable lost resolution for my figures. For example, putpdf does not appear to handle tif images:
. putpdf clear
. putpdf begin
. putpdf paragraph, halign(center)
. putpdf image 121061_19.tif
failed to add image
So, my current plan is to manually combine the PDF files individually for the 50 facilities in order to conserve the high quality resolution, but I am hoping someone out there in Stata World may have encountered a similar issue and found a better solution.
Thanks,
Garth Rauscher
University of Illinois at Chicago School of Public Health
My question is whether this can be done through coding in Stata. I recently discovered putpdf. For example, here is the putpdf code for a facility named "site1" having three .png files for 2019, 2020 and 2021:
. putpdf clear
. putpdf begin
. putpdf paragraph, halign(center)
. putpdf image site1_19.png
. putpdf paragraph, halign(center)
. putpdf image site1_20.png
. putpdf paragraph, halign(center)
. putpdf image site1_21.png
. putpdf save site1_192021.pdf, replace
successfully created "C:/Users//Documents/site1_192021.pdf"
While this does work, it appears that putpdf can only handle graphs exported to a .png format which results in considerable lost resolution for my figures. For example, putpdf does not appear to handle tif images:
. putpdf clear
. putpdf begin
. putpdf paragraph, halign(center)
. putpdf image 121061_19.tif
failed to add image
So, my current plan is to manually combine the PDF files individually for the 50 facilities in order to conserve the high quality resolution, but I am hoping someone out there in Stata World may have encountered a similar issue and found a better solution.
Thanks,
Garth Rauscher
University of Illinois at Chicago School of Public Health
Comment