You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
We use openpdf through flying saucer and we would like to be able to render UTF-8 colored emoji. Until now we are juste able to render them in black and white (or the unique color chosen for the font).
We tried with :
Roboto One Color -> nothing is rendered
Roboto One B&W -> rendered in b&w (normal)
Emoji One Color -> rendered in b&w
I assume that currently openpdf don't take into account the color info in the emoji font. Is it right or am I just doing something wrong ?
Here is the code used to create the pdf from the html
final var processedHtml = templateProcessor.process(templateName, parameters);
try (var os = new ByteArrayOutputStream()) {
final var renderer = new ITextRenderer();
renderer.setDocumentFromString(addTagWhenDetectingEmoji(processedHtml.replaceAll(xml10pattern, "")));
renderer.getFontResolver().addFont("templates/fonts/Roboto-Regular.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
renderer.getFontResolver().addFont("templates/fonts/EmojiOneColor.otf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
renderer.layout();
renderer.createPDF(os, true);
renderer.finishPDF();
return os.toByteArray();
} catch (IOException e) {
throw new PDFGenerationException("Cannot open FileOutputStream", e);
}
I think you are correct. As in the code the declared color is used for the whole font, and not for individual characters/emojis.
This would be a nice feature, to support Fonts with different colors for different characters. As I understand each "character" in the font is a simple image (like an SVG?).
I searched a little for open/free fonts, and many of them come with the SVGs used to create them. Maybe using these SVG instead of the font could be a workaround.
Is your feature request related to a problem? Please describe.
We use openpdf through flying saucer and we would like to be able to render UTF-8 colored emoji. Until now we are juste able to render them in black and white (or the unique color chosen for the font).
We tried with :
I assume that currently openpdf don't take into account the color info in the emoji font. Is it right or am I just doing something wrong ?
Here is the code used to create the pdf from the html
A simplified html given as input
Describe the solution you'd like
Adding the ability to render UTF-8 colored emoji in openpdf
Describe alternatives you've considered
Keeping the emoji in black and white
Additional context
/
The text was updated successfully, but these errors were encountered: