Gerar PDF
Moderador: Moderadores
Gerar PDF
Boa tarde!
Estou migrando meu xharbour de 0.99..... para a versão Xharbour 1.2.3 intel.(Simplex) (Build 20201212), com GTWVW, varios erros princiapamente meus de coisa mau feita, relaxo mesmo!
Ai tenho um rotina que gera pdf usando o txt, rotinas essa que peguei aqui mesmo no forum a muito tempo e funciona bem até hoje muito. Só não estou achando mais a lib que contem essa funções abaixo, caso alguem tenha a lib ja compilada para disponibílizar agradeço.
PDFNEW()
Function PDFSTARTPAGE()
Function PDFDRAWPAGE()
Function PDFENDPAGE()
Function PDFEND()
Frazato
Estou migrando meu xharbour de 0.99..... para a versão Xharbour 1.2.3 intel.(Simplex) (Build 20201212), com GTWVW, varios erros princiapamente meus de coisa mau feita, relaxo mesmo!
Ai tenho um rotina que gera pdf usando o txt, rotinas essa que peguei aqui mesmo no forum a muito tempo e funciona bem até hoje muito. Só não estou achando mais a lib que contem essa funções abaixo, caso alguem tenha a lib ja compilada para disponibílizar agradeço.
PDFNEW()
Function PDFSTARTPAGE()
Function PDFDRAWPAGE()
Function PDFENDPAGE()
Function PDFEND()
Frazato
Gerar PDF
Tarde!
Como não consegui achar essas funções e já tinha convertido essa mesma função para o Harbour que por sinal foi muito mais facil de compilar, usei essas libs que peguei no projeto MRboleto.
hbhpdf.lib libharu.lib hbzebra.lib png.lib
Frazato
Como não consegui achar essas funções e já tinha convertido essa mesma função para o Harbour que por sinal foi muito mais facil de compilar, usei essas libs que peguei no projeto MRboleto.
hbhpdf.lib libharu.lib hbzebra.lib png.lib
Frazato
Código: Selecionar todos
#include "harupdf.ch"
*******************
Function GERA_PDF(cARQ,cVisualiza)
*******************
LOCAL font_list := { ;
"Courier" , ;
"Courier-Bold" , ;
"Courier-Oblique" , ;
"Courier-BoldOblique" , ;
"Helvetica" , ;
"Helvetica-Bold" , ;
"Helvetica-Oblique" , ;
"Helvetica-BoldOblique" , ;
"Times-Roman" , ;
"Times-Bold" , ;
"Times-Italic" , ;
"Times-BoldItalic" , ;
"Symbol" , ;
"ZapfDingbats" }
Local Page, nSeq := 0
Local pdf
centra(24,"Aguarde Gerando Documento PDF...")
Do While .t.
nSeq++
If ! File("p:\temp\JAF_"+StrZero(nSeq,4)+'.PDF')
cFILE3 := "p:\temp\JAF_"+StrZero(nSeq,4)+'.PDF'
Exit
Endif
If nSeq >=9999
Alerta("Faca a limpeza da pasta p:\temp\")
Endif
Enddo
//cFile3 := 'c:\temp\joao.pdf'
Sele Preview
nFonte := 7
nOpcao := AlertJAF("DESTINO"+;
' ',{"### Normal ###",;
"### Compactado DRE ###",;
"### Romaneio ###" },"WW+/BR+,BB+/N" )
cFile := "fundo.jpg"
? pdf := HPDF_New()
IF pdf == NIL
Alerta( "PDF could not be created!" )
RETURN NIL
Else
? 'ok.. criando pdf sucesso!'
Endif
/* set compression mode */
HPDF_SetCompressionMode( pdf, HPDF_COMP_ALL )
page := HPDF_AddPage( pdf )
height := HPDF_Page_GetHeight( page )
width := HPDF_Page_GetWidth( page )
def_font := HPDF_GetFont( pdf, font_list[1], NIL )
HPDF_Page_SetFontAndSize( page, def_font, nFonte )
tw := HPDF_Page_TextWidth( page,' page_title')
HPDF_Page_BeginText( page )
HPDF_Page_TextOut( page, 10, height - 60, "" ) //
//HPDF_Page_TextOut( page, 60, height - 60, "" ) //
dbgotop()
cCONT=0
cQuebra:= .f.
Do while !Eof()
cLinha := l001+l002+l003+l004+l005+l006+l007+l008+l009+l010
cCONT=cCONT+1
cLinha := StrTran(cLinha,'Ä','=')
I=0
For I:= 1 to Len(cLinha)
//---- Ajusta caracter
If Substr(cLinha,i,1)==Chr(12)
cQuebra:= .t.
Exit
Endif
Next
if cQuebra==.t.
HPDF_Page_ShowText( page, clinha )
HPDF_Page_MoveTextPos( page, 0, - 10 ) //18
page := HPDF_AddPage( pdf )
height := HPDF_Page_GetHeight( page )
width := HPDF_Page_GetWidth( page )
def_font := HPDF_GetFont( pdf, font_list[1], NIL )
HPDF_Page_SetFontAndSize( page, def_font, nFonte )
tw := HPDF_Page_TextWidth( page,' page_title')
HPDF_Page_BeginText( page )
HPDF_Page_TextOut( page, 10, height - 60, "" ) //40
cQuebra:= .f.
cCONT=0
Else
HPDF_Page_ShowText( page, clinha )
HPDF_Page_MoveTextPos( page, 0, - 10 ) //18
ENDIF
dbskip()
enddo
IF HPDF_SaveToFile( pdf, cFile3) != 0
Alerta('Erro criacao do PDF!')
ENDIF
HPDF_Free(pdf )
Alerta('Criado arquivo....'+cFile3)
Return cFile3
Gerar PDF
converti meu sistema usando harbour em modo console ainda, tem como gerar pdf em modo console ?
-
Kapiaba
- Colaborador

- Mensagens: 1908
- Registrado em: 07 Dez 2012 16:14
- Localização: São Paulo
- Contato:
Gerar PDF
Boa tarde, eu usaria uma impressora virtual, tipo: PDFMACHINE, excelente e tem uma versão gratuíta. E você já vai se acostumando com o mundo for windows. Depois, vá migrando seu sistema para Windows, é muito fácil. Obg. abs.
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Gerar PDF
Acho que não precisa tanto.
Uma vez em PDF atende o Windows também.
Veja se ajuda:
https://github.com/JoseQuintas/pdfclass
Tive que retirar a parte Windows pra ficar mais "padrão", mas acho que tá tranquilo.
Pode começar apenas fazendo igual, mas pode acrescentar recursos visuais.
Uma vez em PDF atende o Windows também.
Veja se ajuda:
https://github.com/JoseQuintas/pdfclass
Tive que retirar a parte Windows pra ficar mais "padrão", mas acho que tá tranquilo.
Pode começar apenas fazendo igual, mas pode acrescentar recursos visuais.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, 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/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, 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/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Gerar PDF
Relatório simples, estilo tradicional, mas usando minha classe de MySQL
Código: Selecionar todos
STATIC FUNCTION imprime()
LOCAL oPDF, nKey, cnSQL := ADOLocal()
oPDF := PDFClass():New()
oPDF:SetType( nOpcPrinterType )
oPDF:Begin()
nKey = 0
oPDF:acHeader := { "","",""}
oPDF:acHeader[ 1 ] = "LISTAGEM DO CADASTRO DE CIDADES/PAISES"
oPDF:acHeader[ 3 ] = Space(43) + "CODIGO NOME------------------------------------- UF"
WITH OBJECT cnSQL
:cSQL := "SELECT IDCIDADE, CINOME, CIUF ORDER BY CINOME"
:Execute()
DO WHILE nKey != K_ESC .AND. ! :Eof()
GrafProc()
nKey = Inkey()
oPDF:MaxRowTest()
oPDF:DrawText( oPDF:nRow, 44, Str( :Number( "IDCIDADE" ), 6 ) )
oPDF:DrawText( oPDF:nRow, 52, :String( "CINOME", 21 ) )
oPDF:DrawText( oPDF:nRow, 96, :String( "CIUF", 2 ) )
oPDF:nRow += 1
:MoveNext()
ENDDO
:CloseRecordset()
ENDWITH
oPDF:End()
RETURN .T.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, 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/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, 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/
Gerar PDF
Por favor, saberia me informar:
1) como faço para colocar texto colorido?
2) como faço para incluir uma imagem no pdf?
Grato
1) como faço para colocar texto colorido?
2) como faço para incluir uma imagem no pdf?
Grato
Inacio de Carvalho Neto
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Gerar PDF
Nas pastas do harbour tem exemplo, contrib/hbhpdf
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, 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/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, 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/
Gerar PDF
Olhei todos os arquivos desta pasta, não achei resposta às minhas perguntas.
Pode me ajudar?
Pode me ajudar?
Inacio de Carvalho Neto
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Gerar PDF
No exemplo do harbour tem texto colorido e imagem, é o que você quer.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, 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/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, 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/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Gerar PDF
O exemplo gerado tem 29 páginas, o colorido está na página 5.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, 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/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, 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/
Gerar PDF
Executei o test.prg que consta nessa pasta do contrib. Veja o que deu no anexo. Não abre pdf.
Inacio de Carvalho Neto
- PAULO S
- Usuário Nível 3

