HMG_HPDF - Export to PDF made easy...

HMG Samples and Enhancements

Moderator: Rathinagiri

User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: HMG_HPDF - Export to PDF made easy...

Post by bpd2000 »

Now no need to "Print Preview", code directly using HMG_HPDF,
better & best way for Print Preview

Thank you to Rathi for simple codeing method
BPD
Convert Dream into Reality through HMG
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HMG_HPDF - Export to PDF made easy...

Post by mol »

I want to refresh this topic, because I have a problem with embedding font into .pdf file.
I'm using Arial Narrow font - it is non stardard window font. But my installlation program installs it.
Everything is OK when I'm printing document. But, If I export this document do PDF, Arial Narrow is changed with normal Arial font.

I've tried to add font file to .pdf by command

Code: Select all

HPDF_LoadTTFontFromFile( _HMG_SYSDATA[ 150 ][ 1 ], MyExePath+"\arialn.ttf", .T.)
but without success.

Can anybody help me?
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: HMG_HPDF - Export to PDF made easy...

Post by EduardoLuis »

Hi Mol:

You don't need to previously load the font.-
The font file you want to use must be inside the root/folder of your app.-
Take a look a HPDF sample (line 459 - 460).-
I apply these on my app with font types that don't exist on Windows fonts folder (all print outputs of my app are PDF and some of them really complex).-
It works with no difficulty
Hoping these helps you
With regards.
Eduardo
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HMG_HPDF - Export to PDF made easy...

Post by mol »

My font file is places in application root directory, but it's not linked in .pdf file.
Maybe because it's installed in Windows, too?
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: HMG_HPDF - Export to PDF made easy...

Post by EduardoLuis »

Hi Mol:

I think it doesn't matter if font file is inside Windows font file.-
Is really well writen the font filename ??
As i see on my Windows, arial narrow filena name is "ARIALN.TTF" all in Capital Letter.-
Check that.
Hopping these helps you.
Edudardo
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HMG_HPDF - Export to PDF made easy...

Post by mol »

Can you try to generate pdf via this code:

Code: Select all


@ 20,20 HPDFPRINT "test font ARIAL- ABCDEFGHIJKLMNOP" ;
				FONT "ARIAL" ;
				SIZE 12 ;
				COLOR BLACK
@ 25,20 HPDFPRINT "test font ARIAL NARROW - ABCDEFGHIJKLMNOP" ;
				FONT "ARIAL NARROW" ;
				SIZE 12 ;
				COLOR BLACK
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: HMG_HPDF - Export to PDF made easy...

Post by EduardoLuis »

Hi Mol:

Here you get the code.-
Just for your info, i have Arial Narrow on my Win font, but you can include the font file on your app root directory
Hopping these helps you.
With Regards.
Eduardo
demo_font.zip
(1.4 MiB) Downloaded 257 times
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HMG_HPDF - Export to PDF made easy...

Post by mol »

Works OK, thanks Eduardo.
I didn't know I must use font filename directly.
But, now, I have a problem - In my app user decides which font is used to generate report. He selects windows font name.
Is it possible to get font filename from using windows font name?
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HMG_HPDF - Export to PDF made easy...

Post by mol »

It's stange - when I select other exotic font to print text - pdf contains this font.
When I use "Arial Narrow" - it uses ordinary ARIAL
franco
Posts: 818
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: HMG_HPDF - Export to PDF made easy...

Post by franco »

Hi, all
I finally have hpdfprint working nicely, but have problem to set globle font size from 12 to 10. is there a way like
SET HPDFDOC FONT SIZE TO 10 at start of document. Must be a way.
Thanks in advance, Franco
All The Best,
Franco
Canada
Post Reply