HMG 3.3.1 (Stable)

HMG Unicode versions 3.1.x related

Moderator: Rathinagiri

Post Reply
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

HMG 3.3.1 (Stable)

Post by Pablo César »

mol wrote:about export to pdf file which is realised to one pdf file, eg. HMG_MiniPrint_0001.pdf now.
I meant to ask user for base file name: HMG_MiniPrint_.
..//..
If we ask about destination folder, we can ask for file name too
Ahh yes, I understood. Some template filename as mask and being implemented at same form/window when select type file.

But needs to be approved by HMG Development Team in case.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HMG 3.3.1 (Stable)

Post by mol »

I'm trying to create PDF files from my application, and I found an error, I think.

Problem occurs when @ r1,c1 HPDFPRINT TO r2,c2 method is called with declared font name.
Any .pdf file is not created.
@ 130, 10 HPDFPRINT "This is a sample Text in BOLD and ITALIC AND GREEN" ;
TO 130,30 FONT "COURIER-NEW" SIZE 6 BOLD ITALIC COLOR {0,200,0}

sample:

Code: Select all

#include "hmg.ch"

Function Main()
 cFileName := TempFile(".","pdf",0)
SELECT HPDFDOC cFileName PAPERLENGTH 300 PAPERWIDTH 300 LOG
START HPDFDOC
    START HPDFPAGE
	
	SET HPDFDOC ENCODING TO "CP1250"
		@ 10, 10 HPDFPRINT "this is file: "+ cFileName FONT "ARIAL" SIZE 20 BOLD
		
		//working phrase
        @ 110, 10 HPDFPRINT "This is a sample Text in BOLD and ITALIC AND GREEN" ;
				TO 130,30 SIZE 6 BOLD ITALIC COLOR {0,200,0}

		//if you uncomment this phrase, any pdf will be created
		// @ 130, 10 HPDFPRINT "This is a sample Text in BOLD and ITALIC AND GREEN" ;
		//		TO 130,30 FONT "COURIER-NEW" SIZE 6 BOLD ITALIC COLOR {0,200,0}

    END HPDFPAGE
END HPDFDOC
Execute File cFileName
Return Nil
When you omit FONT "COURIER-NEW" phrase, everything goes OK.
jayadevu
Posts: 238
Joined: Tue May 19, 2009 7:10 am

Re: HMG 3.3.1 (Stable)

Post by jayadevu »

Hi Marek,

Pls use only "Courier" as font and check. IIRC "Courier-New" is not available in Haru PDF by default.

Warm regards,

Jayadev
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HMG 3.3.1 (Stable)

Post by mol »

I've tested with Arial and effect was the same :-(
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HMG 3.3.1 (Stable)

Post by mol »

I found a difference in h_HMG_HPDF.PRG source file.
In _HMG_HPDF_PRINT function definition, some piece of code from line 283 looks like that:

Code: Select all

 If HMG_UPPER( HB_USUBSTR( cFontName, HMG_LEN( cFontName ) - 3 ) ) == '.TTF' // load ttf font
In _HMG_HPDF_MULTILINE_PRINT function definition, adequate line (no. 372) differents from above:

Code: Select all

If HMG_UPPER( HB_USUBSTR( cFontName, HMG_LEN( cFontName ) - 4 ) ) == '.TTF' // load ttf font
Difference is in recognizing .TTF extension. First line is good, second is bad.
I've changed 4 to 3 in line 372, recompiled library, and it's work OK to me.
I'm testing forward.

It's a bug to correct in the next version of HMG, I think.

Regards, Marek
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: HMG 3.3.1 (Stable)

Post by Pablo César »

mol wrote:I found a difference in h_HMG_HPDF.PRG source file.
In _HMG_HPDF_PRINT function definition, some piece of code from line 283 looks like that:

Code: Select all

 If HMG_UPPER( HB_USUBSTR( cFontName, HMG_LEN( cFontName ) - 3 ) ) == '.TTF' // load ttf font
In _HMG_HPDF_MULTILINE_PRINT function definition, adequate line (no. 372) differents from above:

Code: Select all

If HMG_UPPER( HB_USUBSTR( cFontName, HMG_LEN( cFontName ) - 4 ) ) == '.TTF' // load ttf font
Difference is in recognizing .TTF extension. First line is good, second is bad.
I've changed 4 to 3 in line 372, recompiled library, and it's work OK to me.
I'm testing forward.

It's a bug to correct in the next version of HMG, I think.

Regards, Marek
Yes Marek, you are right !

I have published this solution at viewtopic.php?p=35144#p35144 because EduardoLuis has appointed this same fail.
Screen_01.PNG
Screen_01.PNG (48.97 KiB) Viewed 4889 times
Even with solution in our hands, nothing happen at new releases.
Only strong discusions about this... :(
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HMG 3.3.1 (Stable)

Post by mol »

Yes Marek, you are right !

I have published this solution at viewtopic.php?p=35144#p35144" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false; because EduardoLuis has appointed this same fail.
Sorry, I've missed it :shock:

I've found another inconsistent behaviour of HPDFPRINT.

Code: Select all

@ 10,10 HPDFPRINT RECTANGLE ;
					TO 30,200 ;
					PENWIDTH 0.2 ;
					COLOR RED
		@ 10, 10 HPDFPRINT "this is command: @ 10, 10 HPDFPRINT 'this is sample text' FONT 'ARIAL' SIZE 20 BOLD" FONT "ARIAL" SIZE 20 BOLD

	@ 50,10 HPDFPRINT RECTANGLE ;
					TO 70,200 ;
					PENWIDTH 0.2 ;
					COLOR GREEN
		
	@ 50, 10 HPDFPRINT "this is command: @ 10, 10 HPDFPRINT 'this is sample text' TO 70,200 FONT 'ARIAL' SIZE 20 BOLD" TO 70,200 FONT "ARIAL" SIZE 20 BOLD
first line generates text above coordinates, second does it under coordinates, see image:
Image
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HMG 3.3.1 (Stable)

Post by mol »

I found another problem.
When you define fontname with hyperlink:

Code: Select all

@ 280,205 HPDFURLLINK "Program FAKTURY - MOL-Systemy Komputerowe" TO "http://www.molsystemy.pl";
							FONT "ARIAL" ;
							SIZE 6 ;
							COLOR BLUE ;
							RIGHT
any pdf is generated.

solution is the same as with HPDFPRINT - change lines 1036 and 1129.

By the way, is it a way do avoid rectangle around hyperllink id generated pdf document?
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HMG 3.3.1 (Stable)

Post by mol »

As I wrote before, It wolud be fine to write print preview to file which name correspond to printed document.
The name of saved file can be taken from user or from printdoc name.
eg.
if use start to print document:

start printdoc name YourPrintDocumentName


"YourDocumentName" is stored to _HMG_SYSDATA[ 358 ]
it would be great to change line 4583 in h_controlmisc.prg from:

d := e + 'HMG_MiniPrint_' + StrZero ( i , 4 )
to

d := e + charrepl(":/.,|\@#$%&^*+ ",_HMG_SYSDATA [ 358 ],"_") + "_" + StrZero ( i , 4 )


This solution will save you printpreview to file which name is based on printdoc name.


Regards, Marek
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: HMG 3.3.1 (Stable)

Post by Rathinagiri »

Thanks a lot Marek.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Post Reply