Jump to content
Fivewin Brasil

xtsystem

Membros
  • Posts

    21
  • Joined

  • Last visited

Status Updates posted by xtsystem

  1. Ola Ribeiro. Vi alguns comentarios de voce la no forum, tentanto gerar um codigo QR.

    Tentei de todas as formas. Voce pode me dar alguma dica ?

    Obrigado

     

    1. Show previous comments  3 more
    2. oribeiro

      oribeiro

      Só consegui gerando um bitmap mesmo. Não sei fazer de outro modo.

      Mas essa rotina gera um BITMAP, importa-o para a memória e o apaga no disco, daí, com ele na memória é possível imprimir ou mostrar na tela como faz esse exemplo.

    3. xtsystem

      xtsystem

      OK Ribeiro. Agradeço muito a sua ajuda e vou procurar saber se tem como gerar o codigo somente na memória e imprimir. q

    4. oribeiro

      oribeiro

      Achei esse código, veja se funciona: ( Ele depende da Biblioteca gratuita da ZEBRA ). Você pode encontrá-la na internet.

         // CODIGO QRCODE//
         local cCode   := "20219719443 | 01 | F001 | 00045256 | 25/01/2018 | 18.00 | 118.00 | 6 | 10087302682 |" +CHR(13)+CHR(10)+ "Gerado no OASySItu.Com"
         local nWidth  := 0
         local nHeight := 0
         local nX      := 18
         local nY      := 18
         local oX      := 11
         local oY      := 11
         local hBrush
         local hZebra
         local oFontText
         local oPrn
         local oBmp, hBmp, hBrush1, hBrush2, hGraf
      
         // CRIA QRCODE  //
         hBrush    := CreateSolidBrush( 0 )
         hZebra    := hb_Zebra_Create_Qrcode( cCode, NIL )
      
         // PRINT QRCODE //
         DEFINE FONT oFontText NAME "Calibri" SIZE 0, -11
         PRINT oPrn NAME "Imprimir QrCode" PREVIEW
         PAGE
            // imprime o QRCode //
            hb_zebra_draw( hZebra, { | x, y, w, h | nWidth := x + w, nHeight := y + h, FillRect( oPrn:hDCOut, { y, x, y + h, x + w }, hBrush ) }, nX, nY, oX, oY )
            // imprime o Texto  //
            oFontText:Activate( oPrn:hDCOut )
            DrawText( oPrn:hDCOut, cCode, { nHeight + 10, nX - 4, nHeight + 24, nWidth + 4 }, 0 )
            oFontText:DeActivate( oPrn:hDCOut )
         ENDPAGE
         ENDPRINT
         oFontText:End()
      
         // SAVE BMP-PNG //
         hBrush1   := GdiPlusNewSolidBrush( 255, 255, 255, 255 )
         hBrush2   := GdiPlusNewSolidBrush( 255,   0,   0,   0 )
         oBmp      := GdiBmp():New()
         hBmp      := GdiPlusBmpFromBrush( nWidth + nX, nHeight + nY, hBrush1 )
         hGraf     := GdiPlusHGraFFromHBmp( hBmp )
         hb_zebra_draw( hZebra, { | x, y, w, h | GdiPlusDrawRect( hGraf, , hBrush2, x, y, w, h ) }, nX, nY, oX - 0.5, oY - 0.5 )
         oBmp:hBmp := hBmp
         GdiPlusDeleteGraphics( hGraf )
         GdiPlusDeleteBrush( hBrush2  )
         GdiPlusDeleteBrush( hBrush1  )
         oBmp:Save( "QRCODE.PNG" )
         oBmp:End()

       

×
×
  • Create New...