I have a nice looking report that combines several procedures on one page. The ODS destination is PDF, and includes a small logo (PNG file) in the corner. I would like to include a map to the report. The maps have been provided to me in PDF format (the maps show the area in a county for various schools). I do not have an ability to get these map files in any other format than PDF.
I have not been able to include the PDF file into my reporting process. Is it possible to use a PDF file as the source in a pre/postimage statement?
My offending code looks like this:
ods region x=0.00cm y=0.0cm;
ODS PDF text="^S={preimage='e:\sasdata\SchoolProfile\Maps\033_Lee_HS.pdf?height=5.00cm&width=9.00cm'}";
ods pdf text =" ";
The error I'm getting is this:
ERROR: Unable to load image e:\sasdata\SchoolProfile\Maps\033_Lee_HS.pdf; default image will be used instead.
Am I barking up the wrong tree trying to include the PDF as an image file?
Thanks,
Brad
Yes. To my understanding a PDF file contains a lot of extra information that wouldn't be in a Jpeg for instance. Hence when it is attempted to be loaded as an image it fails. I would suggest getting the pucture out of your PDF file, some simple ways like Snipping Tool in Windows should do the trick. Just open the PDF, snip around the picture and save to file. You can then use that as a picture.
Do you have Adobe Professional? It might be worth it to go outside of SAS for this and append these PDF files into your report rather than take images and lose image quality.
Here's a paper on how to write a VB script called from SAS that will append the files if you need it as part of a process.
I'm working with the customer to get the image files in a "real" image file in place of the current PDFs.
To go into each PDF isn't a good option as there are about 200 schools and the boundaries change from time to time, and I don't want to "own" the process of making images from PDFs, although that is an option. The process to create the individual school reports as separate PDF pages is currently done in a macro, which just loops through a subset of schools, so getting the maps as images is really the best option....we'll see how that works out since the pdfs are apparently supplied by an outside vendor.
The adobe professional route might work as well, but I'll have to see what the appetite is to buy additional software. Thank you for the reference article, I'll start running down that option while I wait to see what happens with the individual image files.
Thanks all,
Brad
There are free versions of PDF manipulation programs out there that can also do it, we just get Adobe PDF Professional so I've never bothered to explore it. If you have install privileges you can try them out.
Apparently I can get adobe professional, so I'm going to run down that route. Thank you again!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: