Good afternoon for all, looking in the forum I found some functions that our friend Cristobal Navararro published, to generate the QR codes to the hard disk. Then as images I add them to the report in ER.
- Code: Select all Expand view
***************
*CREA CODIGO QR
***************
function BarCode(valor)
local nX := 18
local nY := 18
local hFont
local cCode := valor
DEFINE FONT oFontText NAME "Calibri" SIZE 0, -11
if Empty( hBrush )
hBrush := CreateSolidBrush( 0 )
hZebra := hb_Zebra_Create_Qrcode( cCode, NIL )
hb_zebra_draw( hZebra, { | x, y, w, h | nWidth := x + w, nHeight := y + h, ;
FillRect( dwpri:hDC, { y, x, y + h, x + w }, hBrush ) }, nX, nY, 11, 11 )
oFontText:Activate( dwpri:hDC )
DrawText( dwpri:hDC, cCode, { nHeight + 10 , nX - 4, nHeight + 24, nWidth + 4 }, 0 )
oFontText:DeActivate( dwpri:hDC )
endif
return nil
******************
*LO GRABA EN DISCO
******************
Function SaveCode(vNomQR)
local ruta := Pub:DIRLOCAL+Pub:CODEMP+"\REP\"
local oBmp
local hGraf
local hBmp
local hBrush1 := GdiPlusNewSolidBrush( 255, 255, 255, 255 )
local hBrush2 := GdiPlusNewSolidBrush( 255, 0, 0, 0 )
local nombreCodigo := Retorna_Caracter(vNomQR)
oBmp := GdiBmp():New()
hBmp := GdiPlusBmpFromBrush( nWidth + 18, nHeight + 18, hBrush1 )
hGraf := GdiPlusHGraFFromHBmp( hBmp )
hb_zebra_draw( hZebra, { | x, y, w, h | GdiPlusDrawRect( hGraf, , hBrush2, x, y, w, h ) }, 18, 18, 11, 11 )
oBmp:hBmp := hBmp
GdiPlusDeleteGraphics( hGraf )
GdiPlusDeleteBrush( hBrush2 )
GdiPlusDeleteBrush( hBrush1 )
oBmp:Save( ruta+nombreCodigo+".png" )
oBmp:End()
Return nil
//----------------------------------------------------------------------------//
Testing the code that Mr. Nages told me, I managed to generate a pdf file from the preview to the hard drive, also including the QR code.
- Code: Select all Expand view
EASYREPORT oVRD NAME Pub:DIRLOCAL+Pub:CODEMP+"\REP\factura.vrd" PREVIEW .T. FILE rutaPDF
....
...
END EASYREPORT oVRD
The problem that I find now is that it only works well when I enter the system and perform the first preview, send the complete pdf file to the hard disk. But at the moment of generating the second preview whatever it may be, what it generates is a blank page.
I do not know if this is a bug of fw, because it also happens in the preview of the tprint class.
Can someone give me a clue to solve the problem?
translated to english in google