Thanks CarlosCarlos Britos wrote:...in the hmg cousin, oohg exist a code to print in pdf.
The class is TPrint, maybe adapting this code to hmg. The file is h_print.prg.
Seen.
Very complex for me
May be a guru will adapt it
TIA
Moderator: Rathinagiri
Thanks CarlosCarlos Britos wrote:...in the hmg cousin, oohg exist a code to print in pdf.
The class is TPrint, maybe adapting this code to hmg. The file is h_print.prg.
Code: Select all
#include <hmg.ch>
#include "harupdf.ch"
Function Main
define window main at 0, 0 width 800 height 600 main
define button print
row 10
col 10
caption 'PDF'
action pdf_create()
end button
end window
main.center
main.activate
Return
function pdf_create
LOCAL pdf := HPDF_New()
IF pdf == NIL
MsgInfo( "PDF could not be created!" )
RETURN NIL
ENDIF
page := HPDF_AddPage( pdf )
height := HPDF_Page_GetHeight( page )
width := HPDF_Page_GetWidth( page )
def_font := HPDF_GetFont( pdf, "Helvetica", NIL )
HPDF_Page_SetFontAndSize( page, def_font, 24 )
tw := HPDF_Page_TextWidth( page, 'This is the page title' )
HPDF_Page_BeginText( page )
HPDF_Page_TextOut( page, ( width - tw ) / 2, height - 50, 'This is the page title' )
HPDF_Page_EndText( page )
HPDF_SaveToFile( pdf, 'giri.pdf' )
HPDF_Free( pdf )
execute file 'giri.pdf'
return nil
Thanks, very good method and extremely useful starting, as alwaysrathinagiri wrote:I have tried to use libhbpdf from the official distribution from Harbour.
IMHO, it will be easy to adapt with HMG print commands. I start creating a wrapper for HMG print commands and hbpdf library. Let us make it happen.
This is my first pdf file.
You have to add 'libs=libhpdf' in configuration.
Thanks a lot Rathi,rathinagiri wrote: HaruPDF is based on LibHaru. The full documentation API can be seen here.
http://libharu.org/wiki/Documentation
I think we can make a quick and simple wrapper for this library using HMG print commands.
implement the HMG print commands is a bit confusingrathinagiri wrote:The library is very extensive and powerful too.
First we shall try to implement the HMG print commands. Then we can extend further. What do you think?
Code: Select all
SetPrintSystem( <"Standard"> / <"HaruPDF"> )
or
SET PRINT SYSTEM <"Standard"> / <"HaruPDF">
Code: Select all
start pdfdoc => start Hpdfdoc
start pdfpage => start Hpdfpage
@ 10, 10 pdfprint :> @ 10, 10 Hpdfprint