I have got some requirement in which we need to generate the PDF documents instead of the regular word documents. In Siebel, document server uses the Microsoft Office features to create.doc files, but how can we create the pdf dcoument from the .doc file?
The Idea is to use in-built pdf converter which comes with Microsoft Office 2007 software. The step by step instructions are given below to convert the .doc file which is generated by document server to .pdf file.
Step1: Create a custom button on any of the Proposal Applet.
Step2: Add below script behind the button. This script will be executed only when the document generation is completed.
var oWord = COMCreateObject("Word.Application");
oWord.Documents.Open(sFile);
oWord.ActiveDocument.Save();
var sNewFile = sFile.substr(0,sFile.lastIndexOf("\\")+1);
sNewFile = sNewFile+sDocName+".PDF";
oWord.ActiveDocument.SaveAs (sNewFile,17); // 17 is used for WdFormatPDF literal
oWord.ActiveDocument.Close();
oWord.Application.Quit();
RetValue = InvokeMethod("PutFile",sNewFile,"PPSLFileName");
PpslBC.SetFieldValue("PPSLFileExt","PDF");
Ppsl.WriteRecord();
Clib.remove(sFile);
Clib.remove(sNewFile); //Remove files from temp location
Compile above changes to the applet and run below steps to see the changes are affected.
Create a record in Proposal applet,select a template and click on generate document. Once the document is generated then click on custom button to convert the actual .doc file to .pdf file.
This script will work only if Word 2007 is installed on machine where application is running.