Problem with printing report

Topics: User Forum
Mar 2, 2015 at 4:55 PM
I need to send a frx report directly to my printer from AVFP. I've tried this code:
printerName = "35PPM PCL6"
cReport = oProp.AppStartPath + "reports\doc.frx"
SET PRINTER TO NAME (printerName)
REPORT FORM (cReport) TO PRINTER NOCONSOLE
Usually, in visual foxpro, this code works fine but in AVFP i receive this error code:
err#= 1001 line= 175 Feature is not available.
I don't understand where is the problem. The documentation says that i can use the set printer.
Any idea?
Coordinator
Mar 2, 2015 at 5:06 PM
Edited Mar 2, 2015 at 5:07 PM
you can't do it directly from avfp since it's a vfp mtdll. But you can call a VFP EXE COM server from the avfp mtdll which can do it.

The following is an example using PDF (Victor has a routine that prints VFP reports from AVFP that goes to local printers without PDF - look here in discussions or ask him directly):
  • This is the routine the avfp demo runs
oPDF=CREATEOBJECT("pdfrun.print2pdf")
if isnull(oPDF)
  return .f.
endif
oPDF.cPSColorPrinter ="Xerox Phaser 6120 PS"
oUtil=NEWOBJECT('AVFPutilities')
* files older than 20 Minutes(1200 ms.), erase.  3rd param is path - can be hardcoded
oUtil.DeleteFiles('pdf',1200,oProp.AppStartPath+[Temp\])
lcCompany=oRequest.Form("Company")
IF ISNULL(lcCompany) .OR. EMPTY(lcCompany)
  oPDF.cRecordSelect = [SELECT * from ']+ oProp.DataPath+[customer' INTO CURSOR tcursor]
ELSE
  oPDF.cRecordSelect = [SELECT * from '] + oProp.DataPath+[customer' ]+;
 [WHERE UPPER(company)=ALLTRIM(UPPER(']+lcCompany+[')) INTO CURSOR tcursor]
