FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Preview a PDF con imagen de fondo
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Preview a PDF con imagen de fondo
Posted: Sat Jul 06, 2024 02:59 PM
Please locate the METHOD PrintImage(…) in fwh\classes\fwpdf.prg:
At the beginning, in the local's declaration, add gState
Change this line
Code (fw): Select all Collapse
local image, oRect, nRet, aSize
as
Code (fw): Select all Collapse
local image, oRect, nRet, aSize, gState
Now locate these lines of code at the end of this method:
Code (fw): Select all Collapse
   if !Empty( cUrl )
      ::SetLinkToURL( oRect:aRect, cURL )
   endif

   HPDF_Page_DrawImage( ::hPage, image, oRect:nLeft, ::nHeight - oRect:nTop - oRect:nHeight, ;
            oRect:nWidth, oRect:nHeight /* iw, ih*/)

   nRet  := oRect:nBottom
   ::Pix2Units( nil, @nRet, , , cUnits )

return nRet
Replace it with these lines of code:
Code (fw): Select all Collapse
   if !Empty( cUrl )
      ::SetLinkToURL( oRect:aRect, cURL )
   endif

   if nAlpha != nil
      HPDF_Page_GSave( ::hPage )
      gState := HPDF_CreateExtGState( ::hPdf )
      HPDF_ExtGState_SetAlphaFill( gState, nAlpha/255 )
      HPDF_Page_SetExtGState( ::hPage, gState )
   endif

   HPDF_Page_DrawImage( ::hPage, image, oRect:nLeft, ::nHeight - oRect:nTop - oRect:nHeight, ;
            oRect:nWidth, oRect:nHeight /* iw, ih*/)

   nRet  := oRect:nBottom
   ::Pix2Units( nil, @nRet, , , cUnits )

   if nAlpha != nil
      HPDF_Page_GRestore( ::hPage )
   endif

return nRet
You can now play with the alpha levels to your taste and get the results as you desire.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: Preview a PDF con imagen de fondo
Posted: Sat Jul 06, 2024 03:32 PM

Intenté hacer los cambios pero me da error, pero creo que es debido a que tengo mal la version de la libreria.

Voy a ponerme en contacto para actualizar a la última versión y luego aplicar estos cambios, o aguardar a la versión con estos cambios modificados.

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Preview a PDF con imagen de fondo
Posted: Sat Jul 06, 2024 03:39 PM

What is your FWH version?

Regards



G. N. Rao.

Hyderabad, India
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: Preview a PDF con imagen de fondo
Posted: Sat Jul 06, 2024 03:56 PM
Mi versión adquirida es 22.06, pero Antonio me facilitó las librerias actualizadas (solo las librerias) para hacer pruebas en unos ejemplo de Whatsapp, y sobreescribi la libreria que había adquirido, por lo que los prg de fwh\source no se corresponden con los que tiene la libreria.
El error que me da es el siguiente
Code (fw): Select all Collapse
   Descripcion: Error BASE/1126  Error de argumento: STRTRAN
   Args:
     [   1] = N   0
     [   2] = C   #PGC#
     [   3] = C   2

Pila de Llamadas
===========
   LLamado por:  => STRTRAN( 0 )
   LLamado por: .\source\classes\printer.prg => TPRINTER:GENHARUPDF( 1911 )
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Preview a PDF con imagen de fondo
Posted: Sat Jul 06, 2024 05:45 PM

Please write to me

nageswaragunupudi[at]gmail[dot]com

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Preview a PDF con imagen de fondo
Posted: Thu Jul 25, 2024 03:36 PM

Further improvement:

In addition to harupdf, now even the fwh own created pdf works correctly. The gray color problem is resolved.

Will be available from the next version to be released.

Regards



G. N. Rao.

Hyderabad, India
Posts: 470
Joined: Fri Feb 05, 2010 11:30 AM
Re: Preview a PDF con imagen de fondo
Posted: Thu Aug 15, 2024 12:01 PM

Gracias Sr. Rao,

En la vista previa, se ve bien el PNG, pero cuando lo imprimimos, el fondo

se ve de color negro.

Para los que tengamos versiones anteriores, que modificación deberíamos

hacer en la clase para verlo correctamente??

Muchas gracias...

Roberto

Univ@c I.S.I.
Desarrolladores de Software
http://www.elcolegioencasa.ar
Posts: 470
Joined: Fri Feb 05, 2010 11:30 AM
Re: Preview a PDF con imagen de fondo (PNG)
Posted: Mon Aug 26, 2024 02:32 PM

Mr. Nages, dow can I solve this?

Thanks, thanks,thanks!!

Roberto

Univ@c I.S.I.
Desarrolladores de Software
http://www.elcolegioencasa.ar

Continue the discussion