FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour tPrinter
Posts: 555
Joined: Wed Jul 31, 2013 01:14 PM
tPrinter
Posted: Tue May 20, 2025 02:12 AM

Hola amigos.

La tengo una impresión desde hace años es la misma y funciona.

Al cambiar a versión 2501 de FWH, al dar clic en el botón para generar el pdf, me pregunta si quiero visualizarlo, digo que si.

Pero me da un mensaje que el archivo (PDF), no existe, esto me pasa con PDF's de varias hojas. No pasa con una sola.

Con la versión 2410 me da el mismo error.

Ahora para salir del paso compilo con la rPreview 2212. Todo funciona correctamente.

Alguna sugerencia.

Saludos

Gracias

Ruben Dario Fernandez

Dario Fernandez

FWH 2501, Harbour, MVS2022 Community, MySql & MariaDB, Dbf/Cdx VSCode.

Maldonado - Uruguay
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: tPrinter
Posted: Tue May 20, 2025 02:46 AM

Puedes proporcionar un PRG para probarlo ?

gracias

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 555
Joined: Wed Jul 31, 2013 01:14 PM
Re: tPrinter Creo que esto es mejor
Posted: Tue May 20, 2025 04:15 AM
Hola maestro, hice un comparación de archivos de la versión 2212 y la 2501.
Son de rpreview.prg
SE QUE ALGUNA DIFERENCIAS SON POR LAS MEPORAS

Solo pasa cuando son muchas páginas, en mi intento son 60 páginas
 CLASSDATA cResFile
    **Esta en la 2212 y no esta en la 2501



2212- METHOD PrintPrv( oDlg, nOption, nPageIni, nPageEnd )
        **Esta en la 2212 y esta diferente en la 2501
2501- METHOD PrintPrv( oDlg, nOption, nPageIni, nPageEnd, cFile )


2501 METHOD GetFileToSave( aExt ) INLINE PrnGetFileToSave( ::oDevice, aExt )
        **No esta en la 2212

2212  ON RESIZE    ( ::PaintMeta(), ::ResizeListView() ) ;
            **Esta diferente en la 2501
2501  ON RESIZE    ( nSizeType, nWidth, nHeight, ::PaintMeta(), ::ResizeListView() ) ;


2212   local oImageList, oReBar, oBar, oHand, uRet, oBtn
       ** Esta diferente en la 2501
2501  local oImageList, oReBar, oBar, uRet, oBtn


2212    //oImageList:AddMasked( TBitmap():Define( ,,, FWBitmap( "pdf" ) ),       nRGB( 255,   0, 255 ) )
        **Esta como comentario 2212
2501  oImageList:AddMasked( TBitmap():Define( ,,, FWBitmap( "pdf" ) ),       nRGB( 255,   0, 255 ) )


2212   DEFINE BUTTON oBtn  OF oBar ;
         MESSAGE FWString( "Go to first page" ) ;
         ACTION  ::TopPage() ;
         TOOLTIP FWString( "First" )
         **   Esta asi en 2212 

2501  DEFINE BUTTON oBtn OF oBar ;
         MESSAGE FWString( "Go to first page" ) ;
         ACTION  ( This, ::TopPage()  ) ;
         TOOLTIP FWString( "First" )
        **Esta asi en 2501 


2212       DEFINE BUTTON oBtn OF oBar ;
         MESSAGE FWString( "Go to previous page" ) ;
         ACTION  ::PrevPage() ;
         TOOLTIP FWString( "Previous" )
        **Esta asi en la 2212 

2501   DEFINE BUTTON oBtn OF oBar ;
         MESSAGE FWString( "Go to previous page" ) ;
         ACTION  ( This, ::PrevPage() ) ;
         TOOLTIP FWString( "Previous" )
        **Asi en la 2501 

Y TODOS LOS BOTONES DE LA BARRA NO TIENEN THIS EN LA BARRA de la 2212 




