Report Generation

Topics: Developer Forum, Project Management Forum, User Forum
May 6, 2009 at 9:30 AM
Dear All
      I have installed activevfp, While running Report in DEMO, will generate error
Caught .NET exception, source: 0000906h0008 err#= 1733 line= 134 Class definition PDFRUN.PRINT2PDF is not found.1733 Class definition PDFRUN.PRINT2PDF is not found. PDFRUN.PRINT2PDF .NULL. .NULL. .NULL. .NULL. c:\program files\dotcomsolution\avfpdemo4\activevfp.dll message: c:\program files\dotcomsolution\avfpdemo4\activevfp.dll

    What is cause and how can I resolve it ? any idea ?

May 6, 2009 at 10:50 AM
Did you install GhostScript??  It's listed as a requirement in the docs for web printing.  It's free.

VFP Report To PDF
Ghostscript and a PostScript printer driver

May 8, 2009 at 5:40 PM

I have installed but still report (PDF) not working, Giving same Error !


May 10, 2009 at 10:14 AM

Even in your sample it is giving same error. Can you help me out !


May 10, 2009 at 3:55 PM
Edited May 10, 2009 at 3:57 PM

Ok, rather than fix what's already there, I'm going to use PDFpower since it has just about everything in one setup instead of bits and pieces all over the place.  First of all, download the following and make sure it works from desktop VFP:

and follow the included instructions.  You should be able to take an existing vfp report and make it a PDF using PDFPower from desktop vfp.

The next part will be making it run on the web with ActiveVFP.  Let me know when you have the first part complete.

May 11, 2009 at 6:36 AM

Great, I am able to create PDF through desktop VFP. Please provide info for Web ActiveVFP.

May 14, 2009 at 5:53 AM

Could you provide further assistance to create PDF with ActiveVFP as I am able to create it with Dekstop VFP. Do you have details documents or exmaple of pages where parameter captured from web page  and based on paramters multiple cursors qn query generated, ofcouse some chunk of code to get fine result and from output  finally creating report.


Jun 24, 2009 at 9:32 PM

Ok, the PDF example is up and running on the demo site again.  I decided against rewriting for PDFPower since it doesn't use the faster Ghostscript DLL.

For your problem, I believe it may have been that in DCOMCNFG you may have had pdfrun.print2PDF set incorrectly.  For "Identity" it should run as the "Interactive user" not the launching user....

Jun 27, 2009 at 9:20 AM


Have been following your replies. Great product. Data access is working 100% 

My Problem is PDF creation and getting the following error when trying to generate the pdf from report.

I have

GS 8.64 installed

Generic Postscript Printer and generic Colour postscript installed

.net 3.X installed.

IIS 5 installed and working.

Windows Xp sp3

When I run the as per documentation default.aspx it shows only the files contents and nothing else.

When I replace with default.asp it works fine except ffor the PDF creation.


Please try the following:

  • Click the Refresh button, or try again later.
  • Open the localhost home page, and then look for links to the information you want.

HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

Technical Information (for support personnel)

  • Error Type:
    00005q21000k err#= 1426 line= 134 OLE error code 0x80070005: Access is denied.1426 OLE error code 0x80070005: Access is denied. 80070005: Access is denied .NULL. .NULL. .NULL. .NULL. c:\program files\dotcomsolution\avfpdemo4\activevfp.dll (0x800A0592)
    c:\program files\dotcomsolution\avfpdemo4\activevfp.dll
    /avfpdemo4/default.asp, line 6


  • Browser Type:
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; MS Internet Explorer; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; FDM)


  • Page:
    GET /avfpdemo4/default.asp


I Even tried changing the PDF function in main.prg and compiling to print to plain HTML file using listeners. It also gives the error as displayed above.

Help would be greately appreciated.




Jun 27, 2009 at 1:31 PM

Ok, using the original PDFrun exe (and not PDFpower for reasons mentioned earlier):

1.) Ghostscript version needs to be the last AFPL version 8.54, NOT GPL 8.64 - I recently made the same mistake thinking it wouldn't matter, but, it does. 

