Page 1 of 3

tPrinter

Posted: Tue May 20, 2025 2:12 am
by D.Fernandez
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

Re: tPrinter

Posted: Tue May 20, 2025 2:46 am
by Antonio Linares
Puedes proporcionar un PRG para probarlo ?

gracias

Re: tPrinter Creo que esto es mejor

Posted: Tue May 20, 2025 4:15 am
by D.Fernandez
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

Code: Select all | Expand


 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

Re: tPrinter

Posted: Tue May 20, 2025 6:02 am
by Antonio Linares
Ruben,

gracias por tus indicaciones.

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

Re: tPrinter

Posted: Tue May 20, 2025 6:10 am
by D.Fernandez
Hola Antonio,

Preparo uno y lo pongo acá.

Aquí ya es muy tarde. 3.09 Am.

Gracias, saludos

Ruben Dario Fernandez

Re: tPrinter

Posted: Tue May 20, 2025 6:43 am
by D.Fernandez
Maestro, aquí va
Boton "Imprimir"
En el preview boton PDF (Acrobat) y cuando solicita verlo poner si.

Code: Select all | Expand

#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

Re: tPrinter

Posted: Tue May 20, 2025 9:44 am
by Antonio Linares
Aqui funciona bien, se ha generado el PDF. Que es lo que no está bien ? :-)

Re: tPrinter

Posted: Tue May 20, 2025 1:02 pm
by karinha
Rubén, verifica que no estés utilizando el comando FROM USER en el comando PRINT.

Regards, saludos

Re: tPrinter

Posted: Tue May 20, 2025 1:31 pm
by karinha
Estimado Antonio, por favor prueba usando el comando FROM USER en WINDOWS 11. En el foro de Fivewin Brasil informaron que no funciona.

Code: Select all | Expand

// 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.

Re: tPrinter

Posted: Tue May 20, 2025 3:22 pm
by Antonio Linares
Tu ejemplo Joao fuciona bien tambien :wink:

Re: tPrinter

Posted: Tue May 20, 2025 3:31 pm
by karinha
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.

Re: tPrinter

Posted: Tue May 20, 2025 6:15 pm
by D.Fernandez
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

Re: tPrinter

Posted: Tue May 20, 2025 6:31 pm
by Antonio Linares
> 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

Re: tPrinter

Posted: Tue May 20, 2025 6:35 pm
by D.Fernandez
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

Re: tPrinter

Posted: Tue May 20, 2025 6:48 pm
by karinha
// PRV2PDF.PRG - Ruben, mira aqui:

Code: Select all | Expand

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.