Underline and italic in PDF seems not work

Moderator: Rathinagiri

User avatar
danielmaximiliano
Posts: 2607
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Underline and italic in PDF seems not work

Post by danielmaximiliano »

Hola a Todos :
Falta implementar las funciones HGMPDF_GetFont dentro de C:\hmg.3.2\hfcl\Source\HMG_HPDF.Prg de esa manera no utilize "Helvetica" como fuente por defecto.


Hi Everyone:
Foul HGMPDF_GetFont implement functions within C:\hmg.3.2\hfcl\Source\HMG_HPDF.Prg thus do not use "Helvetica" as default font.
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
danielmaximiliano
Posts: 2607
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Underline and italic in PDF seems not work

Post by danielmaximiliano »

Perdón , ya esta incluido el codigo por si se necesita cargar una fuente externa a las definidas como internas dentro de HaruPdf.


Sorry, the code is included in case you need to load an external source for defined domestic within HaruPdf.

Code: Select all

function _HMG_HPDF_PRINT (
....
....
 if HMG_LEN( alltrim( cFontName ) ) == 0
      oFont := HPDF_GetFont( _HMG_SYSDATA[ 150 ][ 1 ], _HMG_SYSDATA[ 150 ][ 8 ], _HMG_SYSDATA[ 150 ][ 10 ] )
   else
      cFontName := alltrim( cFontName )
      if HMG_UPPER( HB_USUBSTR( cFontName, HMG_LEN( cFontName ) - 3 ) ) == '.TTF' // load ttf font
         cFont := HPDF_LOADTTFONTFROMFILE( _HMG_SYSDATA[ 150 ][ 1 ], cFontName, .t. )
         if HMG_LEN( alltrim( cFont ) ) == 0
solo es necesario indicar el nombre fisico de la fuente con su extension incluida y esta será utilizada por el comando HMGPrint

is only necessary to indicate the physical font name with its extension included and this will be used by the command HMGPrint

viewtopic.php?p=21875&sid=41b2327a08964 ... f6e#p21875

mire este ejemplo Underline no soportado.
look at this example Underline not supported.
HMGpdf.rar
(1.34 MiB) Downloaded 374 times
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Underline and italic in PDF seems not work

Post by mustafa »

Hola amigo Daniel:
estoy haciendo pruebas con tu Sample
intentando que salga en el Pdf un Código de Barras
con FONT "EAN13.ttf" pero no funciona
aqui te pongo varias opciones sin resultado

si pongo FONT "EAN13" no crea ningun file .Pdf
*------------------------------------------*
si pongo FONT "Code EAN13" no crea ningun file .Pdf
*------------------------------------------*
si pongo FONT "EAN13.ttf" no crea ningun file .Pdf
y sale este mensaje en pantalla
---> Fon cannot be loaded
*------------------------------------------*
si pongo FONT "Code EAN13.ttf" no crea ningun file .Pdf
y sale este mensaje en pantalla
---> Fon cannot be loaded
*------------------------------------------*
Haber si puedes miralo un cordial saludo
Mustafa
Attachments
HMGpdf_2.zip
(4.23 KiB) Downloaded 369 times
Imagen.jpg
Imagen.jpg (13.66 KiB) Viewed 9638 times
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: Underline and italic in PDF seems not work

Post by EduardoLuis »

Hola Mustafa:

Porque no pruebas colocar la fuente .TTF en la misma carpeta del ejecutable; yo seguí el sample de Ratihinagiri (HFCL\SAMPLES\HMGPDFDOC) y me ha funcionado correctamente.-

La linea de comando es:
@ 100, 10 HPDFPRINT '@ 290, 10 HPDFPRINT "The font is 3of9.TTF" FONT "3of9.TTF" size 12'
@ 120, 10 HPDFPRINT "The font is 3of9.TTF" FONT "3of9.TTF" size 12

La ventaja de ese método es que no tienes que preocuparte que el usuario tenga instalado ese font.-

Con respecto a UNDERLINE ITALIC BOLD etc. jamas pude lograr que funciones aún reconstruyendo las funciones como bien señaló Daniel.- De todos modos con los recursos que provee HMGPDF he logrado hacer muy buenos informes.-

Otra forma que puedes utilizar es generar un *.PNG con el EAN13, y luego lo pones en el PDF como un gráfico más.- En la carpeta HFCL hay un sample HMG_Zebra del cual puedes automatizar la generación del código de barras y generar el PNG.-

Espero que esto te ayude a resolver el problema.-
Un abrazo. Eduardo
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Underline and italic in PDF seems not work

Post by mustafa »

Hola Eduardo Luis
Si descargas el Attachments:
HMGpdf_2.zip, veras que la fuente EAN13.ttf
está en la misma carpeta
La opción de generar un *.PNG no me interesa pues en un futuro
queria que se cogieran los números de codigos de Barras de un
fichero *.DBF y apartir de estos numeros se generara en el
nuevo *.Pdf el dibujo del Código de Barras.
Gracias Eduardo
un saludo
Mustafa
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: Underline and italic in PDF seems not work

Post by EduardoLuis »

Amigo Mustafá:

El problema es que no reconoce la fuente EAN13.TTF.-
Probé diferentes opciones, incluso la carga directa de la fuente, y reporta el mismo error.-
Supongo que el problema está en la codificación del FONT, ya que probé con otro font que genera codigo de barras el 3of9, y me lo imprime correctamente.-
Seguiré investigando.-
Un abrazo.-
Eduardo
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Underline and italic in PDF seems not work

Post by mustafa »

Hola Eduardo
Puedes poner el sample.prg tuyo que
funciona con la fuente barras el 3of9,
y el fichero de la fuente code39.ttf
gracias
Mustafa
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Underline and italic in PDF seems not work

Post by Pablo César »

De facto es que HMG_HPDF.Prg está presentando un problema de interpretacion de fonts. Es como Maximiliano dijo le falta la funcion que _HMG_HPDF_SetFont y tambien estaba con problemas de interpretacion de errores porque no usaba el hb_HPDF_GetErrorString y simplesmente verificaba el retorno de Nil despues de las funciones del HaruPDF.
Donde habia HMG_LEN para ver tamaño del array lo cambié por LEN (pero esto no es el problema). Estoy intentando encontrar por que no crea bien el PDF inicialmente, porque me retorna HPDF_INVALID_DOCUMENT. Creo que se deba por la implementacion del nombre de la font junto con la propriedad italic, strikeout, underline, etc... lo que no tengo seguridad que sea asi. :(

Esto que pensaba que estaba mal, está correcto:

if HMG_UPPER( HB_USUBSTR( cFontName, HMG_LEN( cFontName ) - 3 ) ) == '.TTF' // load ttf font

Espero que Rathinagiri nos dé su opinion.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: Underline and italic in PDF seems not work

Post by EduardoLuis »

Amigo Mustafa:

Luego de enviar el post, testee con el font 3of9.ttf y tampoco me lo reconoce, de hecho, me da un mensaje - al igual que con el font "EAN13": EMPTY (internal) FONT NAME.-

Las pruebas que hace tiempo había hecho, se refirieron a TTF y supuse que como funcionó correctamente con cualquier font TTF tambien lo haría con 3OF9 y obviamente con el tuyo.-

Te adjunto, un programa que creo esgici publicó en su oportunidad y que me sirvió para testear la funcion HMGPDF para mis aplicaciones.-

Otro método que puedes utilizar para establecer un font TTF en HMGPDF es

local cTTFFName, cFontName, qPDF

qPDF := _HMG_SYSDATA[ 150, 1 ]
cTTFFName := "C:\Windows\Fonts\ARISTONI.ttf"
cFontName := HPDF_LoadTTFontFromFile( qPDF, cTTFFName, .F. )
@ 235, 200 HPDFPRINT "This is right aligned text" FONT cFontName SIZE 14 RIGHT

Seguiré investigando el tema.-
Un abrazo. Eduardo
Attachments
PDF_TTF_FONTS.zip
(62.13 KiB) Downloaded 384 times
User avatar
danielmaximiliano
Posts: 2607
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Underline and italic in PDF seems not work

Post by danielmaximiliano »

Hola Mustafa:

El fuente EAN13.TTF es correcto en algunas aplicaciones que no testean que tengn completo las propiedades True Type.

te dejo otra fuente EAN-13.TTF que funciona correctamente .
Attachments
HMGpdf_2.rar
(24.36 KiB) Downloaded 368 times
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Post Reply