Imprimir caracteres especiales

HMG en Español

Moderator: Rathinagiri

Post Reply
jorge.posadas
Posts: 192
Joined: Mon May 19, 2014 7:43 pm
DBs Used: DBF, SQLite, MS-SQL, ACCESS, MariaDB (en proceso)
Location: Morelia, Mich. México
Contact:

Imprimir caracteres especiales

Post by jorge.posadas »

Grupo HMG

Estoy ganerando un reporte con
START HPDFDOC
START HPDFPAGE
::
::
::
para que me genere un PDF, sin embargo me estoy topando con problemas que no imprime ÑñÁÉÍÓÚáéíóú tando datos que viene de una base de datos como titulos fijo
el inicio he puesto esto SET HPDFDOC ENCODING TO "CP1252" pero no me funciona, luego puse esto SET CODEPAGE TO UNICODE y tampoco
funciono luego puse esto @ 060, 060 HPDFPRINT UNICODE Go_Lee_Datos:Fields("NOMBRE_PACIENTE"):Value SIZE 12 y me dió error
ya he leído el HELP que viene en el IDE de HMG_OFICIAL pero no he encontrado la solución

¿Alguien de ustedes ha solucionado eso?

De antemano gracias por la ayuda
Cordialmente

POSADAS SOFTWARE
Jorge Posadas Ch.
Programador independiente
Morelia, Mich.
M é x i c o .
Movil +52 44 3734 1858
SKYPE: jorge.posadasch
Email: jorge.posadas@posoft.mx
User avatar
dragancesu
Posts: 931
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: Imprimir caracteres especiales

Post by dragancesu »

Creating a pdf file looks nice but it didn't work
My solution is to create a print and then print it on a pdf printer
The result is a good pdf file
User avatar
gfilatov
Posts: 1099
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: Imprimir caracteres especiales

Post by gfilatov »

jorge.posadas wrote: Thu Dec 07, 2023 11:18 pm Grupo HMG

Estoy ganerando un reporte con
START HPDFDOC
START HPDFPAGE
::
::
::
para que me genere un PDF, sin embargo me estoy topando con problemas que no imprime ÑñÁÉÍÓÚáéíóú tando datos que viene de una base de datos como titulos fijo
el inicio he puesto esto SET HPDFDOC ENCODING TO "CP1252" pero no me funciona, luego puse esto SET CODEPAGE TO UNICODE y tampoco
funciono luego puse esto @ 060, 060 HPDFPRINT UNICODE Go_Lee_Datos:Fields("NOMBRE_PACIENTE"):Value SIZE 12 y me dió error
ya he leído el HELP que viene en el IDE de HMG_OFICIAL pero no he encontrado la solución

¿Alguien de ustedes ha solucionado eso?

De antemano gracias por la ayuda
Hello Jorge,

Please see the attached example PDF file created using the free HARU PDF library version 2.4.3 and HMG_HPDF library. :arrow:

The code snippet is below:

Code: Select all

function pdf_create()
   local lSuccess := .f.
   SELECT HPDFDOC 'HMG_HPDF_UNI.pdf' TO lSuccess papersize HPDF_PAPER_A4
   if lSuccess
      START HPDFDOC
         /* UTF8 */
         SET HPDFDOC ENCODING TO "UTF-8"            
         START HPDFPAGE

            @ 80, 10 HPDFPRINT "€ ÑñÁÉÍÓÚáéíóú UTF-8" /*to 300, 300*/ FONT "verdana.ttf" size 12
            @ 90, 10 HPDFPRINT '@ 80, 10 HPDFPRINT "€ ÑñÁÉÍÓÚáéíóú UTF-8" ' to 300, 300 FONT "verdana.ttf" size 12

         END HPDFPAGE
      END HPDFDOC
   endif   
   execute file 'HMG_HPDF_UNI.pdf'
return nil
Hope that helps. :idea:
Attachments
HMG_HPDF_UNI.zip
PDF sample with an UNICODE codepage
(16.54 KiB) Downloaded 237 times
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
jorge.posadas
Posts: 192
Joined: Mon May 19, 2014 7:43 pm
DBs Used: DBF, SQLite, MS-SQL, ACCESS, MariaDB (en proceso)
Location: Morelia, Mich. México
Contact:

Re: Imprimir caracteres especiales

Post by jorge.posadas »

Gregory

Me da este error he tratado de solucionarlo y no he podido

I get this error, I have tried to solve it and I have not been able to.
Attachments
Error_Create_PDF.png
Error_Create_PDF.png (27.92 KiB) Viewed 15297 times
Cordialmente

POSADAS SOFTWARE
Jorge Posadas Ch.
Programador independiente
Morelia, Mich.
M é x i c o .
Movil +52 44 3734 1858
SKYPE: jorge.posadasch
Email: jorge.posadas@posoft.mx
branislavmil
Posts: 10
Joined: Sat Sep 29, 2018 3:36 pm
DBs Used: DBF

Re: Imprimir caracteres especiales

Post by branislavmil »

Try it like this:
---
START HPDFDOC
/* UTF8 */

*** add line
_HMG_HPDF_UseUTF()
***

SET HPDFDOC ENCODING TO "UTF-8"
START HPDFPAGE
----

***********************************************************************
Function _hmg_hpdf_UseUTF()
If _HMG_SYSDATA[ 150 ][ 1 ] == Nil // PDF object not found!
_HMG_HPDF_Error( 3 )
Return Nil
endif
HPDF_UseUTFEncodings(_HMG_SYSDATA[ 150 ][ 1 ])
Return Nil
*****************************************************************
Post Reply