Finally got around to getting 5.5 up and running, it's needed a fair bit of tweaking from the previous version,. but is working!
Question though, does PDF generation work with 5.5 ? If not, how do we generate reports?
Jun 23, 2011 at 7:24 PM
Same way as in earlier versions. You should be referring to the latest documentation for everything:
Reporting in AVFP or any vfp mtdll is accomplished by putting the SET PRINTER and REPORT FORM statements in a VFP COM EXE, creating that object from your main.prg, and calling the method that does the REPORT FORM from main.prg.
See the PDF routine in the avfpdemo5 application for an example of this.
GhostScript can be used to create PDF reports from regular VFP reports and AVFPdemo5 has some examples.
1.) Download and install AFPL Ghostscript 8.54
2.) Install a PostScript printer driver: Download the Driver
Download Adobe's self-installing executable PostScript driver, universal installer version 1.0.6 or later, for Windows 95/98/Me/NT/2000/XP. (You can browse for other versions of the driver on Adobe's web site.) Save the downloaded file, winsteng.exe, to a temporary
location, such as C:\TEMP.
You will also need a PostScript Printer Description (PPD) file. Use the Generic Colour PostScript PPD in the zip file defpscol.zip (included in the setup and on the web). Download and unzip this and extract the enclosed file, defpscol.ppd, to the same temporary
location as you downloaded the driver.
Installing the Driver:
* Find the file winsteng.exe which you downloaded earlier and double-click on it to run it
* Accept the license agreement
* Choose the connection type Local Printer (rather than Network Printer)
* When asked to choose a port to connect the printer to, choose FILE: (rather than COM1:, COM2:, etc.)
* When asked to choose a printer model, you can choose the option Generic PostScript Printer, but if you would like to print in colour as well as black and white, click on the Browse button and browse to the location where you unpacked defpscol.ppd earlier
and choose Generic Colour PostScript
* If asked, don't make this your default printer
* And don't try to print a test page yet
* If asked, say you do wish to configure your printer and check that the default paper size is set to A4
3.) If you're not using an installer to setup PDFrun.exe on a target computer you'll need to manually issue this command to register it:
<Full path of PDFrun.exe file> /RegServer (e.g. C:\Program Files\dotComSolution\AVFPdemo5\pdfrun.exe /RegServer)
4.) You must run DCOMCNFG on PDFrun.Print2PDF prior to use: Under Security for PDFRun.Print2PDF, add Custom Access and Custom Launch permissions for the IUSR, IWAM, and ASPNET accounts.
5.) Under the Identity tab for PDFRun.Print2PDF, make sure the Interactive user is selected.
6.) For more information on using AVFPpdf, see the avfpdemo5 project source and demo for a complete example."
I have the setup right, as extracting the demo into a folder works, and allows PDF generation. However in my app, it shows the code on the page. I cannot see the difference!
Here is Main.Prg:
lchtmlfile = 'pdf.htm'
oPDF.cRecordSelect = [SELECT * from ']+ oProp.DataPath+[customer' INTO CURSOR tcursor]
oPDF.cReport = oProp.AppStartPath+"reports\id.frx"
oPDF.cPhysicalPath=oProp.AppStartPath+[Temp\] &&[C:\Program Files\dotComSolution\AVFPdemo2\Temp\]
lcFile=oPDF.GetOutput() && generate output, return temp file name
lcNewPath=oPDF.cLogicalPath+lcFile && new URL
oResponse.Redirect(lcNewPath) && redirect browser to created file
oPDF = .NULL.
Please help - I'm pulling my hair out with this one !
Jun 27, 2011 at 12:15 PM
You just have to get the DCOM security set up correctly. That's the trickiest part.