Page 2 of 3
Re: Print Preview in HMG, CatchysoftActiveX,PrintPreview Act
Posted: Mon Sep 24, 2012 4:51 pm
by esgici
Carlos 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.
Thanks Carlos
Seen.
Very complex for me
May be a guru will adapt it
TIA
Re: Print Preview in HMG, CatchysoftActiveX,PrintPreview Act
Posted: Thu Sep 27, 2012 6:40 am
by Rathinagiri
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.
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
Re: Print Preview in HMG, CatchysoftActiveX,PrintPreview Act
Posted: Thu Sep 27, 2012 7:52 am
by esgici
Hi Rathi
rathinagiri 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, very good method and extremely useful starting, as always
Do you think improving it and please guide us: where we find documentation on HaruPDF
As always I say, you are a real diamond
Best regards
PS: Will be good to open a separate thread / topic for this subject ?
Re: Print Preview in HMG, CatchysoftActiveX,PrintPreview Act
Posted: Thu Sep 27, 2012 8:03 am
by Rathinagiri
Hi Esgici,
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.
Re: Print Preview in HMG, CatchysoftActiveX,PrintPreview Act
Posted: Thu Sep 27, 2012 8:09 am
by esgici
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.
Thanks a lot Rathi,
I'll go into it
Best regards
Re: Print Preview in HMG, CatchysoftActiveX,PrintPreview Act
Posted: Thu Sep 27, 2012 8:14 am
by Rathinagiri
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?
Re: Print Preview in HMG, CatchysoftActiveX,PrintPreview Act
Posted: Thu Sep 27, 2012 8:43 am
by esgici
Hi Rathi
rathinagiri 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?
implement the HMG print commands is a bit confusing
Since we must protect current HMG print system, do yo think something like this :
Code: Select all
SetPrintSystem( <"Standard"> / <"HaruPDF"> )
or
SET PRINT SYSTEM <"Standard"> / <"HaruPDF">
If so, will be perfect for me
And "extend further" too is a good news
Best regards
Re: Print Preview in HMG, CatchysoftActiveX,PrintPreview Act
Posted: Thu Sep 27, 2012 9:49 am
by Rathinagiri
No. I am thinking of not touching HMG commands at all but having a similar structure.
For example:
start printdoc => start pdfdoc
start printpage => start pdfpage
@ 10, 10 print => @ 10, 10 pdfprint
like that.
Re: Print Preview in HMG, CatchysoftActiveX,PrintPreview Act
Posted: Thu Sep 27, 2012 10:03 am
by esgici
Perfect
Thanks a lot
Best regards
Re: Print Preview in HMG, CatchysoftActiveX,PrintPreview Act
Posted: Thu Sep 27, 2012 10:15 am
by esgici
Just remember: does we will have in the future more pdf-building systems other than Haru ?
So we add a prefix to keywords, such as:
Code: Select all
start pdfdoc => start Hpdfdoc
start pdfpage => start Hpdfpage
@ 10, 10 pdfprint :> @ 10, 10 Hpdfprint
Only an idea
Best regards