HMG_HPDF - Export to PDF made easy...

HMG Samples and Enhancements

Moderator: Rathinagiri

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

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

Post by esgici » Tue Mar 13, 2018 1:52 pm

bpd2000 wrote:
Tue Mar 13, 2018 12:30 pm
WOW!
Thank you Edward...
+1
Viva INTERNATIONAL HMG :D

User avatar
bpd2000
Posts: 1035
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 169 times
Been thanked: 83 times

Post by bpd2000 » Tue Mar 13, 2018 2:21 pm

Rathinagiri wrote:
Tue Mar 13, 2018 1:50 pm
Wonderful!

EDward, Can you make it work for unicode encoding also? Especially Indian languages?
+1
BPD
Convert Dream into Reality through HMG

edk
Posts: 384
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 113 times
Been thanked: 284 times

Post by edk » Wed Mar 14, 2018 2:24 pm

Rathinagiri wrote:
Tue Mar 13, 2018 1:50 pm
EDward, Can you make it work for unicode encoding also? Especially Indian languages?
Hi, Rathi.

I made a PDF natively encoded in UTF-8 (without generating Unicode text as a png file).
sample-1.png
sample-1.png (144.27 KiB) Viewed 1060 times
Is the example shown at the top of the PDF page in the Indian alphabet?

Would this solution meet your expectations?
In the utf-8 editor, characters from this font look different than in the resulting PDF. I pasted the characters with the Windows Character Map. :roll:
The other fonts appear in the editor in the same way as in PDF.
DemoUTF.7z
(109.29 KiB) Downloaded 67 times
What I noticed, the built-in PDF fonts (Courier, Helvetica, Times-Roman) can not be used for Unicode encoding. Use TTF fonts.


Circular text printing requires changes for Unicode encoding support.
sample-2.png
sample-2.png (170.99 KiB) Viewed 1060 times
Replace the HPDF_CircleText function with the one in the attachment.
demo.7z
(2.09 KiB) Downloaded 79 times
Regards, Edward.
Attachments
DemoUTF.7z
(109.29 KiB) Downloaded 76 times
Last edited by edk on Thu Mar 15, 2018 11:46 am, edited 1 time in total.

User avatar
bpd2000
Posts: 1035
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 169 times
Been thanked: 83 times

Post by bpd2000 » Thu Mar 15, 2018 3:16 am

Fantastic
Then you Edward, Today I am out of station, will check the next day
BPD
Convert Dream into Reality through HMG

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

Post by esgici » Thu Mar 15, 2018 4:01 am

Hi friends

Does anyone know who is author of Harbur (not HMG) HaruPDF wrapper ?

I remember he was PritPal Bedi, but sadly I can't found in Harbour docs :(

Or more useful, if possible any doc (at least ReadMe) about Harbur HPDF

TIA
Viva INTERNATIONAL HMG :D

User avatar
gfilatov
Posts: 582
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 17 times
Been thanked: 149 times
Contact:

Post by gfilatov » Thu Mar 15, 2018 8:32 am

esgici wrote:
Thu Mar 15, 2018 4:01 am
Hi friends

Does anyone know who is author of Harbur (not HMG) HaruPDF wrapper ?

I remember he was PritPal Bedi, but sadly I can't found in Harbour docs :(

Or more useful, if possible any doc (at least ReadMe) about Harbur HPDF

TIA
Hi Esgici,
/*----------------------------------------------------------------------*
* *
* HaruLib (x)Harbour Wrappers *
* . *
* http://www.libharu.org/ *
* http://sourceforge.net/projects/libharu/ *
* *
* Pritpal Bedi <pritpal@hotmail.com> *
* *
*----------------------------------------------------------------------*/
You can found the following description in the Harbour changelog also:
2008-05-18 09:21 UTC+0100 Viktor Szakats (harbour syenar.net)
* contrib/hbhpdf/harupdf.c
! Fixed all MSVC warnings. Now builds cleanly.

2008-05-18 08:52 UTC+0100 Viktor Szakats (harbour syenar.net)
+ contrib/hbhpdf/Makefile
+ contrib/hbhpdf/make_b32.bat
+ contrib/hbhpdf/make_vc.bat
+ contrib/hbhpdf/make_gcc.sh
+ contrib/hbhpdf/common.mak
+ contrib/hbhpdf/tests/bld_b32.bat
+ contrib/hbhpdf/tests/bld_vc.bat
+ Added build/make files.
; Please test GNU make files.

* contrib/make_b32_all.bat
* contrib/make_gcc_all.sh
* contrib/make_vc_all.bat
+ Added hbhpdf to 'all' make files.
(not yet to GNU make files though)

- contrib/hbhpdf/tests/<data files>
+ contrib/hbhpdf/tests/files/<data files>
* Data files needed for test app moved
to a subdir.

