<?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 Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230476#M268042</link>
    <description>&lt;P&gt;I need both rtf and ods pdf files. I was&amp;nbsp;given the ods rtf and proc report by the company and I just started working for an they have been manually making the pdf files. There are over 10 rtf files that are generated by this code and I thought using X commander would be easier than using ods pdf because I would have to customize each ods pdf code to fit the different rtf files.&lt;/P&gt;</description>
    <pubDate>Sun, 18 Oct 2015 12:28:27 GMT</pubDate>
    <dc:creator>daszlosek</dc:creator>
    <dc:date>2015-10-18T12:28:27Z</dc:date>
    <item>
      <title>Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230279#M268036</link>
      <description>&lt;P&gt;Hello everyone!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to convert a .RTF file into a .PDF file. I created the RTF with ODS RTF and proc report. I tried using ODS PDF, but the columns come out pretty weird so I thought using X command would be easier, the problem is, I can't figure out which executable &amp;nbsp;in Microsoft Office10 if the correct one for the x command. Is anyone familair with doing this? Here is the code I have so far:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;x '"C:\Program Files\Office\Office14\_______.exe" c:\report\temp.rtf d:\report\tempxx.pdf /Y';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2015 13:38:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230279#M268036</guid>
      <dc:creator>daszlosek</dc:creator>
      <dc:date>2015-10-16T13:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230297#M268037</link>
      <description>&lt;P&gt;Sounds like a "clean" Microsoft question.&lt;/P&gt;&lt;P&gt;You may be better off searching for the aswer at support.office.com or other MS focused sites.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2015 14:19:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230297#M268037</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-10-16T14:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230396#M268038</link>
      <description>&lt;P&gt;Is there a reason why you don't use ODS PDF directly with PROC REPORT?&lt;/P&gt;</description>
      <pubDate>Sat, 17 Oct 2015 04:00:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230396#M268038</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-10-17T04:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230469#M268040</link>
      <description>&lt;P&gt;I totally agree with what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi﻿&lt;/a&gt;'s question implies: Try a bit harder and make it work with ODS PDF instead of going for work-arounds too early.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But just for fun here a way of how to do it. It needs Word 2010 or higher installed on the machine where you execute the SAS code.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let RTF=C:\temp\test6.rtf;
%let PDF=C:\temp\test6.pdf;
%let vbscript=C:\temp\test6.vbs;

ods rtf file="&amp;amp;RTF";
proc print data=sashelp.class;
run;
ods rtf close;

filename vbscript "&amp;amp;vbscript";
data _null_;
  file vbscript;
  put
      "Const WORD_PDF = 17"
    / "Const WORD_IN=""&amp;amp;RTF"""
    / "Const PDF_OUT=""&amp;amp;PDF"""
    / "Set objWord = CreateObject(""Word.Application"")"
    / "objWord.Visible = False"
    / "Set objDocument = objWord.Documents.Open(WORD_IN,,False)"
    / "objDocument.SaveAs PDF_OUT, WORD_PDF"
    / "objDocument.Close False"
    / "objWord.Quit"
    ;
run;
filename vbscript;

options symbolgen;
data _null_;
  /* execute vbs */
  call system("&amp;amp;vbscript");
  /* clean up: delete rtf &amp;amp; vbs */
  call system("del /q &amp;amp;vbscript");
  call system("del /q &amp;amp;RTF");
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Oct 2015 08:42:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230469#M268040</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-10-18T08:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230475#M268041</link>
      <description>&lt;P&gt;Good idea! I have also posted it on the microsoft forums but I keep on getting asked why am I not manually opening the rtf and turning it into a pdf- which I could do, but the whole point it to automate the process.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Oct 2015 12:24:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230475#M268041</guid>
      <dc:creator>daszlosek</dc:creator>
      <dc:date>2015-10-18T12:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230476#M268042</link>
      <description>&lt;P&gt;I need both rtf and ods pdf files. I was&amp;nbsp;given the ods rtf and proc report by the company and I just started working for an they have been manually making the pdf files. There are over 10 rtf files that are generated by this code and I thought using X commander would be easier than using ods pdf because I would have to customize each ods pdf code to fit the different rtf files.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Oct 2015 12:28:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230476#M268042</guid>
      <dc:creator>daszlosek</dc:creator>
      <dc:date>2015-10-18T12:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230477#M268043</link>
      <description>&lt;P&gt;Hello Patrick,&lt;/P&gt;
&lt;P&gt;I will try this on Monday morning and see if it works! &amp;nbsp;I have replied to SASKiwi's question as to why I dont just use ods PDF above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you all for your input and help- seriosuly I wonderful forum,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Donal S.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Oct 2015 12:32:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230477#M268043</guid>
      <dc:creator>daszlosek</dc:creator>
      <dc:date>2015-10-18T12:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230518#M268044</link>
      <description>&lt;P&gt;OK, but it still might be worth a quick test of direct PDF as you may find you only need to change your ODS statement. If not then revert to your original plan.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2015 01:11:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230518#M268044</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-10-19T01:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230539#M268045</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/52055"&gt;@daszlosek﻿&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Report writing is not what I'm normally doing so it can be that I miss the point. On a "high level" it's quite simple to add an additional output destination as demonstrated&amp;nbsp;in below code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume if you have embedded output destination specific formatting in your Proc Report then it's another story.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let RTF=C:\temp\test6.rtf;
