<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to insert and control the image size of a .jpg in ods layout in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/820898#M34867</link>
    <description>&lt;P&gt;Good afternoon,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to insert a text and picture into a pdf file. My code so far looks like this&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;options orientation=portrait
		papersize=A4
		nodate
		topmargin=.001in
		bottommargin=.001in
		leftmargin=.001in
		rightmargin=.001in;
ods noproctitle;
ods escapechar="^";

title;
footnote;

ods pdf file="J:\Learning SAS\Example.pdf";
ods layout start width = 19cm height = 28cm ; 
ods region y=2cm x=2cm width=6cm; 
ods text="Some Random Information:";
ods region width=0.5cm height=0.25cm;
ods text= '^{style[preimage="C:/Users/WissMit/Desktop/example jpg.jpg"]}';
ods layout end;
ods pdf close; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And the Output looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Example Output.PNG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72804i7A23F9CDFE62BB5F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Example Output.PNG" alt="Example Output.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, the PDF looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Example pdf.PNG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72805i0E4B96CA6A45AEC4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Example pdf.PNG" alt="Example pdf.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Somehow the .jpg is missing. Does anyone have a clue what I am missing? In several articles it always looks so easy... Furthermore, I would like to have control over the image size. Is there a way to control the size without adjusting it beforehand?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jun 2022 12:33:37 GMT</pubDate>
    <dc:creator>_Manhattan</dc:creator>
    <dc:date>2022-06-29T12:33:37Z</dc:date>
    <item>
      <title>How to insert and control the image size of a .jpg in ods layout</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/820898#M34867</link>
      <description>&lt;P&gt;Good afternoon,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to insert a text and picture into a pdf file. My code so far looks like this&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;options orientation=portrait
		papersize=A4
		nodate
		topmargin=.001in
		bottommargin=.001in
		leftmargin=.001in
		rightmargin=.001in;
ods noproctitle;
ods escapechar="^";

title;
footnote;

ods pdf file="J:\Learning SAS\Example.pdf";
ods layout start width = 19cm height = 28cm ; 
ods region y=2cm x=2cm width=6cm; 
ods text="Some Random Information:";
ods region width=0.5cm height=0.25cm;
ods text= '^{style[preimage="C:/Users/WissMit/Desktop/example jpg.jpg"]}';
ods layout end;
ods pdf close; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And the Output looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Example Output.PNG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72804i7A23F9CDFE62BB5F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Example Output.PNG" alt="Example Output.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, the PDF looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Example pdf.PNG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72805i0E4B96CA6A45AEC4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Example pdf.PNG" alt="Example pdf.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Somehow the .jpg is missing. Does anyone have a clue what I am missing? In several articles it always looks so easy... Furthermore, I would like to have control over the image size. Is there a way to control the size without adjusting it beforehand?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 12:33:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/820898#M34867</guid>
      <dc:creator>_Manhattan</dc:creator>
      <dc:date>2022-06-29T12:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert and control the image size of a .jpg in ods layout</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/820908#M34868</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt;I notice that you are writing the PDF to your J drive but the image is on your C: drive. Did you have error messages in your log? Perhaps something like this or another warning that indicates output will be suppressed?&lt;BR /&gt;&lt;STRONG&gt;WARNING: The absolute region was too small to accommodate the output supplied for the PDF&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;destination. Output will be suppressed.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;That's usually what causes no output to be produced. When I tried a simplified form of your code (switching CM to IN and using my image, I was able to create PDF output as shown below.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1656509951736.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72806i71EFC0F5D1221BFF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1656509951736.png" alt="Cynthia_sas_0-1656509951736.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;When I use ODS TEXT to a specific destination, I like to be sure to use ODS PDF TEXT= or ODS RTF TEXT= to make sure that I am not accidentally writing my text to a destination that's open, but isn't the ultimate output I want. As you can see in the code, I'm writing the output to one folder, but getting the image from another folder. I only had a PNG to use, but it worked for me with simplified and tweaked code. The only other thing I added was a {NEWLINE 1} after the first line of text. I usually do that because I like to have control over the line feeds.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I do not think you can use your ODS statements to resize the image. My experience with using preimage is that I need to make sure the image is the size I want before using the image in the PREIMAGE style override. You might wish to look in the documentation or open a track with Tech Support.&lt;BR /&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 13:42:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/820908#M34868</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2022-06-29T13:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert and control the image size of a .jpg in ods layout</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/820912#M34871</link>
      <description>&lt;P&gt;Give this code below a go, if it works fine. Otherwise we might need some more coding. The image will automatically scale to the size of the region you define. The bordercolor and borderwidth are not really need, it is just to show the size of the region. I would also recommend to only use the ODS PDF desination and no other.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options orientation=portrait
		papersize=A4
		nodate
		topmargin=.001in
		bottommargin=.001in
		leftmargin=.001in
		rightmargin=.001in;