* contrib/hbhpdf/tests/harupdf.prg
! Absolute paths changed to relative ones
(for both input and output ones).
! NumToHex() -> hb_NumToHex()
+ hbct added to lib list because test program
uses SIN()/COS()/TAN() from it.

- contrib/hbhpdf/tests/harupdf.ch
+ contrib/hbhpdf/harupdf.ch
* Moved to main dir.

- contrib/hbhpdf/hpdf.h
- Removed original libharu header. This
will be picked up from the package dir,
along with the rest of the .h files.

* contrib/hbhpdf/harupdf.ch
+ Added self-guard.

* contrib/hbhpdf/harupdf.c
! Fixed a few BCC warnings. It now builds cleanly.
; NOTE: There are a lot MSVC casting warnings and errors left.

; Many thanks for this contrib to Pritpal Bedi.

2008-05-17 18:45 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com)
+ harbour/contrib/hbhpdf
+ harbour/contrib/hbhpdf/harupdf.c
+ harbour/contrib/hbhpdf/hpdf.h
Initial upload of wrappers for HaruPDF Library (http://sourceforge.net/projects/libharu/).
+ harbour/contrib/hbhpdf/tests
+ harbour/contrib/hbhpdf/tests/harupdf.prg
+ harbour/contrib/hbhpdf/tests/harupdf.ch
Test program.
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

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

Post by esgici » Thu Mar 15, 2018 8:53 am

gfilatov wrote:
Thu Mar 15, 2018 8:32 am
...
You can found the following description in the Harbour changelog also
...
Thank you very much Grigory :arrow:

Viva Harbour, viva HMG :D
Viva INTERNATIONAL HMG :D

User avatar
bpd2000
Posts: 1035
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 169 times
Been thanked: 83 times

Post by bpd2000 » Thu Mar 15, 2018 10:06 am

edk wrote:
Wed Mar 14, 2018 2:24 pm
Would this solution meet your expectations?
Regards, Edward.
Tested and nearly 100% success, big thanks for your hard work for natively encoded pdf in UTF-8
Some of the characters do not shows properly is a second thing and not mistake of yours
BPD
Convert Dream into Reality through HMG

edk
Posts: 384
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 113 times
Been thanked: 284 times

Post by edk » Wed Dec 12, 2018 11:12 am

mol wrote:
Sun Mar 04, 2018 7:29 am
There is Windows function EnumFontFamiliesEx which enumerates installed fonts with its options.
But, I can't find if there is a font filename for font name.
HMG sources contains call to older version of the function EnumFontFamilies (this one is for compatibility wit 16-bit versions).
c_controlmisc.c file contains definition of EnumFonts.
EnumFontFamilies returns LogFont structure:

Code: Select all

typedef struct tagLOGFONT {
  LONG  lfHeight;
  LONG  lfWidth;
  LONG  lfEscapement;
  LONG  lfOrientation;
  LONG  lfWeight;
  BYTE  lfItalic;
  BYTE  lfUnderline;
  BYTE  lfStrikeOut;
  BYTE  lfCharSet;
  BYTE  lfOutPrecision;
  BYTE  lfClipPrecision;
  BYTE  lfQuality;
  BYTE  lfPitchAndFamily;
  TCHAR lfFaceName[LF_FACESIZE];
} LOGFONT, *PLOGFONT;
It is desciped on https://msdn.microsoft.com/pl-pl/librar ... s.85).aspx page

Some fonts have only English names, some of them can have English and native (Polish, Chinese ) names too.

I think Claudio Soto should know sth. about it. (His name is places as comment in sources :) )
Hi Marek.
Recently, I had a similar need for the user to choose their own fonts to create a PDF file.
As you know, the HaruPDF library uses native Helvetica, Courier and Times-Roman fonts. You can also use fonts from .ttf files but you can not use the fonts enumerated in the system.
My solution is to examine the available font .ttf files in the system folder, the current folder and the user specified for HaruPDF support and create an array with a .ttf file list.
Based on the received array with a .ttf file list, I created a dialog to select the font.
At the end I made a function where after entering the fontface name, attributes: bold and/or italics, the appropriate .ttf file is found.

This is not a perfect solution and therefore I do not integrate it with h_HMG_HPDF.Prg, but maybe it will be a bit helpful.

I used undocumented GDI32 function GetFontResourceInfo to retrieve the font names from a .ttf file.
It does not work correctly with every .ttf file. My knowledge of C (and English) is so-so, that's why I could do something incorrectly 😒.
Maybe someone knows better solution how to retrieve a Fontname from TTF. :idea:
demo99.7z
(262.67 KiB) Downloaded 15 times
Best regards, Edward.

edk
Posts: 384
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 113 times
Been thanked: 284 times

Post by edk » Wed Dec 12, 2018 3:27 pm

Minor bug fix in the dialog: error occurred when user enter the name of the font not included in the font list. :oops:
Bez tytułu.png
Bez tytułu.png (12.09 KiB) Viewed 72 times
demo.7z
(5.75 KiB) Downloaded 23 times

Post Reply