>>FUNCTION PrintPDFReport >> LPARAMETERS lcReport, lcOutputFile, lcExtraReportClauses >> LOCAL lcOldPrinter >> >> * save old printer, will be restored in the end of routine >> lcOldPrinter = SET("printer",2) >> * create object of the class >> oPDFC = CREATEOBJECT("PDFCreator.clsPDFCreator","pdfcreator") >> * setup class parameters >> oPDFC.cStart("/NoProcessingAtStartup") >> oPDFC.cOption("UseAutosave") = 1 >> oPDFC.cOption("UseAutosaveDirectory") = 1 >> oPDFC.cOption("AutosaveFormat") = 0 >> * select PDFCreator as a default printer >> DefaultPrinter = oPDFC.cDefaultprinter >> oPDFC.cDefaultprinter = "PDFCreator" >> oPDFC.cClearCache >> ReadyState = 0 >> oPDFC.cOption("AutosaveFilename") = JUSTFNAME(lcOutputFile) >> oPDFC.cOption("AutosaveDirectory") = JUSTPATH(lcOutputFile)+'\' >> oPDFC.cprinterstop=.F. >> >> lcExtraReportClauses=IIF(EMPTY(lcExtraReportClauses),"",lcExtraReportClauses) >> >> REPORT FORM (lcReport) &lcExtraReportClauses TO PRINTER NOCONSOLE >> >> INKEY(5) >> * restore the old printer >> SET PRINTER TO NAME (lcOldPrinter) >> oPDFC.cDefaultprinter = DefaultPrinter >> oPDFC.cClearCache >> oPDFC.cClose() >> RELEASE oPDFC >>ENDFUNC >>>>