BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Dear SAS experts,

Is it possible to justify an appearance of an image in pdf document.

For example :

ods pdf file="c:\file.pdf" style=D3d;
ods escapechar="^";

proc print data=sashelp.class ;
style(table)={preimage="c:\image.jpg^justify=r^scale^x=2in"};
run;

ods _all_ close;


But the Picture still appears on a centre of the pdf page. Is it possible to justify it to the right position of the document.

Thank you in advance.
3 REPLIES 3
Cynthia_sas
SAS Super FREQ
Hi!
I think that the problem is that your preimage is putting the image into the boundary of the table and the whole table is centered by default. The table is not the same as the document -- only something in a TITLE statement or an ODS PDF TEXT = statement would go into the top of bottom of the document.

You can use preimage in a title statement like this:
[pre]
options nodate nonumber;
ods pdf file='c:\temp\imgtitle.pdf';

title1 'title1 -- image will be underneath title1';
title2 j=r '^S={preimage="c:\temp\kermit.jpg"} ';
ods escapechar='^';
proc print data=sashelp.class;
run;
ods _all_ close;
title;
[/pre]

BTW, when using images for the preimage tag, I use a Paint program to make sure my image is the size I want BEFORE I use it in the preimage attribute. This is because PDF and RTF destinations convert the image to an internal format and I have always had better results if the image is the right size beforehand.

I don't generally use D3D style with PDF because D3D colors the whole background gray and I don't like the way it looks. I prefer SASWEB or the default PDF style (PRINTER style) with PDF. Just my preference.

Good luck,
cynthia
ScottH_SAS
SAS Employee
I concur with Cynthia and found only using ods text statements or title statements was I able to justify an image.

I looked into modifying proc template like this:

proc template;
define style needpreimage;
parent=styles.printer;
style table from table /
preimage=''
pretext='This is pretext for the table. ';
end;
run;

but the preimage field only takes a file name or URL.

Scott
deleted_user
Not applicable
Dear Scott and Cynthia,
thanks a lot for your help 🙂
I did not know that there is a possibility to attache an image in the TITLE statement.

Thanks,
best regards.
Sarunas

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 949 views
  • 0 likes
  • 3 in conversation