*--Note: GhostScript doesn't like long filenames. lcPsFile = ADDBS(JUSTPATH(SYS(16,0))) + "PsFiles\" + SYS(3) + ".ps" *--Use Word Automation to open the file, and print it to the PostScript file. #include "wdconst.h" Local oWord oWord=Createobject("word.application") oWord.documents.Open(tcDocFile) oWord.DisplayAlerts = 0 *--Don't set the printer unless we have to, as it can take a few seconds. IF ! "Generic PostScript Printer" $ oWord.ActivePrinter oWord.ActivePrinter = "Generic PostScript Printer" ENDIF *--NOTE: Oddly enough if the first parm is set to .T. (background printing) *--word will prompt when a document has information outside of the margins. oWord.ActiveDocument.PrintOut(.F.,,, lcPsFile) *--Close the document and Word. oWord.Documents(1).Close(wdDoNotSaveChanges) oWord.Quit(wdDoNotSaveChanges) *--Now call the GhostScript function that converts the PS file to PDF. DO Ps2Pdf WITH lcPsFile