PdfClass como fazer um retangulo com fundo colorido?

Projeto [x]Harbour - Compilador de código aberto compatível com o Clipper.

Moderador: Moderadores

Avatar do usuário
ANDRIL
Usuário Nível 5
Usuário Nível 5
Mensagens: 1322
Registrado em: 06 Jul 2004 00:44
Contato:

PdfClass como fazer um retangulo com fundo colorido?

Mensagem por ANDRIL »

Bom dia!

Estou desenhando um retangulo, gostaria de colocar as letras pretas e o fundo cinza usando o PDFClass do José Quintas.

Código: Selecionar todos

 oPDF:DrawRetangle( 9, 0, nMaxCol/4, 5.5, Nil, Nil, Nil ) //fundo cinza
 oPDF:DrawText( 10, 1, "Vendedor:", Nil, 8, "Helvetica", Nil, Nil )  //letras pretas
Já procurei na documentação
https://libharu.sourceforge.net/example ... mage_demo_
e fiz testes, consegui alterar a linha do box mas não o background.

Há essa possibilidade?
Clipper 5.2e / Blinker 5.1 / Harbour 3.2 / GTwvg
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20453
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP
Curtiram: 1 vez

Re: PdfClass como fazer um retangulo com fundo colorido?

Mensagem por JoséQuintas »