ENDIF
* the following properties are coded for portability.  They may be hardcoded instead.
oPDF.cReport = oProp.AppStartPath+"reports\listcust.frx"
oPDF.cPhysicalPath=oProp.AppStartPath+[Temp\]     &&[C:\Program Files\dotComSolution\AVFPdemo2\Temp\]
oPDF.cLogicalPath=[http://]+oRequest.ServerVariables("HTTP_HOST") +JustPath(oRequest.ServerVariables("URL"))+[/Temp/] &&[http://www.ddddd.com/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.
release oPDF
Mar 3, 2015 at 9:19 AM
claudefox wrote:
you can't do it directly from avfp since it's a vfp mtdll. But you can call a VFP EXE COM server from the avfp mtdll which can do it.

The following is an example using PDF (Victor has a routine that prints VFP reports from AVFP that goes to local printers without PDF - look here in discussions or ask him directly):
Ok, i understand! I already know and use pdfrun. Thanks for reply.
Coordinator
Mar 3, 2015 at 2:15 PM
As claude said, you can't send a report directly from your AVFP code using REPORT FORM. Instead, you use a new helper class called avfpReportHelper that would be included in the next release of AVFP:
 TRY
    LOCAL oHelper
    oHelper = CREATEOBJECT("avfpHelpers.avfpReportHelper")
    oHelper.cPrinterName = "35PPM PCL6"
    oHelper.cReportFile = oProp.AppStartPath + "reports\doc.frx"
    oHelper.cDataSource = oProp.appStartPath + "temp\datafile.dbf"
    oHelper.lAutoDropDataSource = .T.   && Delete datasource file automatically after print
    oHelper.cReportOutput = oProp.appStartPath + "REPORTOUTPUT.APP"
    oResult = oHelper.Execute()

  CATCH TO ex
    * TODO: Log the error
  ENDTRY
To install the new helper:
  1. Download this file
  2. Extract the file
  3. Copy REPORTOUTPUT.APP in your AVFP's root folder
  4. Copy AVFPHELPERS.DLL y TLB in your AVFP's BIN folder
  5. Register AVFPHELPERS.DLL using regsvr32 (if you are in a 64bit system, use c:\windows\syswow64\regsrv32.exe)
Victor Espina
Coordinator
Mar 3, 2015 at 2:19 PM
As you can see in the example, this first version of avfpReportHelper requires that the data to be printed has to be saved in a physical file. My goal for next version is add support for SQL statements as well for JSON data, to avoid the need of a temporary file.

Also, my idea is to add PDF support directly to the helper, so you can choose to send the report to a printer or to a PDF file.


Victor
Mar 4, 2015 at 11:51 AM
Thank you Victor. I followed your steps but when i launch the webpage i haven't any error but the printer not receiving the file to print.
Printer name is correct and, if can be usefully, the printer is the windows default printer.

P.S. The file that i set as datasource is not empty.
Coordinator
Mar 4, 2015 at 2:47 PM
Edited Mar 4, 2015 at 2:48 PM
Try to put some code in the CATCH section to log any error that can be arising. Or remove the TRY - CATCH block so AVFP can report the error back to your browser.

Victor Espina
Mar 5, 2015 at 8:32 AM
vespina wrote:
Try to put some code in the CATCH section to log any error that can be arising. Or remove the TRY - CATCH block so AVFP can report the error back to your browser.

Victor Espina
I've this code:
    
    TRY
        LOCAL oHelper
        oHelper = CREATEOBJECT("avfpHelpers.avfpReportHelper")
        oHelper.cPrinterName = "35PPM PCL6"
        oHelper.cReportFile = oProp.AppStartPath + "reports\doc.frx"
        oHelper.cDataSource = PathTab
        oHelper.lAutoDropDataSource = .T.
        oHelper.cReportOutput = oProp.AppStartPath + "ReportOutput.app"
        oResult = oHelper.Execute()
    CATCH TO loError
        tcReturn = [Error: ] + STR(loError.ERRORNO) + CHR(13) + ;
        [LineNo: ] + STR(loError.LINENO) + CHR(13) + ;
        [Message: ] + loError.MESSAGE + CHR(13) + ;
        [Procedure: ] + loError.PROCEDURE + CHR(13) + ;
        [Details: ] + loError.DETAILS + CHR(13) + ;
        [StackLevel: ] + STR(loError.STACKLEVEL) + CHR(13) + ;
        [LineContents: ] + loError.LINECONTENTS
    ENDTRY
However, if i remove the TRY_CATCH, i've the same results: a blank page without no error.
Coordinator
Mar 5, 2015 at 1:59 PM
Ok, we have two more things to test:
  1. oResult object contains a property called "cLog" that contains a text log of the printing process. Try returning the content of that property to your browser to see what is happening internally in the helper.
  2. If an error occurs while printing, an exception is catched and the Exception instance is saved on oHelper.oLastError. First, check if oLastError is not null and, if it isn't, return the value of oHelper.oLastError.Description.
I double checked that I sent to you the last version of the DLL and, if it worth it, this DLL is in use in two AVFP projects right now and works ok.


Victor
Mar 6, 2015 at 9:18 AM
vespina wrote:
Ok, we have two more things to test:
  1. oResult object contains a property called "cLog" that contains a text log of the printing process. Try returning the content of that property to your browser to see what is happening internally in the helper.
  2. If an error occurs while printing, an exception is catched and the Exception instance is saved on oHelper.oLastError. First, check if oLastError is not null and, if it isn't, return the value of oHelper.oLastError.Description.
I double checked that I sent to you the last version of the DLL and, if it worth it, this DLL is in use in two AVFP projects right now and works ok.


Victor
Ok. oResult.cLog is the only expression that returning me an error into browser:
Caught .NET exception, source: PRINT.AVFP 0000a0q1004o err#= 1426 line= 188 OLE error code 0x80020006: Nome sconosciuto.1426 OLE error code 0x80020006: Nome sconosciuto. 80020006: Nome sconosciuto .NULL. .NULL. .NULL. .NULL. C:\App.....
oHelper.oLastError and try catch not returning me any error.
Coordinator
Mar 7, 2015 at 3:07 PM
My mistake. What that error means is that there is no member in oResult called "cLog". This is because the real name is "log" (oResult.log). Please try again and let me know the content of that property.

Victor
Mar 10, 2015 at 9:22 AM
Ok. With oResult.log i haven't any error (.NET exception) but this property is empty. Any idea?
Coordinator
Mar 10, 2015 at 5:14 PM
I checked the code at Execute method and found some conditions than can cause the method to exit before adding any entries to the log property. Please, change your code to this:
 TRY
        LOCAL oHelper
        oHelper = CREATEOBJECT("avfpHelpers.avfpReportHelper")
        oHelper.cPrinterName = "35PPM PCL6"
        oHelper.cReportFile = oProp.AppStartPath + "reports\doc.frx"
        oHelper.cDataSource = PathTab
        oHelper.lAutoDropDataSource = .T.
        oHelper.cReportOutput = oProp.AppStartPath + "ReportOutput.app"
        oResult = oHelper.Execute()

        IF NOT oResult.result          && The result property indicates if the call was sucessfully handled or not
          tcReturn = oResult.data     && If something went wrong with the call (a missed parameter or a missed file), the data property contains useful info.
        ENDIF

    CATCH TO loError
        tcReturn = [Error: ] + STR(loError.ERRORNO) + CHR(13) + ;
        [LineNo: ] + STR(loError.LINENO) + CHR(13) + ;
        [Message: ] + loError.MESSAGE + CHR(13) + ;
        [Procedure: ] + loError.PROCEDURE + CHR(13) + ;
        [Details: ] + loError.DETAILS + CHR(13) + ;
        [StackLevel: ] + STR(loError.STACKLEVEL) + CHR(13) + ;
        [LineContents: ] + loError.LINECONTENTS
    ENDTRY
Mar 11, 2015 at 9:35 AM
Ok. Now i see the error: "C:\ApplicazioniWeb\Progetti\webdoc\webdoc\temp\cStampa34079112 is not found ". So, the problem is the datasource but the file, in this path, exist and it is full. Why he not found it?
Coordinator
Mar 11, 2015 at 1:38 PM
Access issue? If the file does exists, most probably the user under your app is running does not have access to that file.

Victor Espina
Coordinator
Mar 11, 2015 at 4:30 PM
Edited Mar 11, 2015 at 4:31 PM
Forget about last comment. I can't be an access issue since the same user is creating the data file. What caught my eyes in the error text is that the data file has no extension. Could this be the problem? try:
oHelper.cDataSource = pathTab +  ".DBF"
Victor
Mar 11, 2015 at 5:10 PM
I added the extension and now the error is this:
.... err#= 1426 line= 182 OLE error code 0x80020006: Nome sconosciuto...
Coordinator
Mar 11, 2015 at 6:21 PM
Hum. I ran out of ideas here. :( Something is wrong but I can't say what could be.

Victor
Mar 12, 2015 at 11:10 AM
If you want, i can post the full code of my print page. Maybe, i do a mistake...
Coordinator
Mar 12, 2015 at 3:17 PM
That could help. Also add a printout of your window explorer listing your data file.

Victor
Mar 12, 2015 at 5:58 PM
Ok, this is the code of my print page:
<%
    LOCAL tipo, numero, alfa, fcodcli, nTab, PathTab, PathDB
    STORE "" TO tipo, numero, alfa, fcodcli, nTab, PathTab, PathDB
    LOCAL totaledocumento, totalecolli, totalepeso
    STORE 0 TO totaledocumento, totalecolli, totalepeso
    LOCAL cimponi, cimposta, totdoc, sQta, totimponi, totimposta
    STORE 0 TO cimponi, cimposta, totdoc, sQta, totimponi, totimposta
                            
    tipo = oRequest.querystring("tipo")
    numero = oRequest.querystring("num")
    alfa = oRequest.querystring("alfa") 
    fdatdoc = oRequest.QueryString("datdoc")
    fcodcli = oRequest.QueryString("codcli")
    nTab = "cStampa" + SYS(3)
    PathTab = oProp.AppStartPath + "temp\" + nTab
    PathDB = GET_PATH_AZIENDA(ALLTRIM(oSession.value("_tipodoc")))
    saldoPrec = 0
    * CREAZIONE TABELLA TEMPORANEA
    CREATE TABLE (PathTab) FREE ( ;
        aragsoc c(45) NULL, ;
        aindiri c(35) NULL, ;
        acap c(5) NULL, ;
        alocali c(25) NULL, ;
        aprovin c(2) NULL, ;
        atelefo c(10) NULL, ;
        numdoc n(6) NULL, ;
        alfdoc c(2) NULL, ;
        datdoc d NULL, ;
        codcli c(7) NULL, ;
        descli c(50) NULL, ;
        indiri c(35) NULL, ;
        cap c(5) NULL, ;
        locali c(25) NULL, ;
        prov c(2) NULL, ;
        pivacli c(11) NULL, ;
        clicfs c(16) NULL, ;
        tipdoc c(3) NULL, ;
        destipdoc c(50) NULL, ;
        codcau n(3) NULL, ;
        descau c(50) NULL, ;
        codcon n(3) NULL, ;
        mezzo c(50) NULL, ;
        coddest c(3) NULL, ;
        desdest c(50) NULL, ;
        codart c(30) NULL, ;
        desart c(50) NULL, ;
        colli n(8) NULL, ;
        qta n(15,3) NULL, ;
        prezzo n(6,2) NULL,;
        acconto n(6,2) NULL, ;
        annota c(200) NULL, ;
        codiva n(3) NULL, ;
        periva n(5,2) NULL, ;
        totdoc n(6,2) NULL, ;
        saldop n(6,2) NULL, ;
        lotto c(20) NULL, ;
        imponi n(6,2) NULL, ;
        imposta n(6,2) NULL)
    USE
    && USE oProp.AppStartPath + "\temp\" + nTab IN 0 ALIAS cStampa
    
    *DATI AZIENDA
    SELECT * FROM PathDB + "k_aziend" ;
    WHERE k_aziend.anno = YEAR(CTOD(oSession.value("_datadocumento"))) ;
    INTO CURSOR cAzienda NOCONSOLE
    
    IF RECCOUNT("cAzienda") > 0
        aZragsoc = cAzienda.t_azraso
        aZindiri = cAzienda.t_azindi
        aZcap = cAzienda.t_az_cap
        aZlocali = cAzienda.t_azloca
        aZprovin = cAzienda.t_azprov
        aZtelefo = cAzienda.t_azdapt + cAzienda.t_azdatl
    ENDIF
    
    * SALDO PRECEDENTE
    SELECT * FROM PathDB + "k_salcfp" ;
    WHERE cftiprec+cfcodice+cf__anno == "C"+ALLTRIM(fcodcli)+STR(YEAR(CTOD(oSession.value("_datadocumento"))),4) ;
    INTO CURSOR cSaldi NOCONSOLE
    
    IF RECCOUNT("cSaldi") > 0
        saldoPrec = (cSaldi.cfsalini+cSaldi.cfdarper+cSaldi.cfdarpre-cSaldi.cfaveper-cSaldi.cfavepre)
    ENDIF
    
    * QUERY
    SET ENGINEBEHAVIOR 70
    SELECT k_docume.mvnumdoc AS numdoc, k_docume.mvalfdoc AS alfdoc, k_docume.mvdatdoc AS datdoc, ;
        k_pardoc.t_tdvdes AS destipdoc, k_caumag.t_macade AS descau, ;
        k_client.cfdescr1 AS descli, k_client.cfpariva AS pivacli, ;
        k_traspo.t_ms_des AS mezzo, k_docume.mvdesmer AS coddestin, k_destin.dsdescr1 AS destin, ;
        k_docume.mvcoddoc AS tipdoc, k_docume.mvdesart, k_docume.mvcolli, k_docume.mvqtamov, k_docume.mvvaluni, ;
        k_docume.mvtotdoc, k_docume.mvaccont, k_docume.mvannota, k_codiva.t_ivaper AS periva, k_artico.arcodiva AS codiva, ;
        k_docume.mvcodcau, k_docume.mvcaucon, k_docume.mvcodart, ;
        k_client.cfindiri, k_client.cf___cap, k_client.cflocali, k_client.cfprovin, k_client.cfcodfis, ;
        k_vettor.t_sp_des as tipvett ;
    FROM PathDB + "k_docume" ;
        LEFT JOIN PathDB + "k_client" ON k_docume.mvcodclf == k_client.cfcodice AND mvtiprec = "C" ;
        LEFT JOIN PathDB + "k_pardoc" ON k_docume.mvcoddoc == k_pardoc.t_codice ;
        LEFT JOIN PathDB + "k_caumag" ON k_docume.mvcodcau == k_caumag.t_codice ;
        LEFT JOIN PathDB + "k_destin" ON k_docume.mvdesmer == k_destin.dscoddes ;
        LEFT JOIN PathDB + "k_artico" ON k_docume.mvcodart == k_artico.arcodart ;
        LEFT JOIN PathDB + "k_codiva" ON k_artico.arcodiva == k_codiva.t_codice ;
        LEFT JOIN PathDB + "k_vettor" ON k_docume.mvcodvet == k_vettor.t_codice ;
        LEFT JOIN PathDB + "k_traspo" ON k_traspo.t_codice = k_docume.mvcodspe ;
    WHERE ALLTRIM(k_docume.mvcoddoc) == ALLTRIM(oSession.value("_tipodoc")) ;
        AND k_docume.mvnumdoc = INT(VAL(numero)) AND ALLTRIM(k_docume.mvalfdoc) == ALLTRIM(alfa) ;
        AND k_docume.mvdatdoc = CTOD(ALLTRIM(fdatdoc)) AND k_docume.mvcodclf == fcodcli AND k_docume.mvtiprec = "C" ;
    GROUP BY numdoc,alfdoc,datdoc,mvcodart,mvvaluni,mvqtamov ;
    INTO CURSOR cDocs NOCONSOLE
    
    IF RECCOUNT("cDocs") > 0
        DO WHILE NOT EOF("cDocs")
            totalecolli = totalecolli + cDocs.mvcolli
            totalepeso = totalepeso + cDocs.mvqtamov    
            PzNoIva = (cDocs.mvvaluni*cDocs.mvqtamov)/(1+(cDocs.periva/100)+.001)
            cimponi = (cDocs.mvvaluni*cDocs.mvqtamov)
            cimposta = ((cDocs.mvvaluni*cDocs.mvqtamov)*(1+(cDocs.periva/100))) - (cDocs.mvvaluni*cDocs.mvqtamov)
            totimponi = totimponi + cimponi
            totimposta = totimposta + cimposta
            totaledocumento = totaledocumento + cimponi + cimposta
            INSERT INTO (PathTab)(numdoc, alfdoc, datdoc, codcli, descli, pivacli, ;
                indiri, cap, locali, prov, clicfs, ;
                tipdoc, destipdoc, codcau, descau, codcon, ;
                mezzo, coddest, desdest, ;
                codart, desart, colli, qta, prezzo, acconto, ;
                annota, codiva, periva, saldop, lotto, imponi, imposta) ;
            VALUES(cDocs.numdoc, cDocs.alfdoc, cDocs.datdoc, fcodcli, cDocs.descli, cDocs.pivacli, ;
                cDocs.cfindiri, cDocs.cf___cap, cDocs.cflocali, cDocs.cfprovin, cDocs.cfcodfis, ;
                ALLTRIM(oSession.value("_tipodoc")), cDocs.destipdoc, cDocs.mvcodcau, cDocs.descau, cDocs.mvcaucon, ;
                cDocs.mezzo, cDocs.coddestin, cDocs.destin, ;
                cDocs.mvcodart, cDocs.mvdesart, cDocs.mvcolli, cDocs.mvqtamov, cDocs.mvvaluni, cDocs.mvaccont, ;
                cDocs.mvannota, cDocs.codiva, cDocs.periva, saldoPrec, "", cimponi, cimposta)
                
            UPDATE (PathTab) ;
                SET aragsoc = aZragsoc, ;
                    aindiri = aZindiri, ;
                    acap = aZcap, ;
                    alocali = aZlocali, ;
                    aprovin = aZprovin, ;
                    atelefo = aZtelefo
                    
            SKIP IN cDocs
        ENDDO
    ENDIF
    
    * STAMPA
    LOCAL tcReturn
    tcReturn = "NESSUN ERRORE"
    
    TRY
        LOCAL oHelper
        oHelper = CREATEOBJECT("avfpHelpers.avfpReportHelper")
        oHelper.cPrinterName = "35PPM PCL6"
        oHelper.cReportFile = oProp.AppStartPath + "reports\doc.frx"
        oHelper.cDataSource = PathTab + ".DBF"
        oHelper.lAutoDropDataSource = .T.
        oHelper.cReportOutput = oProp.AppStartPath + "ReportOutput.app"
        oResult = oHelper.Execute()

        IF NOT oResult.result
            tcReturn = oResult.data
        ENDIF   
    CATCH TO loError
        tcReturn = [Error: ] + STR(loError.ERRORNO) + CHR(13) + ;
        [LineNo: ] + STR(loError.LINENO) + CHR(13) + ;
        [Message: ] + loError.MESSAGE + CHR(13) + ;
        [Procedure: ] + loError.PROCEDURE + CHR(13) + ;
        [Details: ] + loError.DETAILS + CHR(13) + ;
        [StackLevel: ] + STR(loError.STACKLEVEL) + CHR(13) + ;
        [LineContents: ] + loError.LINECONTENTS
    ENDTRY

%>
<br/>last error<br />
<% IF NOT ISNULL(oHelper.oLastError) %>
    <%=oHelper.oLastError.Description%>
<% ENDIF %>
<br/>errore try<br />
<%=tcReturn%>
<br/>log<br />
<%=oResult.Log%>
Mar 12, 2015 at 5:59 PM
And this is my data dir:
----------------------------------------------------------------------------------------------------
webdoc\                                                          
----------------------------------------------------------------------------------------------------
webdoc\maincode.app 
webdoc\ReportOutput.app 
webdoc\___auth.avfp 
webdoc\___clienti.avfp  
webdoc\articolicat.avfp 
webdoc\artprz.avfp  
webdoc\artqta.avfp  
webdoc\categorie.avfp   
webdoc\checkSessione.avfp     
webdoc\creacliente.avfp 
webdoc\creadoc.avfp 
webdoc\default.avfp 
webdoc\doc_inviato.avfp 
webdoc\documento.avfp   
webdoc\elenco_clienti.avfp    
webdoc\elenco_documenti.avfp  
webdoc\elenco_variabili_sessione.avfp   
webdoc\home.avfp    
webdoc\mod_footer.avfp  
webdoc\mod_libs.avfp
webdoc\mod_pulsanti.avfp
webdoc\operazione.avfp  
webdoc\riepdoc.avfp 
webdoc\stampa.avfp  
webdoc\stordoc.avfp 
webdoc\test.avfp    
webdoc\tipdoc.avfp  
webdoc\vedidoc.avfp 
webdoc\Web.Config   
webdoc\activevfp.dll
webdoc\msvcr71.dll  
webdoc\VFP9RENU.DLL 
webdoc\vfp9t.dll    
webdoc\vfp2c32.fll  
webdoc\index.html   
webdoc\config.ini   
webdoc\html5shiv.min.js 
webdoc\jquery.min.js
webdoc\respond.min.js   
webdoc\activevfp.dll.manifest 
webdoc\webapp.manifest  
----------------------------------------------------------------------------------------------------
webdoc\bin\                                                      
----------------------------------------------------------------------------------------------------
webdoc\bin\activevfp_dotnetproxy.dll    
webdoc\bin\App_Code.dll 
webdoc\bin\AspManifestHelpers.dll       
webdoc\bin\avfphelpers.DLL    
webdoc\bin\avfphelpers.tlb    
----------------------------------------------------------------------------------------------------
webdoc\css\                                                      
----------------------------------------------------------------------------------------------------
webdoc\css\Web.Config   
webdoc\css\bootstrap-theme.css
webdoc\css\bootstrap-theme.min.css      
webdoc\css\bootstrap.css
webdoc\css\bootstrap.min.css  
webdoc\css\jquery-ui.css
webdoc\css\jquery.mobile-1.4.5.css      
webdoc\css\jquery.mobile-1.4.5.min.css  
webdoc\css\rStile.css   
webdoc\css\bootstrap-theme.css.map      
webdoc\css\bootstrap.css.map  
----------------------------------------------------------------------------------------------------
webdoc\css\images\                                               
----------------------------------------------------------------------------------------------------
webdoc\css\images\add.png     
webdoc\css\images\edit.png    
webdoc\css\images\favorite.png
webdoc\css\images\remove.png  
webdoc\css\images\sub.png     
----------------------------------------------------------------------------------------------------
webdoc\data\                                                     
----------------------------------------------------------------------------------------------------
webdoc\data\docs.dbf
----------------------------------------------------------------------------------------------------
webdoc\fonts\                                                    
----------------------------------------------------------------------------------------------------
webdoc\fonts\Web.Config 
webdoc\fonts\glyphicons-halflings-regular.eot 
webdoc\fonts\glyphicons-halflings-regular.svg 
webdoc\fonts\glyphicons-halflings-regular.ttf 
webdoc\fonts\glyphicons-halflings-regular.woff
----------------------------------------------------------------------------------------------------
webdoc\images\                                                   
----------------------------------------------------------------------------------------------------
webdoc\images\Web.Config   
----------------------------------------------------------------------------------------------------
webdoc\images\imgcat\                                            
----------------------------------------------------------------------------------------------------
webdoc\images\imgcat\01.jpg   
webdoc\images\imgcat\02.jpg   
webdoc\images\imgcat\040000.jpg         
webdoc\images\imgcat\nofoto.png         
----------------------------------------------------------------------------------------------------
webdoc\javascript\                                               
----------------------------------------------------------------------------------------------------
webdoc\javascript\Web.Config  
webdoc\javascript\avfp.js     
webdoc\javascript\bootstrap.js
webdoc\javascript\bootstrap.min.js      
webdoc\javascript\ie10-viewport-bug-workaround.js
webdoc\javascript\jquery-1.10.2.js      
webdoc\javascript\jquery-ui.js
webdoc\javascript\jquery.js   
webdoc\javascript\jquery.min.js         
webdoc\javascript\jquery.mobile-1.4.5.js
webdoc\javascript\jquery.mobile-1.4.5.min.js  
webdoc\javascript\mvc.js
webdoc\javascript\jquery.mobile-1.4.5.min.map 
----------------------------------------------------------------------------------------------------
webdoc\mvc\                                                      
----------------------------------------------------------------------------------------------------
webdoc\mvc\spaAnotherView.avfp
webdoc\mvc\spaHomeView.avfp   
webdoc\mvc\spaAnotherView.js  
webdoc\mvc\spaHomeView.js     
----------------------------------------------------------------------------------------------------
webdoc\prg\                                                      
----------------------------------------------------------------------------------------------------
webdoc\prg\AVFPutilities.FXP  
webdoc\prg\compileifnew.FXP   
webdoc\prg\delegate.FXP 
webdoc\prg\docount.FXP  
webdoc\prg\main.FXP 
webdoc\prg\pages.FXP
webdoc\prg\utiltest.FXP 
webdoc\prg\utiltest2.FXP
webdoc\prg\avfputilities.prg  
webdoc\prg\CompileIfNew.prg   
webdoc\prg\delegate.PRG 
webdoc\prg\docount.prg  
webdoc\prg\main.prg 
webdoc\prg\pages.prg
webdoc\prg\utiltest.prg 
webdoc\prg\utiltest2.prg
----------------------------------------------------------------------------------------------------
webdoc\prg\handlers\                                             
----------------------------------------------------------------------------------------------------
webdoc\prg\handlers\resthandler.FXP     
webdoc\prg\handlers\resthandler.PRG     
----------------------------------------------------------------------------------------------------
webdoc\prg\handlers\lib\                                         
----------------------------------------------------------------------------------------------------
webdoc\prg\handlers\lib\resthelper.FXP  
webdoc\prg\handlers\lib\resthelper.PRG  
----------------------------------------------------------------------------------------------------
webdoc\prg\plugins\                                              
----------------------------------------------------------------------------------------------------
webdoc\prg\plugins\layouts.FXP
webdoc\prg\plugins\layouts.PRG
----------------------------------------------------------------------------------------------------
webdoc\prg\rest\                                                 
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
webdoc\prg\rest\controllers\                                     
----------------------------------------------------------------------------------------------------
webdoc\prg\rest\controllers\customers.BAK     
webdoc\prg\rest\controllers\customers.DBF     
webdoc\prg\rest\controllers\customers.FPT     
webdoc\prg\rest\controllers\customers.FXP     
webdoc\prg\rest\controllers\customers.prg     
webdoc\prg\rest\controllers\mvc.PRG     
----------------------------------------------------------------------------------------------------
webdoc\reports\                                                  
----------------------------------------------------------------------------------------------------
webdoc\reports\Web.Config     
webdoc\reports\cStampa.DBF    
webdoc\reports\gsdll32.dll    
webdoc\reports\pdfrun.exe     
webdoc\reports\doc.FRT  
webdoc\reports\doc.frx  
webdoc\reports\clsheap.FXP    
webdoc\reports\print2pdf.FXP  
webdoc\reports\pdfrun.PJT     
webdoc\reports\pdfrun.pjx     
webdoc\reports\clsheap.prg    
webdoc\reports\print2pdf.prg  
webdoc\reports\pdfrun2.tlb    
webdoc\reports\pdfrun2.VBR    
----------------------------------------------------------------------------------------------------
webdoc\temp\                                                     
----------------------------------------------------------------------------------------------------
webdoc\temp\events.CDX  
webdoc\temp\Web.Config 
webdoc\temp\cStampa61346891.DBF         
webdoc\temp\cStampa61379063.DBF         
webdoc\temp\events.DBF  
webdoc\temp\events.FPT  
Coordinator
Mar 12, 2015 at 11:56 PM
Try putting this code right before the TRY command:
SELECT (JUSTFNAME(pathtab))
USE 
Regards

Victor Espina
Mar 13, 2015 at 9:27 AM
No change, always OLE error code 0x80020006. :(
Coordinator
Mar 13, 2015 at 2:55 PM
Try running the code inside TRY-CATCH directly from a VFP to see if the code actually works outside AVFP.

Victor
Mar 16, 2015 at 9:47 AM
In VFP, oResult.log return me this:
Datasource: C:\ApplicazioniWeb\Progetti\webdoc\webdoc\temp\cStampa33290159.DBF
Format: C:\ApplicazioniWeb\Progetti\webdoc\webdoc\reports\doc.frx
Listener: Reportlistener
Printer: 35PPM PCL6
Printer1: 
Printer2: 35PPM PCL6
Printer3: FOXIT READER PDF PRINTER
Code: REPORT FORM (cReportFile)  OBJECT oListener
Datasource deleted
Completed
Would seem to be ok but doesn't print anything.
Coordinator
Mar 16, 2015 at 2:42 PM
0x80020006. usually means it can't see the COM server either because it's not registered or some other COM error. (but mostly COM registration issues).

If you haven't manually registered the COM server, that might be an issue..
Coordinator
Mar 16, 2015 at 2:48 PM
I don't think that's is the case here, because the code worked ok from VFP. If the COM server wasn't registered, it should had failed from VFP also. mr_ocean, please send me your FRX and a data file to my email, so I can run some tests locally.

Victor
Mar 17, 2015 at 9:34 AM
vespina wrote:
I don't think that's is the case here, because the code worked ok from VFP. If the COM server wasn't registered, it should had failed from VFP also. mr_ocean, please send me your FRX and a data file to my email, so I can run some tests locally.

Victor
Ok. Can i use e-mail that i found on your website ?
Coordinator
Mar 17, 2015 at 2:42 PM
Yes, please.
Mar 18, 2015 at 12:02 PM
Email sent. Thank you!
Coordinator
Mar 18, 2015 at 1:02 PM
Just received the files and found the problem. From one side, all data fields in your report where created using "alias.field" syntax, witch prevents the report to work with a data source not named "alias". From the other side, the report was saved including the printer environment, witch prevented it to use a different printer.

Once those problems were corrected, the report worked as expected.

On a side note, I just found that we can't use any PDF printer to test reporting in AVFP. No error is generated, but no printout either. The reasone, I guess, is that the STDLL does not allow the printer's save dialog to appear, so the process is not completed.


Victor
Mar 19, 2015 at 11:12 AM
vespina wrote:
Just received the files and found the problem. From one side, all data fields in your report where created using "alias.field" syntax, witch prevents the report to work with a data source not named "alias". From the other side, the report was saved including the printer environment, witch prevented it to use a different printer.

Once those problems were corrected, the report worked as expected.

On a side note, I just found that we can't use any PDF printer to test reporting in AVFP. No error is generated, but no printout either. The reasone, I guess, is that the STDLL does not allow the printer's save dialog to appear, so the process is not completed.


Victor
Thanks Victor. With my previous configuration i do PDF file without problem. However, i applied the file that you send me and edited my print page but i have always the same problem: "OLE error code 0x80020006". I don't understand why i have this error in AVFP.

P.S. The printer that i use is a real printer (network printer).

P.S. 2. I removed you line with new functions that i haven't such as "AVLocate" and "AVEchoLN", etc..
Coordinator
Mar 19, 2015 at 2:01 PM
Try stoping your Application Pool at IIS and restarting it. Then try again. Also try your code directly from VFP; this will help in checking if it is a code error or an COM server error.

Victor
Coordinator
Apr 13, 2015 at 3:44 PM
Mr_ocean, any news about this issue ?
Apr 13, 2015 at 4:10 PM
Unfortunately nothing... i've tried the code in VFP and it works fine. In AVFP, instead, it not works. I don't understand how it can be.

P.S. I was not able to write on forum before for mauntenance.
Coordinator
Apr 13, 2015 at 5:32 PM
Yes, There is any way you can grant me remote access to your test server to see if I can figure it out the problem? It its important for me to know that other person than me has been able to get AVFP printing working and understand what your problem was in order to find a way to make it easier for others.

Victor
Apr 14, 2015 at 9:12 AM
I think it is not possible. My test server is my local machine. On the remote server (not located here) that i have there aren't printers.

I can give you an access to my machine but i think there are time zone problem.
Coordinator
Apr 16, 2015 at 2:12 PM
I am pleased to inform that the problem was solved with an update of the avfphelper.dll. It seems that the original version had some bug that I solved in the last version but never updated the downloadable package.

Victor