Page 3 of 10

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

Posted: Sun Sep 30, 2012 3:47 pm
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

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

Posted: Tue Feb 27, 2018 7:42 pm
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?

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

Posted: Wed Feb 28, 2018 1:43 pm
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

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

Posted: Wed Feb 28, 2018 1:52 pm
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?

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

Posted: Wed Feb 28, 2018 3:13 pm
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

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

Posted: Wed Feb 28, 2018 6:42 pm
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

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

Posted: Wed Feb 28, 2018 8:56 pm
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 275 times

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

Posted: Thu Mar 01, 2018 6:39 am
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?

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

Posted: Thu Mar 01, 2018 6:48 am
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

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

Posted: Fri Mar 02, 2018 1:47 am
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