2212   ::oMeta1:blDblClick := { | nRow, nCol, nKeyFlags | ;
                            ::SetOrg1( nCol, nRow, nKeyFlags ),;
                            If ( ::lListViewHide, nil, If( ::lZoom, ::oLvw:Hide(), ::oLvw:Show() ) ) }
    ** esta as version 2212 
2501 ::oMeta1:blDblClick := { || ;
                            ::Zoom(),;
                            If ( ::lListViewHide, nil, If( ::lZoom, ::oLvw:Hide(), ::oLvw:Show() ) ) }
    ** esta asi en la 2501



2212   ::oMeta2:blDblClick := { | nRow, nCol, nKeyFlags | ;
                            ::SetOrg2( nCol, nRow, nKeyFlags ),;
                            If ( ::lListViewHide, nil, If( ::lZoom, ::oLvw:Hide(), ::oLvw:Show() ) ) }
        ** diferencia entre 2212 y 2501
2501  ::oMeta2:blDblClick := { || ;
                            ::Zoom(),;
                            If ( ::lListViewHide, nil, If( ::lZoom, ::oLvw:Hide(), ::oLvw:Show() ) ) }


2501     if IsAppThemed()
            nCol += 75
         endif
         ** no esta en 2212  // NO ESTABA IMPLEMENTADO TODAVIA


2212   ON CHANGE oThis:SetFactor( oThis:nZFactor )
        ** estan diferentes 
2501    ON CHANGE ( Self, oThis:SetFactor( oThis:nZFactor ) )


2212     local lThemed := IsAppThemed()
2501     no Esta


2212    METODO BUILDMENU class TPreview
** Muchas diferencias con la version 2501

2212    local nWidth, nHeight, nMaxWidth, nAspect, nMetaWidth, nGutter
        ** falta nHeight en 2501
2501    local nHeight, nMaxWidth, nAspect, nMetaWidth, nGutter     


METODO SETORG1 Y SETORG 2 
** muchas diferencias que en la 2501 no estan 



2212  METHOD CheckMouseWheel( nKeys, nDelta, nXPos, nYPos ) CLASS TPreview
        if ! ::lZoom

2501  METHOD CheckMouseWheel( nKeys, nDelta, nXPos, nYPos ) CLASS TPreview

     ( nXPos, nYPos )
    if ! ::lZoom


2501   ACTIVATE DIALOG oDlg CENTERED ;
        ON INIT ( Self, oPageIni:Disable(), oPageEnd:Disable(), .T. )
        ** no esta el self en la 2212
        
2212   METHOD PrintPage() CLASS TPreview
        ** Muchas diferencias con la 2501


2212  METHOD PrintPrv( oDlg, nOption, nPageIni, nPageEnd ) CLASS TPreview
        ** diferencias con la 2501

2212  METHOD SaveAsMenu() CLASS TPreview
        ** muchas diferencias con la 2501

2212   METHOD SaveAs( lPDF, cFile, lView ) CLASS TPreview
        ** diferebcias con la 2501

2212   METHOD SendEmail() CLASS TPreview
        ** diferencia con 2501

2212  function ConvertToWordDoc( oPreview )
        ** diferencias con la 2501

2212   Function ToWordDocViaWriter( oPreview, aFiles, cFileType )
        local oWriter, oDesktop, oDoc, oCusor, oText, oGraphic, cEMF, cURL, i, aProp
   
2501 en las variables locales falta AdsCacheOpenCursors
Muchas gracias

Saludos

Ruben Fernandez
Dario Fernandez

FWH 2501, Harbour, MVS2022 Community, MySql & MariaDB, Dbf/Cdx VSCode.

Maldonado - Uruguay
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: tPrinter
Posted: Tue May 20, 2025 06:02 AM

Ruben,

gracias por tus indicaciones.

Si nos proporcionas un PRG de como lo usas, podremos probarlo aqui y ver como ayudarte, gracias

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 555
Joined: Wed Jul 31, 2013 01:14 PM
Re: tPrinter
Posted: Tue May 20, 2025 06:10 AM

