danfickle / danfickle/openhtmltopdf

Some german characters like é does not render to pdf

Open
#659 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.2k
Forks
423
PR merge metrics
No merged PRs in 30d

Description

I have some names like René and Sören wherein é and ö get skipped once rendered into pdf.
It comes as Ren and Sren.

In html these strings get converted to `é` and `ä`

I am using thymeleaf for creating html templates. I pass this html string to OpenHtmlToPdf service to render.
The html string contains the above names as Ren`é` and S`ö`ren

This is how my renderer looks:
PdfRendererBuilder builder = new PdfRendererBuilder();
builder.useFastMode();
builder.withHtmlContent(htmlAsString_from_thymeleaf, this.url);
try ( ByteArrayOutputStream os = new ByteArrayOutputStream()) {
builder.toStream(os);
builder.run();
return os.toByteArray();
} catch (Throwable ex) {
LoggerUtil.error("taxreport-pdf-render-openhtml", ex);
throw new NonRetryableException(ErrorCode.UNKNOWN_ERROR, ex);
}

The font -face that i am currently using
@font-face {
font-family: 'market-sans';
font-style:normal;
font-weight:400;
src: url(../font/MarketSans-Regular.ttf);
}
@font-face {
font-family: 'market-sans';
font-style:normal;
font-weight:700;
src: url(../font/MarketSans-SemiBold.ttf);
}
@font-face {
font-family: 'stsong';
src: url(../font/chinese.stsong.ttf);
}

Can you please help me out by checking if openhtmltopdf supports these characters? é and ö

Do i need to add an additional font-face which handles those characters?

@danfickle

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.