I've been running into a problem in web connection that might be a bug.
printReportToString()
This function works fine when the application is launched from the "Webpagoda - Start FoxPro IDE with Web Connection" environment but crashes when compiled into an executable.
The documentation is a bit scarce in this area, so it's entirely possible I'm doing it wrong (why would it work before compilation though?). Any guidance or advice would be greatly appreciated. Alternatively, is anyone able to use this function successfully from the exe file?
Cheers
Sure. But you may have issues with permissions. The account the application is running under has to have access to the Printer Spooler in Windows.
Also depends what PDF generator you're using...
+++ Rick ---
Even running the exe as an administrator is causing it to crash.
The code I'm using is:
oPDF=CREATEOBJECT("wwPdfPrinterDriver")
oPdf.cPrinterDriver = "Microsoft Print to PDF"
oPdf.nMaxWaitTime = 10000
To be clear, the PDF is created and returned to the browser but the exe crashes immediately afterwards. Any idea why this might be?
Cheers
Nope, no idea.
Is this a hard crash (ie. VFP is crashing)? If so you can look at FoxPro crash dump log and see what it says (I think it's the in VFP runtime install folder). If not then add a TRY/CATCH
around the code to see if you can catch the FoxPro error.
To me this sounds like a problem with the printer or printer driver from the FoxPro Report printing engine. Make sure your report doesn't have some funky printer information in embedded in it. In fact remove all printer information from the report.
Also make sure the FoxPro server is registered properly runs as SingleUse EXE if running in COM mode not multi-use. I've seen printer crashes related to threading issues (and it won't work running as a DLL server at all and fail in shared EXE server mode).
+++ Rick ---