Hola Antonio,

Preparo uno y lo pongo acá.

Aquí ya es muy tarde. 3.09 Am.

Gracias, saludos

Ruben Dario Fernandez

Dario Fernandez

FWH 2501, Harbour, MVS2022 Community, MySql & MariaDB, Dbf/Cdx VSCode.

Maldonado - Uruguay
Posts: 555
Joined: Wed Jul 31, 2013 01:14 PM
Re: tPrinter
Posted: Tue May 20, 2025 06:43 AM
Maestro, aquí va
Boton "Imprimir"
En el preview boton PDF (Acrobat) y cuando solicita verlo poner si.

#include "FiveWin.ch"
#include "Ribbon.ch"


function Main()

    local n, oWin, oFont

    DEFINE DIALOG oDlg SIZE 1000,500 
    DEFINE FONT oFont  NAME "TAHOMA" SIZE 0,-14

    @ 10, 10 BUTTON  oBtn PROMPT "Imprime" OF oDlg ACTION Imprime() FONT oFont 

ACTIVATE DIALOG oDlg
oFont:End() 
    
return nil    




FUNCTION IMPRIME()

    PRINT  oPrn NAME "nada" PREVIEW  MODAL  
      oPrn:lPrvModal:=.t.

  oPrn:SetPage(1)
  oPrn:SetPortrait() 
  

  PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE
 PAGE
ENDPAGE

ENDPRINT

RETURN nil
Dario Fernandez

FWH 2501, Harbour, MVS2022 Community, MySql & MariaDB, Dbf/Cdx VSCode.

Maldonado - Uruguay
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: tPrinter
Posted: Tue May 20, 2025 09:44 AM
Aqui funciona bien, se ha generado el PDF. Que es lo que no está bien ? :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: tPrinter
Posted: Tue May 20, 2025 01:02 PM

Rubén, verifica que no estés utilizando el comando FROM USER en el comando PRINT.

Regards, saludos

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: tPrinter
Posted: Tue May 20, 2025 01:31 PM
Estimado Antonio, por favor prueba usando el comando FROM USER en WINDOWS 11. En el foro de Fivewin Brasil informaron que no funciona.
// C:\FWH\SAMPLES\RUBEN01.PRG

#include "FiveWin.ch"

FUNCTION Main()

   LOCAL n, oDlg, oFont, oBtn

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0, - 14

   DEFINE DIALOG oDlg SIZE 1000, 500 FONT oFont

   @ 10, 10 BUTTON oBtn PROMPT "Imprime" OF oDlg ACTION Imprime()

   @ 10, 20 BUTTON oBtn PROMPT "Salida " OF oDlg ACTION( oDlg:End ) CANCEL

   ACTIVATE DIALOG oDlg

   oFont:End()

RETURN NIL

FUNCTION Imprime()

   LOCAL oPrn

   PRINT oPrn NAME "Nada" PREVIEW MODAL FROM USER

   oPrn:lPrvModal := .T.

   oPrn:SetPage(1)
   oPrn:SetPortrait()

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   PAGE
      oPrn:Say( 20, 20, "This is a test in Portrait" )
   ENDPAGE

   ENDPRINT

RETURN NIL

// FIN / END
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: tPrinter
Posted: Tue May 20, 2025 03:22 PM
Tu ejemplo Joao fuciona bien tambien :wink:
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: tPrinter
Posted: Tue May 20, 2025 03:31 PM

Gracias Maestro. Probablemente fue una falla de la versión de Windows 11. ¿Nada.PDF se abre perfectamente en ADOBE? Si es así, asunto cerrado.

Gracias, tks.

Regards, saludos.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 555
Joined: Wed Jul 31, 2013 01:14 PM
Re: tPrinter
Posted: Tue May 20, 2025 06:15 PM

Hola Maestro.