%let PDF=C:\temp\test6.pdf;

ods _all_ close;
ods rtf file="&amp;amp;rtf";
ods pdf file="&amp;amp;pdf";
proc print data=sashelp.class;
run;
ods _all_ close;
ods listing;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2015 09:39:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/230539#M268045</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-10-19T09:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/287884#M268046</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick﻿&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Patrick,&lt;/P&gt;&lt;P&gt;I tried your code and found it works perfect when&amp;nbsp;the path name does not contain space. Can you help me how to specify the path name with space? i.e. I:\Study Documents\test.rtf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Emma&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 17:40:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/287884#M268046</guid>
      <dc:creator>Emmayao</dc:creator>
      <dc:date>2016-07-28T17:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/287954#M268047</link>
      <description>&lt;P&gt;Spaces and even worse '&amp;amp;' need just some additional quoting as done below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let RTF=C:\temp\test &amp;amp; test\test6.rtf;
%let PDF=C:\temp\test &amp;amp; test\test6.pdf;
%let vbscript=C:\temp\test &amp;amp; test\test6.vbs;

/** no changes below the line required */
%let rtf=%unquote(%str("&amp;amp;rtf"));
%let pdf=%unquote(%str("&amp;amp;pdf"));
%let vbscript=%unquote(%str("&amp;amp;vbscript"));

ods rtf file=""&amp;amp;RTF"";
proc print data=sashelp.class;
run;
ods rtf close;

filename vbscript ""&amp;amp;vbscript"";
data _null_;
  file vbscript;
  put
      "Const WORD_PDF = 17"
    / "Const WORD_IN="&amp;amp;RTF""
    / "Const PDF_OUT="&amp;amp;PDF""
    / "Set objWord = CreateObject(""Word.Application"")"
    / "objWord.Visible = False"
    / "Set objDocument = objWord.Documents.Open(WORD_IN,,False)"
    / "objDocument.SaveAs PDF_OUT, WORD_PDF"
    / "objDocument.Close False"
    / "objWord.Quit"
    ;
run;
filename vbscript;

options symbolgen;
data _null_;
  /* execute vbs */
  call system(""&amp;amp;vbscript"");
  /* clean up: delete rtf &amp;amp; vbs */
  call system("del /q "&amp;amp;vbscript"");
  call system("del /q "&amp;amp;RTF"");
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jul 2016 20:48:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/287954#M268047</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2016-07-28T20:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/288208#M268048</link>
      <description>&lt;P&gt;Thank you so much. It works great!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Emma&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2016 18:09:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/288208#M268048</guid>
      <dc:creator>Emmayao</dc:creator>
      <dc:date>2016-07-29T18:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/336161#M268049</link>
      <description>&lt;P&gt;Hi Patrick,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please help me how we can use this code to convert txt files to pdf&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;at the same timce can we give pagenation in output pdf by using vbscript ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 11:38:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/336161#M268049</guid>
      <dc:creator>RajasekharReddy</dc:creator>
      <dc:date>2017-02-27T11:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/336384#M268050</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/20574"&gt;@RajasekharReddy&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please don't post new questions into an existing thread but post a new question and copy/paste a reference link to the existing thread.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS has a ODS PDF destination so not sure if you need to use any non-SAS tools at all. Just post your question into forum "ODS and Base Reporting".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will also need to provide a bit more detail of what you have and what you need; best already demonstrating some own work and thinking and if possible also providing sample data in form of a data step and then a description of the desired output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 23:54:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/336384#M268050</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-02-27T23:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/466167#M268051</link>
      <description>Hey, was wondering if the X command has worked for you as i too have a similar requirement.&lt;BR /&gt;&lt;BR /&gt;and the .exe you are looking for is the, switcherutility.exe. Correct me if i`m wrong.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thank You!</description>
      <pubDate>Wed, 30 May 2018 18:12:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/466167#M268051</guid>
      <dc:creator>PSP</dc:creator>
      <dc:date>2018-05-30T18:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/466207#M268052</link>
      <description>&lt;P&gt;Hello PSP!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If my memory serves me right I broke down and re-programmed the proc report for ODS PDF instead of the RTF file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best of luck,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;daszlosek&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 19:25:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/466207#M268052</guid>
      <dc:creator>daszlosek</dc:creator>
      <dc:date>2018-05-30T19:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using X Command to Convert RTF to PDF with MS10  Word Excecutable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/538890#M268053</link>
      <description>You saved my Day. It works like nothing else. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thank you very much!!</description>
      <pubDate>Wed, 27 Feb 2019 05:35:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-X-Command-to-Convert-RTF-to-PDF-with-MS10-Word-Excecutable/m-p/538890#M268053</guid>
      <dc:creator>Lenith</dc:creator>
      <dc:date>2019-02-27T05:35:26Z</dc:date>
    </item>
  </channel>
</rss>

