General information
Category:
COM/DCOM and OLE Automation
Thanks, Perry. It turns out that I needed both your suggestion & John Harvey's. John's suggestion provided a much cleaner means of printing the document, but on some PC's it didn't activate the distiller to generate a .pdf from the .ps file. Your suggestion completed the picture, activating the distiller to generate the .pdf file. For some reason, possibly due to different versions of the installed distiller, I needed to change the "PDFDistiller.PDFDistiller" to remove the trailing ".1" to make the code work on some PC's. (This is the "VersionIndependentProgID" in the registry; at least, it works now for the Adobe versions we have.) This is the final,(excerpted) working code. Thanks much to both of you!
IF NOT(.oWord.Visible)
.oWord.Visible = .T.
ENDIF
.oWord.PrintOut(.F., ,, cNetPDFName+".PS", ,,,,,, .T.)
oDistiller = CREATEOBJECT("PDFDistiller.PDFDistiller")
oDistiller.FileToPDF(cNetPDFName + ".PS", cNetPDFName + ".PDF", "")
oDistiller = .NULL.
IF FILE(cNetPDFName + ".PS")
DELETE FILE (cNetPDFName + ".PS")
ENDIF
IF FILE(cNetPDFName + ".LOG")
DELETE FILE (cNetPDFName + ".LOG")
ENDIF
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only