- Mensagens: 176
- Registrado em: 24 Abr 2006 09:18
- Localização: Santo Anastácio - SP
Gerar PDF
Caros colegas,
Uso o PDFCreator com um sistema que gera relatórios com imagem de logomarca e funciona bem no Windows 7 32 bits gerando tudo em PDF.
Testei este mesmo sistema no Windows 10 e não está conseguindo fazer a impressão em PDF no PDFCreator. Fica enviando para o driver da impressora virtual e não finaliza.
Alguém já passou por este mesmo problema ?
Uso o PDFCreator com um sistema que gera relatórios com imagem de logomarca e funciona bem no Windows 7 32 bits gerando tudo em PDF.
Testei este mesmo sistema no Windows 10 e não está conseguindo fazer a impressão em PDF no PDFCreator. Fica enviando para o driver da impressora virtual e não finaliza.
Alguém já passou por este mesmo problema ?
Paulo
Clipper 5.2d/NTX -> xHarbour/CDX
Clipper 5.2d/NTX -> xHarbour/CDX
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Gerar PDF
Inácio, não uso harbour 3.2.
No 3.4 o exemplo roda redondo.
Se no harbour que está usando não compila nem o teste, pode ser seu harbour 3.2 com problema.
Outros que usam podem confirmar se o problema é geral.
No 3.4 o exemplo roda redondo.
Se no harbour que está usando não compila nem o teste, pode ser seu harbour 3.2 com problema.
Outros que usam podem confirmar se o problema é geral.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, 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/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, 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/

