BookmarkSubscribeRSS Feed
mazz
Calcite | Level 5

bRecursive = False
sFolder = "D:\Users\gci0mxm\Desktop\Test"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oWord = CreateObject("Word.Application")
oWord.Visible = True

Set oFolder = oFSO.GetFolder(sFolder)
ConvertFolder(oFolder)
oWord.Quit

Sub ConvertFolder(oFldr)
For Each oFile In oFldr.Files
If LCase(oFSO.GetExtensionName(oFile.Name)) = "rtf" Then
Set oDoc = oWord.Documents.Open(oFile.path)
Str = left(oFile,instr(1,oFile,".")-1)
oWord.ActiveDocument.SaveAs Str & ".pdf", 17
oDoc.Close
End If
Next

If bRecursive Then
For Each oSubfolder In oFldr.Subfolders
ConvertFolder oSubfolder
Next
End If
End Sub

 

I have created vbs file in linux server but I can't able to run inside the linux server. 

Can you help me to run vbs file in linux server or any other alternate solutions for generating pdf from rtf in SAS (HMS/cloud).

 

6 REPLIES 6
Kurt_Bremser
Super User

You need a VB runtime executable on Linux. Your admins for the SAS server can help you in this regard. And you must be able to run external commands (SAS system option XCMD set), for which you also need your SAS admins.

Kurt_Bremser
Super User

But this

Word.Documents.Open

makes me suspect that you actually use Word for the conversion. Word is only available on Windows.

LibreOffice is available on Linux and can do such conversions from the commandline, IIRC.

Reeza
Super User
If you don't have permissions you may be able to add ODS PDF statements depending on the code used to have a PDF generated instead of RTF.

VBS typically doesn't run on Linux, usually a different approach is used.
Sajid01
Meteorite | Level 14
vbs does not run in the Linux environment.
If your objective is to convert rtf to pdf in a Linux environment there are command line utilities available to do the job. Speak to the Linux team for assistance.

SimonDawson
SAS Employee

This is not anything related to SAS Administration nor Deployments. The only thing roughly making this something interesting to SAS users in this community is your question is about doing something with data on a SAS hosted platform.

 

There is nothing built into any SAS product to do this. If the source of the RTF is SAS ODS, simply update the program to use a PDF destination in addition to RTF. If the rtf file is produced outside of SAS then your only chance would be to find a package supported by Red Hat that can accomplish this.

 

My quick search reveals there is a possibility for LibreOffice to have an ability to take an RTF files and convert it to a PDF. See the --convert-to argument in the LibreOffice documentation here.

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1113 views
  • 1 like
  • 5 in conversation