Pregunta

I've tried everything I know but still cannot get the ≥ and ≤ characters to show up in my PDF generated by Flying Saucer's iTextRenderer from xHTML. They display fine in my browser as HTML of course. I've tried different xml encoding types, doctypes, and using the decimal and hex values instead of the shortcut names. Still, no errors display, but I get a blank space where the characters should be.

Has anyone successfully converted an xhtml to pdf using iTextRenderer with the ≤ and ≥ special symbols, and if so, how?

SOLUTION: Okay, I got this one solved. Turns out I did need to embed the Verdana font into the PDF using the follow lines of Java code:

renderer.getFontResolver().addFont("/Library/Fonts/Verdana.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
renderer.getFontResolver().addFont("/Library/Fonts/Verdana Bold.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
renderer.getFontResolver().addFont("/Library/Fonts/Verdana Italic.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
renderer.getFontResolver().addFont("/Library/Fonts/Verdana Bold Italic.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
¿Fue útil?

Solución

SOLUTION: Okay, I got this one solved. Turns out I did need to embed the Verdana font into the PDF using the follow lines of Java code:

renderer.getFontResolver().addFont("/Library/Fonts/Verdana.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
renderer.getFontResolver().addFont("/Library/Fonts/Verdana Bold.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
renderer.getFontResolver().addFont("/Library/Fonts/Verdana Italic.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
renderer.getFontResolver().addFont("/Library/Fonts/Verdana Bold Italic.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top