Acho que não pensei nisso, mas dá uma olhada no método DrawZebrado() ou algo assim.
Talvez com base nele possamos alterar o DrawRetangle(), se precisar.
A forma de definir cor na harupdf não é igual windows, e não lembro se tentei converter, na época.
José M. C. Quintas
Harbour 3.2, mingw, multithread, gtwvg, fivewin 25.12, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui), (hmg3), (hmg extended), (oohg), PNotepad, ASP, (Linux/Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20453
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP
Curtiram: 1 vez

Re: PdfClass como fazer um retangulo com fundo colorido?

Mensagem por JoséQuintas »

olhando o manual da harupdf

List of Color Operators
HPDF_Page_SetGrayFill
HPDF_Page_SetGrayStroke
HPDF_Page_SetRGBFill
HPDF_Page_SetRGBStroke
HPDF_Page_SetCMYKFill
HPDF_Page_SetCMYKStroke

List of Path Painting Operators
HPDF_Page_Stroke
HPDF_Page_ClosePathStroke
HPDF_Page_Fill
HPDF_Page_Eofill
HPDF_Page_FillStroke
HPDF_Page_EofillStroke
HPDF_Page_ClosePathFillStroke
HPDF_Page_ClosePathEofillStroke
HPDF_Page_EndPath

A primeira lista apenas define o padrão
A segunda lista, não sei se tem mais, define um preenchimento
Pra certas coisas, tem a definição e o fim da definição, que seria pra cada desenho.
https://libharu.sourceforge.net/graphics.html

No harbour tem exemplo colorido.


.
José M. C. Quintas
Harbour 3.2, mingw, multithread, gtwvg, fivewin 25.12, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui), (hmg3), (hmg extended), (oohg), PNotepad, ASP, (Linux/Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20453
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP
Curtiram: 1 vez

Re: PdfClass como fazer um retangulo com fundo colorido?

Mensagem por JoséQuintas »

test.prg do harbour
ex1.png
ex1.png (107.59 KiB) Exibido 166 vezes
ex2.png
ex2.png (36.94 KiB) Exibido 166 vezes
José M. C. Quintas
Harbour 3.2, mingw, multithread, gtwvg, fivewin 25.12, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui), (hmg3), (hmg extended), (oohg), PNotepad, ASP, (Linux/Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
ANDRIL
Usuário Nível 5
Usuário Nível 5
Mensagens: 1322
Registrado em: 06 Jul 2004 00:44
Contato:

Re: PdfClass como fazer um retangulo com fundo colorido?

Mensagem por ANDRIL »

Olá José!
Seguindo sua dica de verificar o método DrawZebrado() fiz as alterações abaixo:

Era:
oPDF:DrawRetangle( 9, 0, nMaxCol/4, 5.5, Nil, Nil, Nil )
Mudei para
oPDF:DrawRetangle( 9, 0, nMaxCol/4, 5.5, 0.2, 2, {0.7,0.7,0.7} )

Funcionou, desenha um retangulo com a cor cinza no background.
Obrigado!
Clipper 5.2e / Blinker 5.1 / Harbour 3.2 / GTwvg
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20453
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP
Curtiram: 1 vez

Re: PdfClass como fazer um retangulo com fundo colorido?

Mensagem por JoséQuintas »

Agora que fui olhar os fontes da PDFClass.
Tenho uma versão local, de meu uso, e a do github que é pública.
Nenhuma das duas tem esse DrawRetangle()

Não é pra esconder recursos.
Por exemplo, na minha versão local tem o preview de quando usa saída matricial, obrigando o uso de GTWVG.
Durante a criação do PDF, também mostro na tela a numeração de página que está sendo gerada, é interessante pra acompanhamento.
Isso não poderia estar na versão pública, porque tela depende de lib gráfica em uso, e até se é windows ou linux.
E sabemos que existem muitas libs gráficas: gtwvg, gtwvt, hwgui, hmg 3, hmg extended, oohg, fivewin, xailer, etc.
É complicado manter duas versões da mesma coisa, mas no caso da pdfclass acabou sendo necessário.
Eventualmente posso adicionar algum recurso na versão local, pra testar primeiro, e esquecer de atualizar na versão pública depois.
José M. C. Quintas
Harbour 3.2, mingw, multithread, gtwvg, fivewin 25.12, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui), (hmg3), (hmg extended), (oohg), PNotepad, ASP, (Linux/Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
ANDRIL
Usuário Nível 5
Usuário Nível 5
Mensagens: 1322
Registrado em: 06 Jul 2004 00:44
Contato:

Re: PdfClass como fazer um retangulo com fundo colorido?

Mensagem por ANDRIL »

José, buscando no forum como fazer um recibo em PDF achei um tópico acho que 2017 do Jairo, onde ele conseguiu desenhar um recibo e deixou um ZIP com o fonte. Neste zip estava a PdfClass, e através deste exemplo, fui criando o meu recibo.

Tempo depois achei um post que tinha seu repositorio no GitHub, onde baixei a versão mais atual da PdfClass e realmente não dinha a DrawRetangle(), acabei adicionando ela na versão mais recente para compatibilidade com meu código.

Parabéns pelo projeto!
Clipper 5.2e / Blinker 5.1 / Harbour 3.2 / GTwvg
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20453
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP
Curtiram: 1 vez

Re: PdfClass como fazer um retangulo com fundo colorido?

Mensagem por JoséQuintas »

Na atual tem DrawBox(), talvez seja equivalente.

Um modelo de uso, não específico de DrawBox(), é o boleto, da BoletoClass

Um outro, está com o uso de MySQL do meu aplicativo, mas seria trocar pra texto simples e/ou outra base de dados.
É com a pdfclass atual e DrawBox():

Código: Selecionar todos

/*
PJPPEDIDOFATURA - IMPRIME FATURA PARA PEDIDO
2007.04.01 - José Quintas
*/

#define SMALL_FONT 6
#define NORMAL_FONT 8

PROCEDURE PJPPEDIDOFATURA( nIdPedido ) // do Pedido

   LOCAL oPDF, nCont, cExtenso, acTxt
   LOCAL cnSQL := ADOLocal()

   WITH OBJECT cnSQL
      :cSQL := "SELECT JPPEDIDO.*, JPCADASTRO.*, JPEMPRESA.*" + ;
         " FROM JPPEDIDO" + ;
         " LEFT JOIN JPCADASTRO ON JPCADASTRO.IDCADASTRO = JPPEDIDO.PDCADASTRO" + ;
         " LEFT JOIN JPEMPRESA ON JPEMPRESA.IDEMPRESA = " + NumberSQL( AppFilial() ) + ;
         " WHERE IDPEDIDO = " + NumberSQL( nIdPedido )
      :Execute()
      oPDF := PDFClass():New()
      oPDF:SetType( 2 )
      oPDF:nDrawMode := 2
      oPDF:nPDFPage  := 2
      oPDF:cFontName := "Helvetica"
      oPDF:Begin()
      oPDF:AddPage()
      FOR nCont = 0 TO 150 STEP 150
         acTxt := TextToArray( :String( "EMNOME" ), 30 )
         oPDF:DrawBox( nCont + 6, 5, nCont + 130, 191 )

         oPDF:DrawBox(   nCont + 8,    6,  nCont + 36, 93 )
         oPDF:DrawMemImageBox( nCont + 9, 7, nCont + 34, 32, ze_BinaryFromSQL( AppEmpresaApelido() + ".jpg" ) )
         IF Len( acTxt ) > 0
            oPDF:DrawText( nCont + 15, 35, acTxt[ 1 ], , NORMAL_FONT )
            IF Len( acTxt ) > 1
               oPDF:DrawText( nCont + 18, 35, acTxt[ 2 ], , NORMAL_FONT )
            ENDIF
         ENDIF
         oPDF:DrawText( nCont + 23,   35, :String( "EMENDERECO" ), , SMALL_FONT )
         oPDF:DrawText( nCont + 26,   35, :String( "EMBAIRRO" ) + " " + :String( "EMCIDADE" ) + " " + :String( "EMUF" ), , SMALL_FONT )
         oPDF:DrawText( nCont + 29,   35, "CEP " + :String( "EMCEP" ), , SMALL_FONT )
         oPDF:DrawText( nCont + 32,   35, "Telefone " + :String( "EMTELEFONE" ), , SMALL_FONT )

         oPDF:DrawBox(  nCont + 8,    97, nCont + 36, 190 )
         oPDF:DrawText( nCont + 13,   99, :String( "EMENDERECO" ), , SMALL_FONT )
         oPDF:DrawText( nCont + 16,   99, :String( "EMBAIRRO" ) + " " + :String( "EMCIDADE" ) + " " + :String( "EMUF" ), , SMALL_FONT )
         oPDF:DrawText( nCont + 19,   99, "CEP " + :String( "EMCEP" ), , SMALL_FONT )
         oPDF:DrawText( nCont + 22,   99, "Telefone " + :String( "EMTELEFONE" ), , SMALL_FONT )
         oPDF:DrawText( nCont + 25,   99, "CNPJ: " + :String( "EMCNPJ" ) + Space(10) + "Insc.Est.:" + :String( "EMINSEST" ), , SMALL_FONT )
         oPDF:DrawText( nCont + 33,   99, "Data da emissão: " + Dtoc( :Date( "PDDATEMI" ) ), , NORMAL_FONT )

         oPDF:DrawBox(  nCont + 38,    6,  nCont + 128, 38 )

         oPDF:DrawBox(  nCont + 38,   41, nCont + 50, 160 )
         oPDF:DrawLine( nCont + 38,   68, nCont + 50, 68 )
         oPDF:DrawLine( nCont + 38,  104, nCont + 50, 104 )
         oPDF:DrawLine( nCont + 38,  140, nCont + 50, 140 )
         oPDF:DrawBox(  nCont + 38,  161, nCont + 62, 190 )
         oPDF:DrawText( nCont + 40,  163, "Para uso da", , SMALL_FONT )
         oPDF:DrawText( nCont + 43,  163, "Instituição Financeira", , SMALL_FONT )

         oPDF:DrawText( nCont + 40,   43, "Fatura no.", , SMALL_FONT )
         oPDF:DrawText( nCont + 40,   70, "Valor Fatura/Duplicata", , SMALL_FONT )
         oPDF:DrawText( nCont + 40,  106, "Duplicata/N.Ordem", , SMALL_FONT )
         oPDF:DrawText( nCont + 40,  142, "Vencimento", , SMALL_FONT )
         oPDF:DrawText( nCont + 45,   43, :Number( "IDPEDIDO" ), "999999", NORMAL_FONT )
         oPDF:DrawText( nCont + 45,  70, :Number( "PDVALNOT" ), "@E 999,999,999.99", NORMAL_FONT )
         oPDF:DrawText( nCont + 45,  106, Str( :Number( "IDPEDIDO" ), 6 ) + "/01", , NORMAL_FONT )
         oPDF:DrawText( nCont + 45,  142, "A VISTA", , NORMAL_FONT )
         oPDF:DrawLine( nCont + 42,   41, nCont + 42, 160 )

         oPDF:DrawBox(  nCont + 51,   41, nCont + 61, 160 )
         oPDF:DrawText( nCont + 56,   43, "Condições especiais", , SMALL_FONT )

         oPDF:DrawBox(  nCont + 62,   41, nCont + 79, 190 )
         oPDF:DrawText( nCont + 68,   43, "Nome do Sacado:", , SMALL_FONT )
         oPDF:DrawText( nCont + 68,   62, :String( "CDNOME" ), , NORMAL_FONT )
         oPDF:DrawText( nCont + 71,   43, "Endereço:", , SMALL_FONT )
         oPDF:DrawText( nCont + 71,   62, :String( "CDENDERECO" ) + " " + :String( "CDNUMERO" ), , NORMAL_FONT )
         oPDF:DrawText( nCont + 74,   43, "Município:", , SMALL_FONT )
         oPDF:DrawText( nCont + 74,   62, :String( "CDCIDADE" ), , NORMAL_FONT )
         oPDF:DrawText( nCont + 74,  145, "UF:", , SMALL_FONT )
         oPDF:DrawText( nCont + 74,  150, :String( "CDUF" ), , NORMAL_FONT )
         oPDF:DrawText( nCont + 74,  155, "CEP:", , SMALL_FONT )
         oPDF:DrawText( nCont + 74,  164, :String( "CDCEP" ), , NORMAL_FONT )
         oPDF:DrawText( nCont + 77,   43, "CNPJ:", , SMALL_FONT )
         oPDF:DrawText( nCont + 77,   55, :String( "CDCNPJ" ), , NORMAL_FONT )
         oPDF:DrawText( nCont + 77,  109, "Insc.Est.:", , SMALL_FONT )
         oPDF:DrawText( nCont + 77,  120, :String( "CDINSEST" ), , NORMAL_FONT )
         oPDF:DrawBox(  nCont + 81,   41, nCont + 90, 190 )
         oPDF:DrawText( nCont + 85,   43, "Pça do Pagamento", , SMALL_FONT )
         oPDF:DrawText( nCont + 85,  145, "UF:", , SMALL_FONT )
         oPDF:DrawText( nCont + 85,  155, "CEP:", , SMALL_FONT )
         oPDF:DrawText( nCont + 88,   43, "Endereço:", , SMALL_FONT )
         oPDF:DrawBox(  nCont + 91,   41, nCont + 101, 190 )
         oPDF:DrawLine( nCont + 91,   57, nCont + 101, 57 )
         cExtenso := Pad( ExtensoValor( :Number( "PDVALNOT" ) ), 180, "*" )
         oPDF:DrawText( nCont + 94,   43, "Valor", , SMALL_FONT )
         oPDF:DrawText( nCont + 94,   60, Substr( cExtenso, 1, 60 ), , NORMAL_FONT )
         oPDF:DrawText( nCont + 97,   43, "por", , SMALL_FONT )
         oPDF:DrawText( nCont + 97,   60, Substr( cExtenso, 61, 60 ), , NORMAL_FONT )
         oPDF:DrawText( nCont + 100,  43, "Extenso", , SMALL_FONT )
         oPDF:DrawText( nCont + 100,  60, Substr( cExtenso, 121, 60 ), , NORMAL_FONT )
         oPDF:DrawBox(  nCont + 102,  41, nCont + 127, 190 )
         oPDF:DrawText( nCont + 107,  43, "Reconheço(emos) a exatidão desta duplicata de venda mercantil na importância acima, que pagarei(emos)", , SMALL_FONT )
         oPDF:DrawText( nCont + 110,  43, "à " + :String( "EMNOME" ) + " ou à sua ordem na praça e vencimento acima indicados.", , SMALL_FONT )
         oPDF:DrawText( nCont + 113,  43, "Na falta de pagamento no vencimento, serão cobrados juros legais, mais despesas bancárias.", , SMALL_FONT )
         oPDF:DrawText( nCont + 121,  43, :Date( "PDDATEMI" ), , NORMAL_FONT )
         oPDF:DrawLine( nCont + 121, 108, nCont + 121, 178 )
         oPDF:DrawText( nCont + 124,  43, "Data do aceite", , SMALL_FONT )
         oPDF:DrawText( nCont + 124, 132, "Assinatura do Sacado", , SMALL_FONT )

         oPDF:DrawLine( nCont + 51,   32, nCont + 104, 32 )
         oPDF:DrawText( nCont + 104,  36, :String( "EMNOME" ), , SMALL_FONT, , 90 )
      NEXT
      :CloseRecordset()
   ENDWITH
   oPDF:End()

   RETURN
duplicata.png
duplicata.png (241.83 KiB) Exibido 99 vezes
José M. C. Quintas
Harbour 3.2, mingw, multithread, gtwvg, fivewin 25.12, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui), (hmg3), (hmg extended), (oohg), PNotepad, ASP, (Linux/Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20453
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP
Curtiram: 1 vez

Re: PdfClass como fazer um retangulo com fundo colorido?

Mensagem por JoséQuintas »

A do boleto, faz parte de boletoclass no github
Note que é uma classe com "INHERIT", é uma classe que recebe PDFClass como herança.
Em outras palavras: é a PDFClass alterada, onde o fonte só contém o que foi alterado - isso é uso de herança (INHERIT)
Classe STATIC é uma classe de uso apenas local, apenas nesse fonte, mesmo conceito de variável STATIC.

Código: Selecionar todos

#include "hbclass.ch"

FUNCTION ze_BoletoToPDF( aBoletoList, cFileName, oPDF, lPreview )

   LOCAL oBoleto, oPDFBoleto

   IF Empty( aBoletoList )
      RETURN Nil
   ENDIF
   IF ValType( aBoletoList ) != "A"
      aBoletoList := { aBoletoList }
   ENDIF
   oPDFBoleto := BoletoPDFClass():New()
   oPDFBoleto:Begin( oPDF, oPDF == Nil )
   FOR EACH oBoleto IN aBoletoList
      oPDFBoleto:Add( oBoleto )
   NEXT
   IF ! Empty( cFileName )
      oPDFBoleto:cFileName := cFileName
   ENDIF
   oPDFBoleto:End( lPreview )
   oPDF := oPDFBoleto:oPDF

   RETURN oPDF

CREATE CLASS BoletoPDFClass INHERIT PDFClass STATIC

   VAR    nFontSizeXLarge   INIT 13
   VAR    nFontSizeLarge    INIT 11
   VAR    nFontSizeSmall    INIT 6
   VAR    nFontSizeNormal   INIT 9
   VAR    cFontName         INIT "Helvetica"
   VAR    nDrawMode         INIT 2 // mm
   VAR    nPdfPage          INIT 2 // Portrait
   VAR    oPDF

   METHOD Init()
   METHOD Add( oBoleto )
   METHOD DrawBoleto( oBoleto, nVia, nLine )

   ENDCLASS

METHOD Init() CLASS BoletoPDFClass

   ::SetType( 2 )

   RETURN Nil

METHOD Add( oBoleto ) CLASS BoletoPDFClass

   ::AddPage()

   ::DrawBoleto( oBoleto, 1, 90 )
   ::DrawBoleto( oBoleto, 2, 198 )

   RETURN Nil

METHOD DrawBoleto( oBoleto, nVia, nLine ) CLASS BoletoPDFClass

   LOCAL cRawLogotipo, aPDFMsgList := {}, cTxt
   LOCAL cTxtGolpe := "Confira sempre os dados no pagamento e evite golpes"


   cRawLogotipo := Logotipo( oBoleto:nBanco )
   IF ! Empty( oBoleto:dDatDesconto ) .AND. ! Empty( oBoleto:nValDesconto )
      AAdd( aPDFMsgList, "DESCONTO DE R$ " + LTrim( Transform( oBoleto:nValDesconto, "@E 999,999.99" ) ) + ;
         " SE FOR PAGO ATÉ " + Dtoc( oBoleto:dDatDesconto ) )
   ENDIF
   IF oBoleto:nJuros != 0
      AAdd( aPDFMsgList, "APÓS VENCIMENTO COBRAR R$ " + ;
         Ltrim( Transform( oBoleto:nValor * oBoleto:nJuros / 30 / 100, "@E 999,999.99" ) ) + " POR DIA DE ATRASO" )
   ENDIF
   IF oBoleto:nMulta != 0
      AAdd( aPDFMsgList, "MULTA APÓS VENCIMENTO R$ " + ;
         Ltrim( Transform( oBoleto:nValor * oBoleto:nMulta / 100, "@E 999,999.99" ) ) )
   ENDIF
   IF hb_AScan( oBoleto:aMsgCodList, { | e | e == "43" } ) != 0
      AAdd( aPDFMsgList, "SUJEITO A PROTESTO SE NÃO FOR PAGO NO VENCIMENTO" )
   ELSE
      IF oBoleto:nProtesto != 0
         AAdd( aPDFMsgList, "PROTESTAR EM " + Ltrim( Str( oBoleto:nProtesto, 2 ) ) + " DIAS" )
      ENDIF
   ENDIF
   FOR EACH cTxt IN oBoleto:aMsgTxtList
      AAdd( aPDFMsgList, cTxt )
   NEXT
   AAdd( aPDFMsgList, cTxtGolpe )

   ::DrawLine( nLine - 7, 20, nLine - 7, 197, 1 )
   IF ! Empty( cRawLogotipo )
      ::DrawMemImageBox( nLine, 20, nLine + 7, 46, cRawLogotipo )
   ENDIF
   ::DrawText( nLine, 75, cTxtGolpe,,::nFontSizeNormal )
   IF nVia == 1
      ::DrawText( nLine, 159, "Recibo do Pagador",, ::nFontSizeNormal )
   ENDIF
   ::DrawLine( nLine + 2, 55, nLine + 8, 55 )
   ::DrawLine( nLine + 2, 71, nLine + 8, 71 )
   ::DrawText( nLine + 7, 75, Transform( oBoleto:cDigitavel, "@R 99999.99999 99999.999999 99999.999999 9 99999999999999" ), , ::nfontsizeLarge )

   ::DrawText( nLine + 7, 58, oBoleto:cBancoDigito, , ::nfontsizeXLarge )
   ::DrawLine( nLine + 9, 158, nLine + 68, 158 )
   ::DrawLine( nLine + 9,  20, nLine + 9, 197 )

   ::DrawText( nLine + 13,  20, "Local de Pagamento", , ::nfontsizeSmall )
   ::DrawText( nLine + 13, 159, "Vencimento", , ::nfontsizeSmall )
   ::DrawText( nLine + 16,  20, oBoleto:cLocalPagto, , ::nfontsizeNormal )
   ::DrawText( nLine + 16, 159, hb_Dtoc( oBoleto:dDatVen, "DD/MM/YYYY" ), , ::nfontsizeNormal )

   ::DrawLine( nLine + 17,  20, nLine + 17, 197 )
   ::DrawText( nLine + 19,  20, "Beneficiário" )
   ::DrawText( nLine + 19,  127, "CNPJ/CPF" ,, ::nFontSizeSmall )
   ::DrawText( nLine + 19, 159, "Agência/Código Beneficiário", , ::nfontsizeSmall )
   ::DrawText( nLine + 22,  20, oBoleto:cEmpNome, , ::nFontSizeNormal )
   ::DrawText( nLine + 22,  127, FormatCnpj( oBoleto:cEmpCnpj ),, ::nFontSizeNormal )
   ::DrawText( nLine + 25,  20, oBoleto:cEmpCEP + " " + oBoleto:cEmpEnd + " " + oBoleto:cEmpCidade + " " + oBoleto:cEmpUF, , ::nFontSizeNormal )
   ::DrawText( nLine + 25, 159, oBoleto:cBolConta, , ::nfontsizeNormal )

   ::DrawLine( nLine + 26,  20, nLine + 26, 197 )

   ::DrawLine( nLine + 26,  48, nLine + 38,  48 )
   ::DrawLine( nLine + 26,  76, nLine + 38,  76 )
   ::DrawLine( nLine + 26, 104, nLine + 38, 104 )
   ::DrawLine( nLine + 26, 132, nLine + 38, 132 )

   ::DrawText( nLine + 28,  20, "Data do Documento", , ::nfontsizeSmall )
   ::DrawText( nLine + 28,  51, "No.Documento", , ::nfontsizeSmall )
   ::DrawText( nLine + 28,  79, "Espécie Doc", , ::nfontsizeSmall )
   ::DrawText( nLine + 28, 107, "Aceite", , ::nfontsizeSmall )
   ::DrawText( nLine + 28, 137, "Data Processamento", , ::nfontsizeSmall )
   ::DrawText( nLine + 28, 159, "Nosso Número", , ::nfontsizeSmall )
   ::DrawText( nLine + 31,  20, hb_Dtoc( oBoleto:dDatEmi, "DD/MM/YYYY" ), , ::nfontsizeNormal )
   ::DrawText( nLine + 31,  51, oBoleto:cNumDoc, , ::nfontsizeNormal )
   ::DrawText( nLine + 31,  79, oBoleto:cBolEspecie, , ::nfontsizeNormal )
   ::DrawText( nLine + 31, 107, oBoleto:cAceite, , ::nfontsizeNormal )
   ::DrawText( nLine + 31, 137, hb_Dtoc( Date(), "DD/MM/YYYY" ), , ::nfontsizeNormal )

   ::DrawText( nLine + 31, 159, oBoleto:cBolNumero, , ::nfontsizeNormal )

   ::DrawLine( nLine + 32,  20, nLine + 32, 197 )

   ::DrawText( nLine + 34,  20, "Uso do Banco", , ::nfontsizeSmall )
   ::DrawText( nLine + 34,  51, "Carteira", , ::nfontsizeSmall )
   ::DrawText( nLine + 34,  79, "Espécie", , ::nfontsizeSmall )
   ::DrawText( nLine + 34, 107, "Quantidade", , ::nfontsizeSmall )
   ::DrawText( nLine + 34, 135, "Valor", , ::nfontsizeSmall )
   ::DrawText( nLine + 34, 159, "(-) Valor do Documento", , ::nfontsizeSmall )
   ::DrawText( nLine + 37,  51, StrZero( oBoleto:nCarteira, 3 ), , ::nfontsizeNormal )
   ::DrawText( nLine + 37,  79, "R$", , ::nfontsizeNormal )
   ::DrawText( nLine + 37, 175, Transform( oBoleto:nValor, "@E 999,999,999.99" ), , ::nfontsizeNormal )

   ::DrawLine( nLine + 38,  20, nLine + 38, 197 )
   ::DrawText( nLine + 40,  20, "Instruções de responsabilidade do BENEFICIÁRIO",, ::nfontSizeSmall )
   ::DrawText( nLine + 40, 159, "(-) Desconto/Abatimento", , ::nfontsizeSmall )

   ::DrawText( nLine + 42,  20, "Qualquer dúvida sobre este boleto, contate o BENEFICIÁRIO", , ::nfontsizeSmall )
   FOR EACH cTxt IN aPDFMsgList
      ::DrawText( nLine + 42 + ( cTxt:__EnumIndex * 3 ),  20, cTxt, , ::nfontsizeNormal )
   NEXT
   IF nVia == 2 .AND. ! Empty( oBoleto:cPixCode )
      ::DrawBarcodeQRCode( nLine + 39, 128, 0.8, oBoleto:cPixCode )
   ENDIF

   ::DrawLine( nLine + 44, 158, nLine + 44, 197 )

   ::DrawLine( nLine + 50, 158, nLine + 50, 197 )
   ::DrawText( nLine + 52, 159, "(+) Juros/Multa", , ::nfontsizeSmall )

   ::DrawLine( nLine + 56, 158, nLine + 56, 197 )

   IF nVia == 2 .AND. ! Empty( oBoleto:cPixCode )
      ::DrawText( nLine + 58, 20, "Escolha a forma mais conveniente pra realizar seu pagamento. Código de Barras ou QRCode",, ::nFontSizeSmall )
      ::DrawText( nLine + 60, 20, "Basta acessar o aplicativo da sua instituição financeira e utilizar apenas uma das opções",, ::nFontSizeSmall )
      ::DrawText( nLine + 62, 20, "Pix Copia e Cola",, ::nFontSizeSmall )
      ::DrawText( nLine + 64, 20, Left( oBoleto:cPixCode, 80 ) )
      ::DrawText( nLine + 66, 20, Substr( oBoleto:cPixCode, 81 ) )
   ENDIF

   ::DrawLine( nLine + 62, 158, nLine + 62, 197 )
   ::DrawText( nLine + 64, 159, "(=) Valor Cobrado", , ::nfontsizeSmall )

   ::DrawLine( nLine + 68,  20, nLine + 68, 197 )
   ::DrawText( nLine + 71,  20, "Pagador:",, ::nFontSizeSmall )
   ::DrawText( nLine + 71,  30, oBoleto:cCliNome, , ::nfontsizeNormal )
   ::DrawText( nLine + 71, 150, "CNPJ",, ::nFontSizeSmall )
   ::DrawText( nLine + 71, 170, FormatCnpj( oBoleto:cCliCnpj ),, ::nFontSizeNormal )
   ::DrawText( nLine + 74,  30, oBoleto:cCliEnd, , ::nfontsizeNormal )
   ::DrawText( nLine + 77,  30, oBoleto:cCliCep + " " + oBoleto:cCliEnd + " " + oBoleto:cCliCidade + " " + oBoleto:cCliUF, , ::nfontsizeNormal )

   ::DrawText( nLine + 82,  20, "Beneficiário final",, ::nFontSizeSmall )
   IF ! Empty( oBoleto:cPixCode )
      ::DrawText( nLine + 82, 150, "CNPJ",, ::nFontSizeSmall )
   ELSE
      ::DrawText( nLine + 82,  42, oBoleto:cAvalNome, , ::nfontsizeNormal )
   ENDIF

   ::DrawText( nLine + 82,  18, oBoleto:cBancoNome, , ::nfontsizeSmall,,90 )

   ::DrawLine( nLine + 84,  20, nLine + 84, 197 )
   IF nVia == 1
      ::DrawText( nLine + 86, 145, "Autenticação Mecânica", , ::nfontsizeSmall )
   ELSE
      ::DrawText( nLine + 86, 145, "Ficha de Compensação", , ::nFontsizeSmall )
      ::DrawText( nLine + 88, 145, "Autenticação Mecânica", , ::nfontsizeSmall )
      ::DrawI25BarCode( nLine + 86, 20, 10, oBoleto:cBarras )
   ENDIF
   ::DrawText( nLine + 85, 10, cTxtGolpe, , ::nFontSizeNormal, , 90 )

   RETURN Nil

STATIC FUNCTION Logotipo( nBanco, cRawLogotipo )

   cRawLogotipo := ze_BinaryFromSQL( "banco" + StrZero( nBanco, 3 ) + ".jpg" )

   RETURN cRawLogotipo
boleto.png
boleto.png (200.69 KiB) Exibido 96 vezes

Por falar nisso......
Acrescentei a mensagem de alerta sobre golpes, nos boletos.
Também alterei PDFClass pra salvar como somente leitura, e uma senha qualquer pra edição, como forma de tentar proteger o arquivo contra fraude.
José M. C. Quintas
Harbour 3.2, mingw, multithread, gtwvg, fivewin 25.12, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui), (hmg3), (hmg extended), (oohg), PNotepad, ASP, (Linux/Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Responder