Problema con HaruPDF

Moderator: Rathinagiri

User avatar
Pablo César
Posts: 4058
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 177 times

Acentuação com a hmg_hpdf

Post by Pablo César » Mon Jun 03, 2013 1:59 pm

HASA wrote:achei muito mais simples utilizar essa dica que é bem parecida com a sintaxe da MINIPRINT
Lembre Hasa que agora em HMG na versão apartir 3.1.0 e está pra sair a 3.1.4 em breve, as acentuações ficam bem mais fácil de trabalhar em modo UNICODE, portanto o seu editor de código fonte, deve ser mudado para o padrão UTF-8 (no Notepad++ tem essa opção).

---

Remember Hasa now in HMG in version 3.1.0 and is starting to go to 3.1.4 soon, the accents are much easier to work in UNICODE mode, so your source code editor, should be changed to the default UTF -8 (in Notepad + + has this option).
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
HASA
Posts: 20
Joined: Sat Feb 23, 2013 3:00 pm
Location: SÃO PAULO - BRAZIL

Post by HASA » Mon Jun 03, 2013 2:07 pm

Ok, Pablo, vou mudar.
Valeuuu
HASA

Ok, Pablo, I will change.
Valeuuu
HASA

User avatar
andyglezl
Posts: 848
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 7 times
Been thanked: 23 times
Contact:

Post by andyglezl » Mon Jun 03, 2013 6:48 pm

Hola
Yo no pude resolverlo, seguí con la impresión normal sin crear PDF.
Utilizé HB_OEMTOANSI, HB_ANSITOOEM y sigue el problema.
Todas las palabras que llevan acento y Ñ ñ las cambia. (estoy con HMG 3.46)

viewtopic.php?f=40&t=2903&p=26116&hilit=HaruPDF#p26116

