Hello All,
I have created a program in which I need to insert the company logo in the title (header) and also password protect the file.
When I run the program will no password option the ODS PDF generates the pdf file without any errors or issue in the pdf file. When I set the password in the program. the pdf file is generated and there are no errors or warnings in the log, but the pdf file do not contain the logo and the pdf reader shows error there is something wrong with the file please contact the person who created it.
This is the code which I'm using to create the header: (this is working fine)
options nodate nonumber orientation=portrait papersize=A4 ;
ods escapechar="^";
ods pdf file="&path\&fname" style=journal notoc startpage=no ;
title j=l f='Times New Roman' height=10pt "Sponsor: &sponsor";
title2 j=l f='Times New Roman' height=10pt "Project No.: &proj " j=c "Version No.: &ver" j=r '^S={preimage="&logo"}';
if i add password options (below code) then this code will run without errors but no image is inserted in the pdf.
options nodate nonumber orientation=portrait papersize=A4 pdfsecurity=high pdfpassword=(open="Awesomepassword");
Please help.
This looks like a bug. I'd contact tech support.
Your code works fine for me. Tested. The both SAS viewer screen, and pdf file opening after entering the password.
options nodate nonumber orientation=portrait papersize=A4 pdfsecurity=high pdfpassword=(open="Awesomepassword");
ods escapechar="^";
ods pdf file="C:\Users\Desktop\test\test.pdf" style=journal notoc startpage=no ;
title j=l f='Times New Roman' height=10pt "Sponsor:";
title2 j=l f='Times New Roman' height=10pt "Project No.:" j=c "Version No.: " j=r '^S={preimage="C:\Users\Desktop\test\logo.png"}';
proc print data=sashelp.class; run;
ods pdf close;
Result:
Hello A_Kh,
The issue is not of password protection, the file is opening but the logo is not inserted if set password in the program.
Is logo is inserted into your pdf after adding password options in the program? or any errors by pdf viewer is shown?
Yes, the logo does get inserted in password protected file as well.
The log is clean, pdf file opens without issue after entering the psswd.
Could it be smth to do with your PDF Viewer setting? I'm not good at it.
The logo I'm using is 3KB .png file.
Hello A_Kh,
Thanks for verifying the code.
The Issue seems to with some user policy/ rights in the company's SAS server.
When tested using a local machine and also by you. the program and pdf both are working fine.
waiting on internal IT Team, will respond after any progress.
## Also image size is not an issue tried image ranging for 90 X 50 px (~5 KB) to 1800 X 1000 px (~200 KB)
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.