The SAS Output Delivery System and reporting techniques

adding an image to ods output

Reply
New Contributor
Posts: 3

adding an image to ods output

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

Esteemed Advisor
Esteemed Advisor
Posts: 6,670

Re: adding an image to ods output

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.

Grand Advisor
Posts: 16,265

Re: adding an image to ods output

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.

http://analytics.ncsu.edu/sesug/2011/BB15.Welch.pdf

New Contributor
Posts: 3

Re: adding an image to ods output

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

Grand Advisor
Posts: 16,265

Re: adding an image to ods output

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.

New Contributor
Posts: 3

Re: adding an image to ods output

Apparently I can get adobe professional, so I'm going to run down that route.  Thank you again!

Post a Question
Discussion Stats
  • 5 replies
  • 531 views
  • 3 likes
  • 3 in conversation