<?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: WORD to PDF conversion in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73319#M15777</link>
    <description>If found this VBSCRIPT on the internet and somehow figured out a way to alter the registry to set the PDF Output Directory.  It works on my computer but I can't get visible=false to work.  I set PDF output to same directory as WORD docs but you can change that.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
filename FT66F001 'path to word docs';&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
   length path script filevar command $256;&lt;BR /&gt;
   path     = pathname('FT66F001');&lt;BR /&gt;
   script   = catx('\',pathname('WORK'),'DOC2PDF.vbs');&lt;BR /&gt;
   filevar  = script;&lt;BR /&gt;
&lt;BR /&gt;
   /* write the script */&lt;BR /&gt;
   file dummy1 filevar=filevar;&lt;BR /&gt;
   put path=:$quote256.;&lt;BR /&gt;
   infile cards eof=eof;&lt;BR /&gt;
   do while(1);&lt;BR /&gt;
      input;&lt;BR /&gt;
      put _infile_;&lt;BR /&gt;
      end;&lt;BR /&gt;
 eof:&lt;BR /&gt;
   /* close the script file by opening another, not used */&lt;BR /&gt;
   filevar = catx('\',pathname('WORK'),'DUMMY.vbs');&lt;BR /&gt;
   file dummy1 filevar=filevar;&lt;BR /&gt;
&lt;BR /&gt;
   /* look at the script, not necessary but may be useful */&lt;BR /&gt;
   infile dummy2 filevar=script end=eof;&lt;BR /&gt;
   file log ls=256;&lt;BR /&gt;
   do _n_ = 1 by 1 until(eof);&lt;BR /&gt;
      input;&lt;BR /&gt;
      put _n_ z3. +1 _infile_;&lt;BR /&gt;
      end;&lt;BR /&gt;
&lt;BR /&gt;
   /* call the script */&lt;BR /&gt;
   command = catx(' ','cscript //nologo',quote(strip(script)));&lt;BR /&gt;
   infile dummy3 pipe filevar=command end=eof length=l;&lt;BR /&gt;
   do until(eof);&lt;BR /&gt;
      input;&lt;BR /&gt;
      putlog _infile_;&lt;BR /&gt;
      end;&lt;BR /&gt;
   stop;&lt;BR /&gt;
   cards;&lt;BR /&gt;
Set objShell = WScript.CreateObject("WScript.Shell")&lt;BR /&gt;
&lt;BR /&gt;
hkey = "HKEY_CURRENT_USER\Software\Adobe\Acrobat Distiller\7.0\AdobePDFOutputFolder"&lt;BR /&gt;
hkey0 = hkey &amp;amp; "\"                '(Default)&lt;BR /&gt;
default = objShell.RegRead(hkey0) 'Save default &lt;BR /&gt;
&lt;BR /&gt;
WScript.Echo "Default=" &amp;amp; default &lt;BR /&gt;
&lt;BR /&gt;
hkey5 = hkey &amp;amp; "\5"&lt;BR /&gt;
objshell.RegWrite hkey5,path,"REG_SZ" 'PDF Path&lt;BR /&gt;
objshell.RegWrite hkey0,5,"REG_DWORD" 'Set as default&lt;BR /&gt;
WScript.Echo objshell.RegRead(hkey0) &amp;amp; " " &amp;amp; objshell.RegRead(hkey5) &lt;BR /&gt;
&lt;BR /&gt;
Set WordObj = WScript.CreateObject("Word.Application") &lt;BR /&gt;
WordObj.Visible = False&lt;BR /&gt;
wordObj.DisplayAlerts = False&lt;BR /&gt;
&lt;BR /&gt;
Set FS = CreateObject("Scripting.FileSystemObject") &lt;BR /&gt;
Set FD = FS.GetFolder(Path) 'collection of files in path&lt;BR /&gt;
&lt;BR /&gt;
For Each File In FD.Files &lt;BR /&gt;
    If Right(File.Name,3) = "doc" then &lt;BR /&gt;
        WordObj.Documents.Open(path &amp;amp; "\" &amp;amp; file.Name) &lt;BR /&gt;
        WordObj.ActivePrinter = "Adobe PDF" &lt;BR /&gt;
        WordObj.Options.UpdateFieldsAtPrint = False &lt;BR /&gt;
        WordObj.Options.PrintBackground = True &lt;BR /&gt;
        WordObj.Options.PrintReverse = False &lt;BR /&gt;
        WordObj.PrintOut &lt;BR /&gt;
        WordObj.Documents.Close &lt;BR /&gt;
        If Err.Number &amp;lt;&amp;gt; 0 then  &lt;BR /&gt;
            'MsgBox("error" &amp;amp; Err.Number &amp;amp; vbCR &amp;amp; filename &amp;amp; vbCR &amp;amp; Err.Description) &lt;BR /&gt;
            WScript.Echo "ERROR: " &amp;amp; err.number &amp;amp; " " &amp;amp; filename &amp;amp; " " &amp;amp; Err.Description&lt;BR /&gt;
            end if &lt;BR /&gt;
        End if &lt;BR /&gt;
    Next &lt;BR /&gt;
WordObj.Quit&lt;BR /&gt;
objshell.RegWrite hkey0,default,"REG_DWORD"&lt;BR /&gt;
objshell.RegDelete(hkey5)&lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Fri, 13 Feb 2009 06:11:43 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2009-02-13T06:11:43Z</dc:date>
    <item>
      <title>WORD to PDF conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73313#M15771</link>
      <description>Hi guys,&lt;BR /&gt;
&lt;BR /&gt;
To convert *.DOC files to *.PDF in SAS, I invoke the DDE "WINWORD|SYSTEM" and use WORD commands like fileopen, fileprint etc. But before that I need to open WORD and change the default printer to 'Adobe Pdf' and give the destination to save the PDF files.&lt;BR /&gt;
&lt;BR /&gt;
Is there a way I can change the default printer to 'Adobe pdf' and give the output destination in SAS? &lt;BR /&gt;
&lt;BR /&gt;
Thanks for your time!</description>
      <pubDate>Mon, 09 Feb 2009 18:34:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73313#M15771</guid>
      <dc:creator>NickR</dc:creator>
      <dc:date>2009-02-09T18:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: WORD to PDF conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73314#M15772</link>
      <description>I have an example of printing to an XPS file, but Acrobat PDF should be similar.&lt;BR /&gt;
&lt;BR /&gt;
put '[fileprintsetup .printer="Microsoft XPS Document Writer" .donotsetassysdefault=1]';&lt;BR /&gt;
put '[fileprint .appendprfile=0 .prtofilename="n:\xx.xps"]';</description>
      <pubDate>Tue, 10 Feb 2009 16:40:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73314#M15772</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-02-10T16:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: WORD to PDF conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73315#M15773</link>
      <description>Try using ODS.  It supports PDF output directly.</description>
      <pubDate>Wed, 11 Feb 2009 15:13:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73315#M15773</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2009-02-11T15:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: WORD to PDF conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73316#M15774</link>
      <description>Thanks for the info Urchin!&lt;BR /&gt;
&lt;BR /&gt;
I tried using the below code:&lt;BR /&gt;
&lt;BR /&gt;
  PUT '[FILEOPEN .NAME="' "&amp;amp;DIR\&amp;amp;FILENAME..DOC" '"]';&lt;BR /&gt;
  PUT '[FILEPRINTSETUP .PRINTER="ADOBE PDF" .DONOTSETASSYSDEFAULT=1]';&lt;BR /&gt;
  PUT '[FILEPRINT .APPENDPRFILE=0 .PRTOFILENAME = "' "&amp;amp;DIR\&amp;amp;FILENAME..PDF" '" ]'; &lt;BR /&gt;
&lt;BR /&gt;
I first two steps worked fine but somehow I am getting the following error message when executing the third step:&lt;BR /&gt;
&lt;BR /&gt;
When you create a PostScipt file you have to send the host fonts. Please go to the printer properties, "Adobe PDF Setting" page and turn off the option "Do not send fonts to Distiller".&lt;BR /&gt;
&lt;BR /&gt;
Does anyone know what might be causing this? &lt;BR /&gt;
&lt;BR /&gt;
thanks!</description>
      <pubDate>Wed, 11 Feb 2009 16:18:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73316#M15774</guid>
      <dc:creator>NickR</dc:creator>
      <dc:date>2009-02-11T16:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: WORD to PDF conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73317#M15775</link>
      <description>Thanks for the reply. Actually, I have so many WORD files which I have to convert to PDF programatically just by batch submitting the program. In short, I have to convert all WORD files in a folder to PDF.</description>
      <pubDate>Wed, 11 Feb 2009 16:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73317#M15775</guid>
      <dc:creator>NickR</dc:creator>
      <dc:date>2009-02-11T16:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: WORD to PDF conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73318#M15776</link>
      <description>-

Message was edited by: Nick R</description>
      <pubDate>Wed, 11 Feb 2009 20:46:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73318#M15776</guid>
      <dc:creator>NickR</dc:creator>
      <dc:date>2009-02-11T20:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: WORD to PDF conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73319#M15777</link>
      <description>If found this VBSCRIPT on the internet and somehow figured out a way to alter the registry to set the PDF Output Directory.  It works on my computer but I can't get visible=false to work.  I set PDF output to same directory as WORD docs but you can change that.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
filename FT66F001 'path to word docs';&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
   length path script filevar command $256;&lt;BR /&gt;
   path     = pathname('FT66F001');&lt;BR /&gt;
   script   = catx('\',pathname('WORK'),'DOC2PDF.vbs');&lt;BR /&gt;
   filevar  = script;&lt;BR /&gt;
&lt;BR /&gt;
   /* write the script */&lt;BR /&gt;
   file dummy1 filevar=filevar;&lt;BR /&gt;
   put path=:$quote256.;&lt;BR /&gt;
   infile cards eof=eof;&lt;BR /&gt;
   do while(1);&lt;BR /&gt;
      input;&lt;BR /&gt;
      put _infile_;&lt;BR /&gt;
      end;&lt;BR /&gt;
 eof:&lt;BR /&gt;
   /* close the script file by opening another, not used */&lt;BR /&gt;
   filevar = catx('\',pathname('WORK'),'DUMMY.vbs');&lt;BR /&gt;
   file dummy1 filevar=filevar;&lt;BR /&gt;
&lt;BR /&gt;
   /* look at the script, not necessary but may be useful */&lt;BR /&gt;
   infile dummy2 filevar=script end=eof;&lt;BR /&gt;
   file log ls=256;&lt;BR /&gt;
   do _n_ = 1 by 1 until(eof);&lt;BR /&gt;
      input;&lt;BR /&gt;
      put _n_ z3. +1 _infile_;&lt;BR /&gt;
      end;&lt;BR /&gt;
&lt;BR /&gt;
   /* call the script */&lt;BR /&gt;
   command = catx(' ','cscript //nologo',quote(strip(script)));&lt;BR /&gt;
   infile dummy3 pipe filevar=command end=eof length=l;&lt;BR /&gt;
   do until(eof);&lt;BR /&gt;
      input;&lt;BR /&gt;
      putlog _infile_;&lt;BR /&gt;
      end;&lt;BR /&gt;
   stop;&lt;BR /&gt;
   cards;&lt;BR /&gt;
Set objShell = WScript.CreateObject("WScript.Shell")&lt;BR /&gt;
&lt;BR /&gt;
hkey = "HKEY_CURRENT_USER\Software\Adobe\Acrobat Distiller\7.0\AdobePDFOutputFolder"&lt;BR /&gt;
hkey0 = hkey &amp;amp; "\"                '(Default)&lt;BR /&gt;
default = objShell.RegRead(hkey0) 'Save default &lt;BR /&gt;
&lt;BR /&gt;
WScript.Echo "Default=" &amp;amp; default &lt;BR /&gt;
&lt;BR /&gt;
hkey5 = hkey &amp;amp; "\5"&lt;BR /&gt;
objshell.RegWrite hkey5,path,"REG_SZ" 'PDF Path&lt;BR /&gt;
objshell.RegWrite hkey0,5,"REG_DWORD" 'Set as default&lt;BR /&gt;
WScript.Echo objshell.RegRead(hkey0) &amp;amp; " " &amp;amp; objshell.RegRead(hkey5) &lt;BR /&gt;
&lt;BR /&gt;
Set WordObj = WScript.CreateObject("Word.Application") &lt;BR /&gt;
WordObj.Visible = False&lt;BR /&gt;
wordObj.DisplayAlerts = False&lt;BR /&gt;
&lt;BR /&gt;
Set FS = CreateObject("Scripting.FileSystemObject") &lt;BR /&gt;
Set FD = FS.GetFolder(Path) 'collection of files in path&lt;BR /&gt;
&lt;BR /&gt;
For Each File In FD.Files &lt;BR /&gt;
    If Right(File.Name,3) = "doc" then &lt;BR /&gt;
        WordObj.Documents.Open(path &amp;amp; "\" &amp;amp; file.Name) &lt;BR /&gt;
        WordObj.ActivePrinter = "Adobe PDF" &lt;BR /&gt;
        WordObj.Options.UpdateFieldsAtPrint = False &lt;BR /&gt;
        WordObj.Options.PrintBackground = True &lt;BR /&gt;
        WordObj.Options.PrintReverse = False &lt;BR /&gt;
        WordObj.PrintOut &lt;BR /&gt;
        WordObj.Documents.Close &lt;BR /&gt;
        If Err.Number &amp;lt;&amp;gt; 0 then  &lt;BR /&gt;
            'MsgBox("error" &amp;amp; Err.Number &amp;amp; vbCR &amp;amp; filename &amp;amp; vbCR &amp;amp; Err.Description) &lt;BR /&gt;
            WScript.Echo "ERROR: " &amp;amp; err.number &amp;amp; " " &amp;amp; filename &amp;amp; " " &amp;amp; Err.Description&lt;BR /&gt;
            end if &lt;BR /&gt;
        End if &lt;BR /&gt;
    Next &lt;BR /&gt;
WordObj.Quit&lt;BR /&gt;
objshell.RegWrite hkey0,default,"REG_DWORD"&lt;BR /&gt;
objshell.RegDelete(hkey5)&lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 13 Feb 2009 06:11:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73319#M15777</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-02-13T06:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: WORD to PDF conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73320#M15778</link>
      <description>thanks so much. Will try this now.&lt;BR /&gt;
&lt;BR /&gt;
-Nick</description>
      <pubDate>Tue, 17 Feb 2009 16:58:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73320#M15778</guid>
      <dc:creator>NickR</dc:creator>
      <dc:date>2009-02-17T16:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: WORD to PDF conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73321#M15779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the easiest way of converting word to pdf in batch is using a third party software to do the job for you. Acrobat PDF is just one of the tool you can use to open the pdf and process pdf files.&lt;/P&gt;&lt;P&gt;i am using a simple and useful&lt;A href="http://www.rasteredge.com/how-to/csharp-imaging/pdf-convert-word/"&gt; pdf control c#&lt;/A&gt;&amp;nbsp; to do conversion job and view pdf documnets. hope it helps for you. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2013 07:46:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73321#M15779</guid>
      <dc:creator>lifemore</dc:creator>
      <dc:date>2013-08-27T07:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: WORD to PDF conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73322#M15780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can easily and successfully converts all word file with OLE objects, images, forms, graphs, hyperlinks, tables from word to PDF conversion software. I used&lt;/P&gt;&lt;P&gt;Kernel For Word to PDF software.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Nov 2013 10:46:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73322#M15780</guid>
      <dc:creator>sorenroma</dc:creator>
      <dc:date>2013-11-12T10:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: WORD to PDF conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73323#M15781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One vote for Kernel PDF &lt;SPAN style="color: #4f4f4f;"&gt;&lt;A href="http://www.rasteredge.com/solutions/image-converting/"&gt;&lt;SPAN style="color: #4f4f4f;"&gt;conversion&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt; software. It works great. But I did not know whether it allows us to give output destination in SAS?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2013 02:44:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WORD-to-PDF-conversion/m-p/73323#M15781</guid>
      <dc:creator>cathyhill</dc:creator>
      <dc:date>2013-12-04T02:44:33Z</dc:date>
    </item>
  </channel>
</rss>

