Dear team,
We are creating password protected .pdf file by using SAS ODS. The size of pdf do vary, like some time pdf file having 2 pages , some time 3,4 and 5 pages.
I want to add images in the last page of password protected pdf file.
Kindly assist !!
Thanks in Advance..
Regards,
Sukhbir Singh
Mob: 95 82 85 38 56
Hi Cynthia,
Thanks for your response!!
I have applied in my code but it is not working. below is the sample code:
ods pdf text="~{newline 5}~S={JUST=C FONT_SIZE=12pt color=maroon }~{nbspace 75}* Account Summary *";
proc report data=temp1_0600
style(report)=[cellspacing=1 borderwidth=1 bordercolor=maroon textalign=c]
style(header)=[fontfamily="Abadi Extra Light" fontsize=1 Color=white textalign=c backgroundcolor=maroon]
style(column)=[fontfamily="Abadi Extra Light" fontsize=1 textalign=c ];
column OPENING_BALANCE TOT_DEBIT_AMT TOT_CREDIT_AMT CLOSING_BALANCE TRAN_COUNT;
define OPENING_BALANCE/'Opening Balance(INR)' display style(column)={cellwidth=1.5in just=right};
define TOT_DEBIT_AMT/'Total WithDrawals(INR)' display style(column)={cellwidth=1.7in just=right};
define TOT_CREDIT_AMT/'Total Deposits(INR)' display style(column)={cellwidth=1.5in just=right };
define CLOSING_BALANCE/'Closing Balance(INR)' display style(column)={cellwidth=1.5in just=right};
define TRAN_COUNT/'No. Of Transaction' display style(column)={cellwidth=1.5in just=right};
where ACC_NO="&ac";
/*compute after _page_ /style ={background=white preimage="/tmp/ippb1.jpg"};*/
/*endcomp;*/
Regards,
Sukhbir Singh
95 82 85 38 56
Hi: If you look at my example, I used preimage in a different way. The COMPUTE block has to write SOMETHING -- preimage applies to the text that's being inserted into the COMPUTE block area. The text can be a text string, as I show in the paper. Or, the text can be a space. But the COMPUTE block area has to have something in it. That's why I have a LINE statement that writes a space into the COMPUTE area. This worked for me in PDF, as you can see below:
I had my image in the c:\temp\output folder and that's the folder where I wrote the PDF file too. Here's the code I ran:
options topmargin=.75in bottommargin=.75in rightmargin=.25in leftmargin=.25in;
*** assumes that image and file are stored in same &OUTPATH folder;
*** image stored in c:\temp\output folder;
%let outpath=c:\temp\output;
ods pdf(id=px1) file="&outpath\example_COMPUTE_AFTER_PAGE.pdf";
proc report data=sashelp.shoes spanrows;
where region in ('Asia' 'Canada') and
product in ('Boot' 'Sandal' 'Slipper');
title 'Ex 2b) COMPUTE AFTER with image';
column region product sales returns Profit inventory PctInv ;
define region / group;
define product / group;
define profit / computed f=dollar14.;
define pctinv / computed f=percent9.2;
break after region/summarize;
rbreak after / summarize;
compute pctinv;
profit = sum(sales.sum,-1*returns.sum);
pctinv = sales.sum / inventory.sum;
endcomp;
compute after / style={background=white preimage="&outpath\shoe_zoo.png"};
line ' ';
endcomp;
run;
ods pdf(id=px1) close;
My code uses SASHELP.SHOES so you should be able to run it. I put the shoe_zoo.png file inside a zip archive (since the forum would not allow a PNG file to be attached to the post). You'll have to unzip and store the image file in the same location. Without data no one can test your code, so this is something for you to try. As you see from my screen shot, the COMPUTE after with an image worked for me in PDF. It should work for you. If not, you may want to open a track with Tech Support.
Also, I would recommend that you experiment with both the COMPUTE AFTER, and the COMPUTE AFTER _PAGE_ to see which one works with your data to put the image on the last page.
Cynthia
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.