Page 1 of 1

Imprimir caracteres especiales

Posted: Thu Dec 07, 2023 11:18 pm
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

Re: Imprimir caracteres especiales

Posted: Fri Dec 08, 2023 8:17 am
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

Re: Imprimir caracteres especiales

Posted: Fri Dec 08, 2023 10:34 am
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:

Re: Imprimir caracteres especiales

Posted: Sat Dec 09, 2023 6:24 am
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.

Re: Imprimir caracteres especiales

Posted: Sat Dec 09, 2023 8:02 am
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
*****************************************************************