Print Preview in HMG, CatchysoftActiveX,PrintPreview Activex

Moderator: Rathinagiri

User avatar
esgici
Posts: 4539
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 410 times
Been thanked: 118 times
Contact:

Re: Print Preview in HMG, CatchysoftActiveX,PrintPreview Act

Post 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
Viva INTERNATIONAL HMG :D

User avatar
Rathinagiri
Posts: 5351
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 211 times
Been thanked: 232 times
Contact:

Post 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
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
esgici
Posts: 4539
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 410 times
Been thanked: 118 times
Contact:

Post 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 :D

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 ?
Viva INTERNATIONAL HMG :D

User avatar
Rathinagiri
Posts: 5351
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 211 times
Been thanked: 232 times
Contact:

Post 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.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
esgici
Posts: 4539
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 410 times
Been thanked: 118 times
Contact:

Post 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
Viva INTERNATIONAL HMG :D

User avatar
Rathinagiri
Posts: 5351
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 211 times
Been thanked: 232 times
Contact:

Post 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?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
esgici
Posts: 4539
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 410 times
Been thanked: 118 times
Contact:

Post 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 :D

Best regards
Viva INTERNATIONAL HMG :D

User avatar
Rathinagiri
Posts: 5351
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 211 times
Been thanked: 232 times
Contact:

Post 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.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
esgici
Posts: 4539
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 410 times
Been thanked: 118 times
Contact:

Post by esgici »

Perfect :arrow:

Thanks a lot :)

Best regards
Viva INTERNATIONAL HMG :D

User avatar
esgici
Posts: 4539
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 410 times
Been thanked: 118 times
Contact:

Post 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
Viva INTERNATIONAL HMG :D

Post Reply