Page 1 of 1
Imprimir caracteres especiales con HPDFPRINT
Posted: Thu Apr 02, 2026 4:59 pm
by jorge.posadas
Grupo
¿Estoy haciendo pruebas con HPDFPRINT, mi paisano MARTI GZ he dio un ejemplo que me ayudo a entender mejor el uso de HPDFPRINT sin embargo no he logrado que imprima caracteres en español como Ññ, y acentos como áéíúó ÁÉÍÓÚ, Si alguien ya resolvió esto, agradecería me enviara un ejemplo
De antemano agradezco la ayuda
Re: Imprimir caracteres especiales con HPDFPRINT
Posted: Thu Apr 02, 2026 5:19 pm
by danielmaximiliano
Hola Jorge, puedes subir tu código para ver cómo estás trabajando tus documentos pdf
Re: Imprimir caracteres especiales con HPDFPRINT
Posted: Thu Apr 02, 2026 6:58 pm
by jorge.posadas
Este es el código para imprimie PDF
/*
* Proyecto:
* Fichero:
* Descripción:
* Autor:
* Fecha: abril 2026
*/
#INCLUDE <hmg.ch>
#INCLUDE <ord.ch>
#INCLUDE <ps.ch>
#INCLUDE <hbver.ch>
*------------------------------------------------------------------------------*
PROCEDURE Ejemplo_PDF
*------------------------------------------------------------------------------*
archivopdf = "ejemplo.pdf"
mgerente = "jorge posadas chiñas áéíóú ÁÉÍÓÚ Ññ"
SELECT HPDFDOC archivopdf TO lSuccess papersize HPDF_PAPER_LEGAL ORIENTATION HPDF_ORIENT_PORTRAIT
SET HPDFDOC COMPRESS ALL
//SET HPDFDOC ENCODING TO "CP1252"
if lSuccess
START HPDFDOC
START HPDFPAGE
SET HPDFDOC PAGEOUTLINE TITLE "Contrat
o"
SET HPDFDOC ENCODING TO "CP1250"
lin:=33
incre:=5
@ 7,107 HPDFPRINT "ESTE ES UN EJEMPLO DEL USO DE HPDFPRINT " font "Times-Bold" size 10 center
@ 11,107 HPDFPRINT "JORGE POSADAS CHIÑAS" font "Times-Bold" size 10 center
@ lin,10 HPDFPRINT "la siguente linea con vocales acenturadas en mayusculas y minusculas" font "Times-Bold" size 10
lin:=40
@ lin,10 HPDFPRINT " mayusculas acentuadas --> Á É Í Ó Ú minusculas acentuadas -->á é í ó ú " font "Times-Bold" size 12
lin:=lin + incre
@ lin,10 HPDFPRINT 'Ahora se imprimiran las leras N y n con tilde' font "Times-Bold" size 8
lin:=lin + incre
@ lin,10 HPDFPRINT " letra N con tilde Ñ letra n con tilde ñ " font "Times-Bold" size 12
lin:=lin + incre
@ lin,10 HPDFPRINT "La siguiente linea imprime caracteres especiales" font "Times-Bold" size 8
lin:=lin + incre
@ lin,10 HPDFPRINT "$ # ! % & / ( ) = * + {} [] , ; . : - _ " font "Times-Bold" size 12
// --------------------------------------------------------------------------------------------
END HPDFPAGE
end HPDFDOC
SET CODEPAGE TO UNICODE
Execute File archivopdf
endif
Anexo una imagen del PDF generado con el código amterior
Re: Imprimir caracteres especiales con HPDFPRINT
Posted: Thu Apr 02, 2026 7:44 pm
by danielmaximiliano
Hola jorge : la solucion es que guardes el prg o conviertas el mismo a Ansi en Notepad++ ( el que uso yo)
Code: Select all
REQUEST HB_CODEPAGE_ESWIN // Para Windows (ANSI)
*------------------------------------------------------------------------------*
Function Main
*------------------------------------------------------------------------------*
hb_cdpSelect( "ESWIN" )
archivopdf = "ejemplo.pdf"
mgerente = "jorge posadas chiñas áéíóú ÁÉÍÓÚ Ññ"
SELECT HPDFDOC archivopdf TO lSuccess papersize HPDF_PAPER_LEGAL ORIENTATION HPDF_ORIENT_PORTRAIT
SET HPDFDOC COMPRESS ALL
//SET HPDFDOC ENCODING TO "CP1252"
if lSuccess
SET HPDFDOC ENCODING TO "WinAnsiEncoding"
START HPDFDOC
START HPDFPAGE
SET HPDFDOC PAGEOUTLINE TITLE "Contrato"
lin:=33
incre:=5
@ 7,107 HPDFPRINT "ESTE ES UN EJEMPLO DEL USO DE HPDFPRINT " font "Times-Bold" size 10 center
@ 11,107 HPDFPRINT hb_utf8ToStr( hb_strToUtf8( "JORGE POSADAS CHIÑAS") ) font "Times-Bold" size 10 center
@ lin,10 HPDFPRINT "la siguente linea con vocales acenturadas en mayusculas y minusculas" font "Times-Bold" size 10
lin:=40
@ lin,10 HPDFPRINT " mayusculas acentuadas --> Á É Í Ó Ú minusculas acentuadas -->á é í ó ú " font "Times-Bold" size 12
lin:=lin + incre
@ lin,10 HPDFPRINT 'Ahora se imprimiran las leras N y n con tilde' font "Times-Bold" size 8
lin:=lin + incre
@ lin,10 HPDFPRINT " letra N con tilde Ñ letra n con tilde ñ " font "Times-Bold" size 12
lin:=lin + incre
@ lin,10 HPDFPRINT "La siguiente linea imprime caracteres especiales" font "Times-Bold" size 8
lin:=lin + incre
@ lin,10 HPDFPRINT "$ # ! % & / ( ) = * + {} [] , ; . : - _ " font "Times-Bold" size 12
// --------------------------------------------------------------------------------------------
END HPDFPAGE
end HPDFDOC
SET CODEPAGE TO UNICODE
Execute File archivopdf
endif
Return Nil
en mi casa la compilacion y ejecucion muestra los caracteres correctos