2.) As noted in the docs, you need to use DCOMCNFG to set Launch, Activation, and Access permissions on the pdfrun.Print2PDF server (the server name is wrong in the docs I think).  Missing from the docs, but just as important, the Identity (tab) needs to set the server to "The interactive user", NOT the launching user which is the default I think.

After I made the above changes on my Windows 2003 Server, all was well again.

3.) As a further improvement, I changed the base class that the PDFrun server uses to Session instead of Relation.  This fixed an issue with file locking on customers.dbf it was having...

Jun 29, 2009 at 8:12 AM


As per your reply I uninstalled version 8.64 and installed version 8.54

Reinstalled avfpdemo installation

Left Server at LOCALHOST and default application as is when asked on installation

Reset the pdfrun.Print2PDF to interactive user.

The virtual directories was created in setup.

I also set the postscript printer as default (Do not think I needed to)

It still gives the same errors

Any other suggestions or will most of these issues be solved in ver 4.1.

Database acces still works correctly.

Thanx for the help.

Jun 29, 2009 at 10:55 AM
Edited Jun 29, 2009 at 10:57 AM

Did you do the other DCOMCNFG stuff (set Launch, Activation, and Access permissions on the pdfrun.Print2PDF) ??

Jun 29, 2009 at 11:23 AM

I did set all the permissions on the Launch, Activation, and Access permissions to allow.

Also identity to Interactive user.

Also went to IIS and set the AVFPDEMO4 to use 2.XX it was not selected previously.


Jun 29, 2009 at 3:24 PM

And you're getting the same exact error message you got in the beginning??

I'm not sure if this is the problem or not, but, the name of the Printer Driver is very important since Print2PDF does some checks on it.  You may want to take a look at the property settings in the beginning of Print2PDF. However,  I would have thought you'd be getting more descriptive errors if it was one of those settings..:


define class Print2PDF as session OLEPUBLIC    &&relation
    **Please note that any of these properties can be set by you in your code.
    **You can also set most of them by using the .ini file.
    cPhysicalPath   = space(0)
    cLogicalPath    = space(0)
    **Set these properties (required)
    cReport            = space(0)    &&Name of VFP report to Run
    cOutputFile        = space(0)    &&Name of finished PDF file to create.
    cRecordSelect   = space(0)

    **User-Definable properties (most of these can be set in the .ini file)
    cStartFolder    = justpath(sys(16))+iif(right(justpath(sys(16)),1)="\","","\")    &&Folder this program started from.
    cTempPath        = space(0)    &&Folder for Temporary Files (default = VFP temp path)
    cExtraRptClauses= space(0)    &&Any extra reporting clauses for the "report form" command
    lReadINI        = .f.        &&Do you want to pull settings out of Print2PDF.ini file?
    cINIFile        = this.cStartFolder+"Print2PDF.ini"    &&Name of INI file to use.  If not in current folder or VFP path, specify full path.
    lFoundPrinter    = .f.        &&Was the PS printer found?
    lFoundGS        = .f.        &&Was Ghostscript found?
    cPSPrinter        = space(0)    &&Name of the Windows Printer that is the Postscript Printer (default = "GENERIC POSTSCRIPT PRINTER")
    cPSColorPrinter    = "GENERIC COLOUR POSTSCRIPT"  &&space(0)    &&Name of the Windows Printer that is the Postscript Printer (default = "GENERIC COLOR POSTSCRIPT")
    lUseColor        = .t.        &&Use "color" printer driver?
    cPrintResolution= space(0)    &&Printer resolution string (300, 600x600, etc.) (default = "300")
    cPSFile            = space(0)    &&Path/Filename for Postscript file (auto-created if not passed)
    lErasePSFile    = .t.        &&Erase the .ps file after conversion?  Set to .F. to save postscript file for debugging.
    cGSFolder        = space(0)    &&Path where Ghostscript DLLs exist    (auto-populated if not passed)

    **Internal properties
    lError            = .f.        &&Indicates that this class had an error.
    cError            = ""        &&Error message generated by this class
    cOrigSafety        = space(0)    &&Original "set safety" settting

Jun 30, 2009 at 7:26 AM


1) Tested the following code appearing in the Print2PDF.prg file with a few modifications.

It creates the PDf file just fine.

Public lopdf
IF !USED('letter')
Use c:\Work\dbfs\letter In 0 Shared &&Table used in letter1.frx

