Um aus einem existierenden WORD Dokument ein PDF zu erzeugen, kann man dieses Java Script verwenden:
Der Aufruf mittels GuiXT erfolgt über folgenden Befehl:
calljs "DocToPdf" "C:\Temp\Word.doc" "C:\Temp\Portal.pdf"
Java Script:
function DocToPdf(docInputFile, pdfOutputFile) { var fileSystemObject; var wordApplication; var wordDocument; var wordDocuments; var baseFolder; var wdFormatPDF = 17; fileSystemObject = guixt.CreateObject("Scripting.FileSystemObject"); wordApplication = guixt.CreateObject("Word.Application"); wordDocuments = wordApplication.Documents; docInputFile = fileSystemObject.GetAbsolutePathName(docInputFile); baseFolder = fileSystemObject.GetParentFolderName(docInputFile); if (!pdfOutputFile) { pdfOutputFile = fileSystemObject.GetBaseName(docInputFile) + ".pdf"; } if ((fileSystemObject.GetParentFolderName(pdfOutputFile).length) == 0) { pdfOutputFile = baseFolder + "\\" + pdfOutputFile; } // Disable any potential macros of the word document. wordApplication.WordBasic.DisableAutoMacros(); wordDocument = wordDocuments.Open(docInputFile); // See http://msdn2.microsoft.com/en-us/library/bb221597.aspx wordDocument.SaveAs(pdfOutputFile, wdFormatPDF); var WdDoNotSaveChanges = 0; wordDocument.Close(WdDoNotSaveChanges); wordApplication.Quit(WdDoNotSaveChanges); };