Page 1 of 3

Unicode and HMG_HPDF

Posted: Wed Nov 06, 2013 10:47 pm
by esgici
Hi All

It's seems that HMG_HPDF doesn't support unicode :( :?

Is this correct and if so may be a hope for the future ?

Regards

Re: Unicode and HMG_HPDF

Posted: Wed Nov 06, 2013 11:05 pm
by IMATECH
Hi Esgici !

I see no problem :)

Code: Select all

cText_hbHpdf := hb_Translate( c_AnyString, 'UTF8EX', cMyCodePage )
Regards

Re: Unicode and HMG_HPDF

Posted: Wed Nov 06, 2013 11:28 pm
by esgici
IMATECH wrote: I see no problem :)

Code: Select all

cText_hbHpdf := hb_Translate( c_AnyString, 'UTF8EX', cMyCodePage )
Thank Ronaldo, I will prob it.

By the way my problem is on file name, not pdf text.

Regards

Re: Unicode and HMG_HPDF

Posted: Thu Nov 07, 2013 12:17 am
by IMATECH
Hi Esgici !


I Think you can use the same solution:

Code: Select all

c_file_name_for_pdf_File := hb_Translate( c_AnyString, 'UTF8EX', cMyCodePage )
Regards

Re: Unicode and HMG_HPDF

Posted: Thu Nov 07, 2013 12:35 am
by danielmaximiliano
Gracias Ronaldo por compartir sus conocimientos

Re: Unicode and HMG_HPDF

Posted: Thu Nov 07, 2013 11:32 am
by esgici
Hi All
esgici wrote: It's seems that HMG_HPDF doesn't support unicode :( :?
This is my SSW :
Results of this SSW
Results of this SSW
UTF8HPDF.jpg (36.04 KiB) Viewed 12405 times
the code :

Code: Select all

/*
 
  Exploring UTF8 implementation in HMG_HPDF
  
*/

#include "hmg.ch"
#include "hfcl.ch"

PROCEDURE Main()

   cSourceFileName := "español.txt"   
   
   cSourceText := HB_MEMOREAD( cSourceFileName )
   
   cTargetFileName := STRTRAN( cSourceFileName, "txt", "pdf" )
   
   SELECT HPDFDOC ( cTargetFileName ) TO lSelPDF // papersize HPDF_PAPER_A4
         
   IF lSelPDF
      START HPDFDOC
   
         START HPDFPAGE
            @ 20,  20 HPDFPRINT cSourceText
         END HPDFPAGE   
      
      END HPDFDOC

      IF FILE( cTargetFileName )            
         MsgInfo( "PDF Builded as " + cTargetFileName ) 
      ELSE
         MsgStop( "PDF Building Unsuccessful :(", "Unexpected ERROR !" ) 
      ENDIF FILE( cTargetFileName )                           
      
   ENDIF lSelPDF
            
RETURN // BTExplore.Main()

*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
Any idea :?:

And, Ronaldo,

Would you like add your suggestions on this code,
( with required REQUEST statements and SETxxx commands / functions)
please.

Regards

Re: Unicode and HMG_HPDF

Posted: Thu Nov 07, 2013 11:36 am
by Rathinagiri
Esgici,

As of now we can't use unicode with HPDF.

Claudio had also tested in a newer version of HPDF for unicode. We are investigating this and it is a main agenda for the upcoming versions.

Re: Unicode and HMG_HPDF

Posted: Thu Nov 07, 2013 11:39 am
by esgici
Rathinagiri wrote: As of now we can't use unicode with HPDF.
Claudio had also tested in a newer version of HPDF for unicode. We are investigating this and it is a main agenda for the upcoming versions.
Thanks to clarification my brother,

you are UNIQUE :arrow:

With my best reagrds :D

Re: Unicode and HMG_HPDF

Posted: Thu Nov 07, 2013 12:52 pm
by quartz565
Please do not forget the problem with the distance between the letters of the Greek words... :) :arrow:

Re: Unicode and HMG_HPDF

Posted: Thu Nov 07, 2013 2:41 pm
by IMATECH
Hi Esgici !


Adjusted ( but not tested ! )

Code: Select all

#include "hmg.ch"
#include "hfcl.ch"

PROCEDURE Main()

   cSourceFileName := "español.txt"   
   
   cSourceText := hb_Translate( HB_MEMOREAD( cSourceFileName ), 'UTF8EX', 'ESISO' )
   
   cTargetFileName := STRTRAN( cSourceFileName, "txt", "pdf" )
   
   SELECT HPDFDOC ( hb_Translate( cTargetFileName, 'UTF8EX', 'ESISO' ) ) TO lSelPDF // papersize HPDF_PAPER_A4
   
   IF lSelPDF
      
      _HMG_HPDF_SetEncoding( "WinAnsiEncoding" )
      
      START HPDFDOC
   
         START HPDFPAGE
            @ 20,  20 HPDFPRINT cSourceText
         END HPDFPAGE   
      
      END HPDFDOC

      IF FILE( cTargetFileName )            
         MsgInfo( "PDF Builded as " + cTargetFileName ) 
      ELSE
         MsgStop( "PDF Building Unsuccessful :(", "Unexpected ERROR !" ) 
      ENDIF FILE( cTargetFileName )                           
      
   ENDIF lSelPDF
            
RETURN

// *---------------------------------------------------------------------------*
// hb_gtsys()
// *---------------------------------------------------------------------------*
PROCEDURE hb_gtsys()

   REQUEST HB_LANG_ES
   REQUEST HB_CODEPAGE_ESISO

RETURN

Regards