Hello
I could not solve it, I continued with normal printing without creating PDF.
Use HB_OEMTOANSI, HB_ANSITOOEM and still the problem.
All words with accents and ñ Ñ the changes. (I'm with HMG 3.46)

viewtopic.php?f=40&t=2903&p=26116&hilit=HaruPDF#p26116
Andrés González López
Desde Guadalajara, Jalisco. México.

User avatar
Pablo César
Posts: 4058
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 177 times

Post by Pablo César » Mon Jun 03, 2013 9:33 pm

Rathinagiri wrote:Actually, what is your problem?
The problem is not making brazilian or spanish accents (especial characters from the language). I have tested in HMG 3.0.46 and 3.1.3 in UNICODE and ANSI code. But sadly, do not work with accents with harupdf.

This is a code example:

Code: Select all

#include <hmg.ch>
#include "HFCL.CH"

Function Main
// SET LANGUAGE TO PORTUGUESE
define window main at 0, 0 width 300 height 300 main title 'HMG HPDF Document'
	define button create
	row 100
	col 90
	width 120
	caption 'HMG HPDF DOC'
	action pdf_create()
	
	end button
	on key escape action thiswindow.release
end window
main.center
main.activate
Return nil

function pdf_create
   local lSuccess := .f.
   local cContent, cSyntax
   local cLB := chr( 10 )

   SELECT HPDFDOC 'HMG_HPDF_Doc.pdf' TO lSuccess papersize HPDF_PAPER_A4
   SET HPDFDOC COMPRESS ALL
   SET HPDFDOC PAGEMODE TO OUTLINE
   SET HPDFINFO AUTHOR      TO 'S. Rathinagiri'
   SET HPDFINFO CREATOR     TO 'S. Rathinagiri'
   SET HPDFINFO TITLE       TO 'HMG_HPDF Documentation'
   SET HPDFINFO SUBJECT     TO 'Documentation of LibHaru/HPDF Library in HMG'
   SET HPDFINFO KEYWORDS    TO 'HMG, HPDF, Documentation, LibHaru, Harbour, MiniGUI'
   SET HPDFINFO DATECREATED TO date() TIME time()
   if lSuccess
      START HPDFDOC
         START HPDFPAGE
            @ 126,  10 HPDFPRINT IMAGE "hmghpdf.png" WIDTH 190 HEIGHT 46
         END HPDFPAGE   
         START HPDFPAGE
            SET HPDFDOC PAGEOUTLINE TITLE "Introduction" 
            Draw_HeaderBox()
            Print_Header( "HMG_HPDF Introdução / Intoducción" )
            cContent := "      HMG_HPDF is a small library to create PDF documents in a simple way using xBase syntax. " + ;
                        "Output from HMG programs can be exported to PDF with HMG PRINT like commands. Apart from HMG PRINT " +;
                        "features this library has some additional features also." + ;
                        cLB + ;
                        cLB + ;
                        "      It is based on HPDF in Harbour. HPDF is originally ported from LibHaru to Harbour." +;
                        cLB + ;
                        cLB + ;
                        "USAGE:" + ;
                        cLB + ;
                        cLB + ;
                        "      Just by including the following line into the initial lines of the HMG code, the commands discussed in this" + ;
                        " document can be used. " + ;
                        cLB + ;
                        cLB + ;
                        '#include "hmg_hpdf.ch"'
            Print_Content( cContent )
         END HPDFPAGE
         
      END HPDFDOC
   endif   
   execute file 'HMG_HPDF_Doc.pdf'
   
return nil

static function Draw_HeaderBox
   @  10,  10 HPDFPRINT RECTANGLE TO  40, 200 COLOR { 50, 50, 255 } FILLED
return nil

static function Print_Header( cHeader )   
   @  30, 105 HPDFPRINT cHeader SIZE 30 COLOR { 255, 255, 0 } CENTER
return nil

static function Print_Content( cContent) 
   @  50,  10 HPDFPRINT  cContent TO 120, 200 //JUSTIFY
return nil
Look at this is wrong characteres displayed:
Screen93.PNG
Screen93.PNG (28.84 KiB) Viewed 1393 times
And this is the right ones to be displayed (this was made by PaintBrush):
Screen94.PNG
Screen94.PNG (28.87 KiB) Viewed 1390 times
So it is somthing wrong and now with UNICODE most probably will be so usefull if accents characters could be displayed in good order...
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
Rathinagiri
Posts: 5172
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 136 times
Been thanked: 131 times
Contact:

Post by Rathinagiri » Tue Jun 04, 2013 3:13 am

HMGpdf unicode is not yet supported. We (Claudio and myself) had checked and tried to ANSI version to Unicode and failed. But trying...
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
andyglezl
Posts: 848
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 7 times
Been thanked: 23 times
Contact:

Post by andyglezl » Tue Jun 04, 2013 5:02 pm

Gracias a ambos !
---------------------
Thank you both!
Andrés González López
Desde Guadalajara, Jalisco. México.

User avatar
Pablo César
Posts: 4058
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 177 times

Post by Pablo César » Tue Jun 04, 2013 5:35 pm

Rathinagiri wrote:HMGpdf unicode is not yet supported. We (Claudio and myself) had checked and tried to ANSI version to Unicode and failed. But trying...
Hi Rathi, thanks to clarify this matter. For HMG 3.046 version, we can use SET HPDFDOC ENCODING should it be the right way to set language in this case ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
IMATECH
Posts: 167
Joined: Sun May 27, 2012 9:33 pm
Location: Brazil: Goiânia-GO.

Post by IMATECH » Tue Jun 04, 2013 6:04 pm

Just use:

HMG_HPDF_SetEncoding( HPDF_ENCODING_WIN_ANSI )

Code: Select all


#xcommand SET HPDFDOC ENCODING TO <cEncoding> => _HMG_HPDF_SetEncoding( <cEncoding> )

#define  HPDF_ENCODING_FONT_SPECIFIC  "FontSpecific"
#define  HPDF_ENCODING_STANDARD       "StandardEncoding"
#define  HPDF_ENCODING_MAC_ROMAN      "MacRomanEncoding"
#define  HPDF_ENCODING_WIN_ANSI       "WinAnsiEncoding"
#define  HPDF_ENCODING_ISO8859_2      "ISO8859-2"
#define  HPDF_ENCODING_ISO8859_3      "ISO8859-3"
#define  HPDF_ENCODING_ISO8859_4      "ISO8859-4"
#define  HPDF_ENCODING_ISO8859_5      "ISO8859-5"
#define  HPDF_ENCODING_ISO8859_6      "ISO8859-6"
#define  HPDF_ENCODING_ISO8859_7      "ISO8859-7"
#define  HPDF_ENCODING_ISO8859_8      "ISO8859-8"
#define  HPDF_ENCODING_ISO8859_9      "ISO8859-9"
#define  HPDF_ENCODING_ISO8859_10     "ISO8859-10"
#define  HPDF_ENCODING_ISO8859_11     "ISO8859-11"
#define  HPDF_ENCODING_ISO8859_13     "ISO8859-13"
#define  HPDF_ENCODING_ISO8859_14     "ISO8859-14"
#define  HPDF_ENCODING_ISO8859_15     "ISO8859-15"
#define  HPDF_ENCODING_ISO8859_16     "ISO8859-16"
#define  HPDF_ENCODING_CP1250         "CP1250"
#define  HPDF_ENCODING_CP1251         "CP1251"
#define  HPDF_ENCODING_CP1252         "CP1252"
#define  HPDF_ENCODING_CP1253         "CP1253"
#define  HPDF_ENCODING_CP1254         "CP1254"
#define  HPDF_ENCODING_CP1255         "CP1255"
#define  HPDF_ENCODING_CP1256         "CP1256"
#define  HPDF_ENCODING_CP1257         "CP1257"
#define  HPDF_ENCODING_CP1258         "CP1258"
#define  HPDF_ENCODING_KOI8_R         "KOI8-R"

Code: Select all


SET HPDFDOC ENCODING TO HPDF_ENCODING_WIN_ANSI

or

HMG_HPDF_SetEncoding( HPDF_ENCODING_WIN_ANSI )

M., Ronaldo

By: IMATECH

Imation Tecnologia

User avatar
Pablo César
Posts: 4058
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 177 times

Post by Pablo César » Tue Jun 04, 2013 6:15 pm

andyglezl wrote:Todas las palabras que llevan acento y Ñ ñ las cambia. (estoy con HMG 3.46)
Hola Andrés, si pones:

_HMG_HPDF_SetEncoding("ISO8859-3") o _HMG_HPDF_SetEncoding("WinAnsiEncoding")

Antes de tu START HPDFDOC creo que funcionará bien para el español. Yo hice un pequeño test y me funcionó, fijate.

---

Hi Andrew, if you add this

_HMG_HPDF_SetEncoding ("ISO8859-3") or _HMG_HPDF_SetEncoding ("WinAnsiEncoding")

Put it before line of HPDFDOC START and will work well for Spanish. I did a little test and it worked as well. Look up.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
Pablo César
Posts: 4058
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 177 times

Post by Pablo César » Tue Jun 04, 2013 6:22 pm

HASA wrote:Colega nesse post você encontrará um imagem do problema, as palavras com acentuação saem se acentuacao, veja:

Colega, en este post encontrarás una imagen del problema, las palabras vienen con acentuación acentuación, ver:

viewtopic.php?f=40&t=2903

HASA
:P
Oi Hasa, se você inserir en seu código:

_HMG_HPDF_SetEncoding("ISO8859-9") ou _HMG_HPDF_SetEncoding("WinAnsiEncoding")

Antes do START HPDFDOC creio que funcionará bem para o português. Eu fiz um pequeno teste e deu certo, veja ai se funciona. Mas na versão de HMG 3.0.46

--

Hi Hasa, if you add this

_HMG_HPDF_SetEncoding ("ISO8859-9") or _HMG_HPDF_SetEncoding ("WinAnsiEncoding")

Put it before line of HPDFDOC START and will work well for Portuguese. I did a little test and it worked as well. But in HMG 3.0.46 version.

Remark: Message re-edited.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

Post Reply