Luego de dar el boton (Adobe) para pasar a PDF, me pregunta si quiero abrirlo y no lo encuentra.

El PDF se genera bien, pero no puedo abrirlo cuando se genera desde el programa FWH, porque dice que no esta.

Gracias

Ruben Dario Fernandez

Dario Fernandez

FWH 2501, Harbour, MVS2022 Community, MySql & MariaDB, Dbf/Cdx VSCode.

Maldonado - Uruguay
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: tPrinter
Posted: Tue May 20, 2025 06:31 PM

> Luego de dar el boton (Adobe) para pasar a PDF, me pregunta si quiero abrirlo y no lo encuentra.

Te muestra la ruta completa ? Aqui si

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 555
Joined: Wed Jul 31, 2013 01:14 PM
Re: tPrinter
Posted: Tue May 20, 2025 06:35 PM

Si Maestro, me muestra la ruta competa.

Si solo le doy al boton PDF y no lo quiero ver, crea el PDF con 0 byte y luego de unos momentos se crea definitivamente.

Gracias

Ruben Fernandez

Dario Fernandez

FWH 2501, Harbour, MVS2022 Community, MySql & MariaDB, Dbf/Cdx VSCode.

Maldonado - Uruguay
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: tPrinter
Posted: Tue May 20, 2025 06:48 PM
// PRV2PDF.PRG - Ruben, mira aqui:
function FWSavePreviewToPDF( oDevice, cPDF, lOpen )   // oDevice can be oPrinter or oPreview

   local cOrient, oPDF, cPRGPATH
   local hWnd

   if oDevice:IsKindOf( "TPREVIEW" )
      hWnd    := oDevice:oWnd:hWnd
      oDevice := oDevice:oDevice
   endif
#ifndef USEGDI
   if LoadFreeImage() <= 32
      MsgAlert( FWString( "freeimage.dll not found" ), FWString( "Alert" ) )
      return nil
   endif
#endif

   PRIVATE CDIRPLENO

   // MODIFICADO EM: 14/03/2016 PARA SALVAR O PDF NA PASTA: C:\NFEPDF
   cPRGPATH := cFILEPATH( "C:\NFEPDF\" )

   lCHDIR(cPRGPATH)

   // ? hb_CurDrive() + ":\" + CurDir() + "\"

   DEFAULT cPDF   := cGetFile( FWString( "PDF files | *.pdf |" ),;
                               FWString( "Select PDF File to Save" ),, ;
                               CurDir(), .T.,,,;
                               hb_CurDrive() + ":\" + CurDir() + "\" + ;
                               If( oDevice:IsKindOf( "TPreview" ),;
                               oDevice:cName, oDevice:cDocument ) + ".pdf"  )
   if ! Empty( cPDF )
      cPDF = cFileSetExt( cPDF, "pdf" )
      CursorWait()
      cOrient = If( oDevice:nHorzSize() > oDevice:nVertSize(), 'L', 'P' )
      oPdf = fwPdf():New( cPdf, cOrient )
      AEval( oDevice:aMeta, { | cMeta | oPdf:AddMeta( cMeta ) } )
      oPdf:Close()
      CursorArrow()

      DEFAULT lOpen := MsgYesNo( If( FWLanguageID() == 2, FWString( "¿" ) + " ", "" ) + ;
                       FWString( "View" ) + ;
                       " " + cPDF + " " + FWString( "(Y/N)" ) + " ?",;
                       FWString( "Please select" ) )

      if lOpen
         ShellExecute( IfNil( hWnd, GetWndDefault() ), "open", cPDF )
      endif
   else
      cPDF  := nil
   endif

   // VOLTO AO DIRETORIO DO PLENO PARA NAO QUEBRAR OS BANCOS. 14/03/2016 Joao
   lCHDIR( cDirPleno )

   // Ruben, aqui:

   ? hb_CurDrive() + ":\" + CurDir() + "\"

return cPDF
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341