Set Procedure To Print2PDF.prg Additive
lopdf = Createobject("Print2PDF")
If Isnull(lopdf)
 =Messagebox("Could not setup PDF class!",48,"Error")
 Return .F.
lopdf.cteMPPATH = 'c:\temp\' &&Set temp path to more accessable folder
lopdf.lerASEPSFILE = .F. &&set this to see if PS file is created
lopdf.cReport  = "C:\programs\court40\Reports\letter1.frx" &&Report file
lopdf.cOutputFile  = "C:\myfile.pdf"
llResult    = lopdf.Main()

If !llResult Or lopdf.lError
 =Messagebox("This error ocurred creating the PDF:"+Chr(13)+;
  alltrim(lopdf.cError),48,"Error Message")


2) I then took the same code and modified it and replaced the standard PDF method in the main.prg. Compiled and tested it.


<font size="2" color="#808080"><font size="2" color="#808080"><font size="2" color="#808080">


</font></font></font><font size="2" color="#808080"><font size="2" color="#808080">


</font></font><font size="2" color="#808080">



Now it does not create a PDF file.

   Public lopdf
  If !Used('letter')
   Use c:\Work\dbfs\letter In 0 Shared &&Table used in letter1.frx

*  Set Procedure To Print2PDF.prg Additive
  lopdf = Createobject("pdfrun.Print2PDF")
  If Isnull(lopdf)
   =Messagebox("Could not setup PDF class!",48,"Error")
   Return .F.
  lopdf.cteMPPATH = 'c:\temp\' &&Set temp path to more accessable folder
  lopdf.lerASEPSFILE = .F. &&set this to see if PS file is created
  lopdf.cReport  = "C:\programs\court40\Reports\letter1.frx" &&Report file
  lopdf.cOutputFile  = "C:\myfile.pdf"
  llResult    = lopdf.Main()

  If !llResult Or lopdf.lError
   =Messagebox("This error ocurred creating the PDF:"+Chr(13)+;
    alltrim(lopdf.cError),48,"Error Message")

Any suggestions on my code to create a pdf in its simplest form assuming Ghostscript and Postscript printer is working as tested in 1 above.

Thanx a lot for the help.

Jun 30, 2009 at 10:24 AM

Well, the folder you output PDFs to has to have WRITE permissions for the user.  It works for you but, on the web, the ASP.NET, IWAM, IUSR accounts would need WRITE permissions on this folder.  I believe the ..\avfpdemor\pdffiles is already setup this way but check it if you intend to use it for the output of PDFs.  I would advise against setting the root directory this way for your report as you have it now - C:\myfile.pdf.

Jun 30, 2009 at 12:16 PM

Got it work at long last. Procedures

1) Had to go top DCOMCNFG.exe

2) Properties of pdfrun.Print2PDF

3) Security

4) Launch and Activation Permissions

5) Add both IWAM and IUSER names and allow access.

6) Also Identity must be interactive user.

Thankyou very musch for your help.

It might be a good idea to include this in the documentation for the network illiterate guys like me. It could prevent unnecessary questions.


Jun 30, 2009 at 4:35 PM

Glad it works now!  I think I'll try to get DCOMPERM to work to automate all of this stuff in the setup.

Nov 15, 2009 at 6:03 PM
Edited Nov 15, 2009 at 6:10 PM

Hi vishnurpatel, the response seems to be too late, but maybe it may help others. if you are still interested, I recommend that you try the foxpro table repair program, it is a good solution, if you experience any difficulties with database files. This application also converts dbf files. Hope this helps and not considered to be spam

Jan 31, 2011 at 9:05 AM

Hi, I have got similar problem as Hendriksa when I want to generate pdf report. I get error "Access is denied" when I try to connect to localhost. But it works when I try to connect to I have found some recommendation to try in other discussion. It works - pdf file is creating correctly on my computer.

I think the problem could be in rights. But my virtual directory is set for R/W. Also DCOMCNFG was set according manual.

Any hint? Thanks.

Jan 31, 2011 at 10:05 AM

Just go thru the dcomcnfg stuff again carefully.  It's just a matter of getting all that set up right as Hendriksa finally did above.  The documentation should be complete in this regard now.