Um aus einem existierenden WORD Dokument ein PDF zu erzeugen, kann man dieses neuere VBS Script verwenden:

Der Aufruf mittels GuiXT erfolgt über folgenden Befehl:

callvbs "DocToPdf" "C:\Temp\Word.doc" "C:\Temp\Portal.pdf"

VBS Script:

Function DocToPdf( docInputFile, pdfOutputFile )
Dim fileSystemObject
 Dim wordApplication
 Dim wordDocument
 Dim wordDocuments
 Dim baseFolder
 Const wdFormatPDF = 17
Set fileSystemObject = guixt.CreateObject("Scripting.FileSystemObject")
 Set wordApplication = guixt.CreateObject("Word.Application")
 Set wordDocuments = wordApplication.Documents
docInputFile = fileSystemObject.GetAbsolutePathName(docInputFile)
 baseFolder = fileSystemObject.GetParentFolderName(docInputFile)
If Len(pdfOutputFile) = 0 Then
 pdfOutputFile = fileSystemObject.GetBaseName(docInputFile) + ".pdf"
 End If
If Len(fileSystemObject.GetParentFolderName(pdfOutputFile)) = 0 Then
 pdfOutputFile = baseFolder + "\" + pdfOutputFile
 End If
' Disable any potential macros of the word document.
 wordApplication.WordBasic.DisableAutoMacros
Set wordDocument = wordDocuments.Open(docInputFile)
 ' See http://msdn2.microsoft.com/en-us/library/bb221597.aspx
 wordDocument.SaveAs pdfOutputFile, wdFormatPDF
wordDocument.Close WdDoNotSaveChanges
 wordApplication.Quit WdDoNotSaveChanges
' Set wordApplication = Nothing
 ' Set fileSystemObject = Nothing
' wordDocument.Close(0)
 ' wordApplication.Quit
End Function

Empfehlen