The SAS Output Delivery System and reporting techniques

preserve transparency of gif file on ods pdf

Reply
Contributor
Posts: 50

preserve transparency of gif file on ods pdf

Hi all,

Someone knows if is possible to preserve transparency of a gif image when used in a proc report with ods pdf?
I want to avoid that annoying white square on the images without create an icon for each combination of colour.

Thanks in advance Smiley Happy

Sample code for test only:

filename rpt "d:\temp\test.pdf";

options nodate nonumber center ;
ods escapechar='^';
ods pdf file=rpt notoc uniform;

title;
footnote;

proc report data=sashelp.class nowd split="~"
style(report)={cellspacing=0 cellpadding=5 frame=box rules=group}
style(header)={background=cx009d57 foreground=cxffffff cellheight=0.25in vjust=middle just=center}
style(column)={cellheight=0.18in};

columns name age height weight;
define name / display
style(header)={pretext=" " preimage="D:\temp\16GreenCheck.gif" cellwidth=2in};
run;


ods pdf close;
SAS Super FREQ
Posts: 8,745

Re: preserve transparency of gif file on ods pdf

Hi:
I'm confused...the BACKGROUND color that you have for the Header cell is green. The checkmark is green. How will anyone even see a green checkmark against a green background (if transparency were used)??

When you use an image with ODS PDF or ODS RTF (no matter whether the image is an external image or the image is created with SAS/GRAPH), the image must be CONVERTED from whatever form it is in to an internal PDF or RTF format.

If I submit this program, using an image that I know has a transparent background (my image is taller than yours, so it needed a cellheight, too):
[pre]
options nodate nonumber center ;
ods escapechar='^';
ods html file="c:\temp\testimage_gif_trans.html";
ods pdf file="c:\temp\testimage_gif_trans.pdf" notoc uniform;

title;
footnote;

proc report data=sashelp.class nowd split="~"
style(report)={cellspacing=0 cellpadding=5 frame=box rules=group}
style(header)={background=pink foreground=cx000000 cellheight=0.25in vjust=middle just=center}
style(column)={cellheight=0.18in};

columns name age height weight;
define name / display
style(header)={pretext=" " preimage="c:\temp\trans_img.gif"
cellwidth=2in cellheight=2.75in};
run;

ods _all_ close;

[/pre]


Then what happens is that the HTML file uses the GIF image as it is and I do not see a white background under the image. However, in the PDF file, once the conversion is done, there is a white background behind my image. This difference between HTML and PDF indicates to me that the issue is that the conversion of the image into PDF format does not respect or use the transparency.

You might want to open a track to Tech Support on this question. I don't know whether there is a workaround (other than plopping the image onto a white background) or if this is known Adobe issue.

cynthia
Contributor
Posts: 50

Re: preserve transparency of gif file on ods pdf

Hello,

Thanks for the quick answer.

Smiley Happy yes green with green was not a good example.

It seams that is a common question over the web. i found the comment bellow and i think maybe the problem is the images that i use, but i need to make a few tests.

"Only certain graphic file formats offer transparency as an option. One example is the GIF format.

Although some scanning software can produce a GIF, none that I know of automatically remove the white background to produce transparency.

In other words, just because you have a GIF file doesn't’t mean it has transparency.

You’ll need to use a tool to remove the background to produce the transparent effect."

From : http://www.gregledet.net/?p=5
SAS Super FREQ
Posts: 8,745

Re: preserve transparency of gif file on ods pdf

That was the point of my test. I checked my image in Paint Shop Pro and made sure that my GIF did have a transparent background. The HTML file used the GIF with the transparent background. The PDF file showed a white background for the image, even though I KNOW that my image has a transparent background.

cynthia
SAS Employee
Posts: 50

Re: preserve transparency of gif file on ods pdf

We are working on transparency for our next release
Ask a Question
Discussion stats
  • 4 replies
  • 329 views
  • 0 likes
  • 3 in conversation