HMG_HPDF - Export to PDF made easy...

HMG Samples and Enhancements

Moderator: Rathinagiri

User avatar
bpd2000
Posts: 1013
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 163 times
Been thanked: 70 times

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

Post by bpd2000 » Sun Sep 30, 2012 3:47 pm

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: 2991
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 161 times
Been thanked: 87 times
Contact:

Post by mol » Tue Feb 27, 2018 7:42 pm

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: 558
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina
Been thanked: 33 times

Post by EduardoLuis » Wed Feb 28, 2018 1:43 pm

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: 2991
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 161 times
Been thanked: 87 times
Contact:

Post by mol » Wed Feb 28, 2018 1:52 pm

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: 558
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina
Been thanked: 33 times

Post by EduardoLuis » Wed Feb 28, 2018 3:13 pm

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: 2991
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 161 times
Been thanked: 87 times
Contact:

Post by mol » Wed Feb 28, 2018 6:42 pm

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: 558
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina
Been thanked: 33 times

Post by EduardoLuis » Wed Feb 28, 2018 8:56 pm

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 59 times

User avatar
mol
Posts: 2991
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 161 times
Been thanked: 87 times
Contact:

Post by mol » Thu Mar 01, 2018 6:39 am

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: 2991
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 161 times
Been thanked: 87 times
Contact:

Post by mol » Thu Mar 01, 2018 6:48 am

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: 246
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 9 times

Post by franco » Fri Mar 02, 2018 1:47 am

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

Post Reply