ods noproctitle;
ods escapechar="^";

title;
footnote;

ods pdf file="c:\temp\sas2pdf_example.pdf";
ods layout start width = 19cm height = 28cm ; 
ods region y=2cm x=2cm width=6cm; 
ods text="Some Random Information:";
ods region y=4cm x=2cm width=2cm height=2cm style={bordercolor=red borderwidth=10px backgroundimage="c:\temp\bird.jpg" };
ods text=" ";
ods layout end;
ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 14:06:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/820912#M34871</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2022-06-29T14:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert and control the image size of a .jpg in ods layout</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/820936#M34873</link>
      <description>&lt;P&gt;Just for curiosity sake, why are your paper margins in inches when all the other measures are in CM?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 15:06:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/820936#M34873</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-06-29T15:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert and control the image size of a .jpg in ods layout</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/821047#M34875</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32"&gt;@BrunoMueller&lt;/a&gt;:&lt;BR /&gt;  That's cool. My JPG image resized but the PNG image did not. And good idea to use backgroundimage instead of preimage. &lt;BR /&gt;Thanks for the example,&lt;BR /&gt;Cynthia</description>
      <pubDate>Wed, 29 Jun 2022 23:58:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/821047#M34875</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2022-06-29T23:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert and control the image size of a .jpg in ods layout</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/821069#M34876</link>
      <description>That is due to the article I was building the code with. But as I am more familiar with cm, it seemed somehow easier to work with cm for specific objects (e. g. ods text) and use the "template" from the paper which used inches.</description>
      <pubDate>Thu, 30 Jun 2022 07:31:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/821069#M34876</guid>
      <dc:creator>_Manhattan</dc:creator>
      <dc:date>2022-06-30T07:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert and control the image size of a .jpg in ods layout</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/821077#M34877</link>
      <description>&lt;P&gt;Thank you so much Bruno! That worked for me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; But I've still got two questions as I am not sure if I understand everything thats going on in the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Why do I need to include the 'ods text = " " ' and 'backgroundimage' statement? I am a bit frustrated that the code didnt work out with 'pre/postimage' and I do not get why it doesn't. I would really like to understand what the ods text statement is doing there (as it doesn't work without it)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- May seem a bit redundant as I was the one putting it there in the first place, but: Do I need the whole 'options' to 'footnote' part? The results appear to be the same and I was just following instructions out of an article (I attached it, in case anyones interested, see p. 4)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 08:07:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/821077#M34877</guid>
      <dc:creator>_Manhattan</dc:creator>
      <dc:date>2022-06-30T08:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert and control the image size of a .jpg in ods layout</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/821083#M34878</link>
      <description>&lt;P&gt;Hi Cynthia,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for your reply! Your code seems to work aswell, but I am not able to customize the image size (as you already stated) so I am sticking with brunos approach. Anyways, thank you for the hints with the ods pdf text statement &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Jakob&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 08:54:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/821083#M34878</guid>
      <dc:creator>_Manhattan</dc:creator>
      <dc:date>2022-06-30T08:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert and control the image size of a .jpg in ods layout</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/821094#M34880</link>
      <description>ODS TEXT is needed so we actually create some content in the region.&lt;BR /&gt;&lt;BR /&gt;The options and footnote statement are not needed for the example. Setting papersize, orientation and margins do affect the result. To position something using ODS LAYOUT ABSOLUTE I recommend to the set the proper margins. Then the X= and Y= will be measured from the margins settings.</description>
      <pubDate>Thu, 30 Jun 2022 10:02:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/821094#M34880</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2022-06-30T10:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert and control the image size of a .jpg in ods layout</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/916775#M41026</link>
      <description>&lt;P&gt;Make sure the path to your image is correct. Double-check the file location, and maybe try using a relative path. Consider the image format – the code suggests a .jpg, but the file extension in your text might be a typo (".jpg.jpg"). Ensure consistency. As for controlling image size without pre-adjusting, you can try the width and height options in your ods text statement.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 12:59:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/916775#M41026</guid>
      <dc:creator>KerryLuis</dc:creator>
      <dc:date>2024-02-19T12:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert and control the image size of a .jpg in ods layout</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/917922#M41084</link>
      <description>&lt;P&gt;For example: scss Copy code ods text='^{style[preimage="C:/Users/WissMit/Desktop/example.jpg" width=200px height=150px]}'; Feel free to experiment with those values to get the desired size.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And when you need to &lt;A href="https://jpeg-optimizer.com/" target="_self"&gt;compress image&lt;/A&gt;, you can just use JPEG Optimizer tools or functions within SAS.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 16:29:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-insert-and-control-the-image-size-of-a-jpg-in-ods-layout/m-p/917922#M41084</guid>
      <dc:creator>KerryLuis</dc:creator>
      <dc:date>2024-02-26T16:29:21Z</dc:date>
    </item>
  </channel>
</rss>

