Page 1 of 1
Impresion de Imagenes con TPRINTER
Posted: Sun Jun 27, 2021 3:19 pm
by JoseAlvarez
Hola a todos, feliz domingo.
Dejo esta consulta por acá a ver quien me da una mano.
Necesito imprimir el logo de la empresa del cliente en los reportes de mi sistema con la clase TPRINTER.
Se me presenta el problema con las diferentes resoluciones de impresoras. No se imprime igual
En algunas se ve como debe verse, en otras mas grande o mas pequeño,
Hace dias consulte como hacer lo mismo con los textos y con la ayuda de joao y francisco lo resolví.
Pero ahora el problema lo tengo con las imagenes.
Quedo a la espera y agradezco la ayuda que puedan prestarme.
FW17.01 + bcc7 + xHarbour
Re: Impresion de Imagenes con TPRINTER
Posted: Mon Jun 28, 2021 2:54 am
by Dioni
oPrn:PrintImage(0,0,"dioni.png",580,240) <------ formato bmp,jpg, otros
Esto trabaja perfectamente en impresoras de tinta, lasser, ticketera y puedes grabarlo en formato pdf para visualizarlo
y luego el usuario podra selecionar cuanquier impresora y podra imprimir respetando el tamaño y colo que tenga.
o deja tu programa donde utilizas la impresion... para ver la falla
Te recomiendo actualizar tu fivewin 17.01 a fivewin 21.06
Re: Impresion de Imagenes con TPRINTER
Posted: Mon Jun 28, 2021 3:12 am
by nageswaragunupudi
Method PrintImage() works with FWH1701 also.
But we do not recomment using pixels for the size. Instead we recommend using Inches/CM/MM for the size so that the image will print with the same dimensions irrespective of the printer resolution.
So we recommend using this command which translates to PrintImage()
Code: Select all | Expand
#xcommand @ <nRow>, <nCol> PRINT TO <prn> IMAGE <img> ;
[SIZE <nWidth> [,<nHeight>] ] ;
[<unit: PIXEL,MM,CM,INCHES>] ;
[<lStr: STRETCH>] ;
[ ALPHALEVEL <nAlpha>] ;
[<lNoTrn: NOTRANSPARENT>] ;
[<lGray: GRAY> ] ;
[LASTROW <lrow>] ;
=> ;
[<lrow> := ] <prn>:PrintImage( <nRow>, <nCol>, <img>, [<nWidth>], [<nHeight>], ;
[<.lStr.>], [<nAlpha>], [!<.lNoTrn.>], [<.lGray.>], [<(unit)>] )
Example Usage:
Code: Select all | Expand
@ 2,2 PTINT TO oPrn IMAGE <anyimagefilename> SIZE 2,3 INCHES
Re: Impresion de Imagenes con TPRINTER
Posted: Mon Jun 28, 2021 8:19 am
by Sebastián Almirón
Yo tuve muchos problemas con eso al principio, desde hace mas de 15 años adjunto a mis programas estas dos pequeñas funciones y a partir de ellas paso todos los parametros en centimetros con decimales, me funciona muy bien.
Por ejemplo :
oimagen := TImage():Define(logo.jpg')
oPrint:SayImage(Posx(nposx) , Posy(nposy) , oimagen, posx(nancho), posy(nalto))
Code: Select all | Expand
//------------------------------------------------------------------------------
// Posx(valor)
//
// Devuelve la posicion logica x expresada en centimetos en valor del objeto
// tprinter oPrint
//
function posx(valor, oxPrint)
local sal
DEFAULT oxPrint := oPrint
if oxPrint:hdc = 0
sal := Max( 0, valor * 14 * oxPrint:nVertRes() / oxPrint:nVertSize() - oxPrint:nXoffset ) + 15
else
sal := valor*(oxPrint:nLogPixelX()/2.6)
endif
return sal
//------------------------------------------------------------------------------
// Posy(valor)
//
// Devuelve la posicion logica y expresada en centimetos en valor del objeto
// tprinter oPrint
//
function Posy(valor, oxPrint)
local sal
DEFAULT oxPrint := oPrint
if oxPrint:hdc = 0
sal := Max( 0, ( valor * 9.4 * oxPrint:nHorzRes() / oxPrint:nHorzSize() ) - oxPrint:nYoffset )
else
sal := valor*(oxPrint:nLogPixelY()/2.6)
endif
return sal
Re: Impresion de Imagenes con TPRINTER
Posted: Mon Jun 28, 2021 9:55 am
by nageswaragunupudi
Sebastián Almirón wrote:Yo tuve muchos problemas con eso al principio, desde hace mas de 15 años adjunto a mis programas estas dos pequeñas funciones y a partir de ellas paso todos los parametros en centimetros con decimales, me funciona muy bien.
Por ejemplo :
oimagen := TImage():Define(logo.jpg')
oPrint:SayImage(Posx(nposx) , Posy(nposy) , oimagen, posx(nancho), posy(nalto))
Code: Select all | Expand
//------------------------------------------------------------------------------
// Posx(valor)
//
// Devuelve la posicion logica x expresada en centimetos en valor del objeto
// tprinter oPrint
//
function posx(valor, oxPrint)
local sal
DEFAULT oxPrint := oPrint
if oxPrint:hdc = 0
sal := Max( 0, valor * 14 * oxPrint:nVertRes() / oxPrint:nVertSize() - oxPrint:nXoffset ) + 15
else
sal := valor*(oxPrint:nLogPixelX()/2.6)
endif
return sal
//------------------------------------------------------------------------------
// Posy(valor)
//
// Devuelve la posicion logica y expresada en centimetos en valor del objeto
// tprinter oPrint
//
function Posy(valor, oxPrint)
local sal
DEFAULT oxPrint := oPrint
if oxPrint:hdc = 0
sal := Max( 0, ( valor * 9.4 * oxPrint:nHorzRes() / oxPrint:nHorzSize() ) - oxPrint:nYoffset )
else
sal := valor*(oxPrint:nLogPixelY()/2.6)
endif
return sal
All this is not necessary if you follow the advice of FiveTech given in my posting above.
Re: Impresion de Imagenes con TPRINTER
Posted: Mon Jun 28, 2021 3:03 pm
by karinha
De esta manera, también se ve genial.
Code: Select all | Expand
@ nLinLogo, nColLogo PRINT TO oPrn IMAGE "LOGO.JPG" ;
SIZE nLargLogo, nAltLogo PIXEL ALPHALEVEL 90
Saludos.
Re: Impresion de Imagenes con TPRINTER
Posted: Mon Jun 28, 2021 4:00 pm
by nageswaragunupudi
karinha wrote:De esta manera, también se ve genial.
Code: Select all | Expand
@ nLinLogo, nColLogo PRINT TO oPrn IMAGE "LOGO.JPG" ;
SIZE nLargLogo, nAltLogo PIXEL ALPHALEVEL 90
Saludos.
We highly discourage using PIXEL. This may differ with different printers and totally not compatible with pdf generation using harupdf.
Please express all coordinates in inches or cm or mm and specify the units as INCHES or CM or MM instead of PIXEL
Re: Impresion de Imagenes con TPRINTER
Posted: Mon Jun 28, 2021 4:20 pm
by karinha
nageswaragunupudi wrote:karinha wrote:De esta manera, también se ve genial.
Code: Select all | Expand
@ nLinLogo, nColLogo PRINT TO oPrn IMAGE "LOGO.JPG" ;
SIZE nLargLogo, nAltLogo PIXEL ALPHALEVEL 90
Saludos.
We highly discourage using PIXEL. This may differ with different printers and totally not compatible with pdf generation using harupdf.
Please express all coordinates in inches or cm or mm and specify the units as INCHES or CM or MM instead of PIXEL
Thank you master, I didn't know that. Living and learning.
Regards, saludos.
Re: Impresion de Imagenes con TPRINTER SOLUCIONADO
Posted: Wed Jun 30, 2021 8:18 pm
by JoseAlvarez
Hola A todos.
Gracias a quienes contestaron a mi inquietud y al foro FW.
Mr. Rao, esto
Code: Select all | Expand
@ 2,2 PRINT TO oPrn IMAGE <anyimagefilename> SIZE 2,3 INCHES
me arroja el siguiente error
Error description: Warning BASE/1004 Message not found: TPRINTER:PRINTIMAGE¿que estoy haciendo mal?
Joao, lo que me indicaste
Code: Select all | Expand
@ nLinLogo, nColLogo PRINT TO oPrn IMAGE "LOGO.JPG" ;
SIZE nLargLogo, nAltLogo PIXEL ALPHALEVEL 90
funcionó muy bien y a la primera en todas las impresoras que probé, GRACIAS !!
Sebastián, las funciones y el ejemplo que pusiste funcionó de 10 y a la primera. Muchas Gracias !!
Para mi forma de trabajar, me quedo con la sugerencia de sebastian. Se adapta mejor a mis metodos.
Un Saludo a Todos.