danfickle / openhtmltopdf

An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 2. With SVG image support. Now also with accessible PDF support (WCAG, Section 508, PDF/UA)!

Home Page:https://danfickle.github.io/pdf-templates/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Display hyphen when breaking words

sbrunecker opened this issue · comments

I need to generate documents with German strings that tend to be quite long. Before generating the html I separate words into syllables and add soft hyphens.

Consider the following example:

<table class="table table-bordered">
    <thead>
    <tr>
        <th>Spalte 1</th>
        <th>Spalte 2</th>
        <th>Spalte 3</th>
        <th>Spalte 4</th>
        <th>Spalte 5</th>

    </tr>
    </thead>
    <tbody>

    <tr>
        <td>Haft&shy;pflicht&shy;ver&shy;si&shy;che&shy;rung</td>
        <td>Bun­des­aus­bil­dungs­för­de­rungs­ge­setz</td>
        <td>Gleich­ge­wichts­dich­te­gra­di­en­ten­zen­tri­fu­ga­tion</td>
        <td>Hähn­chen­mast</td>
        <td>Er­trags­scha­den­ver­si­che­rung Mast­ge­flü­gel</td>
    </tr>
    </tbody>
</table>

In Chrome, a hyphen is displayed when printing this example:

image

When generating with openhtmltopdf, no hyphen is displayed:

image

How can I get hyphens as in Chrome?

Thanks @sbrunecker,

Your concise and useful sample, as well as screenshots, allowed me to focus on implementing soft-hyphens rather than coming up with test cases. It should all work now including justification and letter-spacing support.

I'm planning a release in the near future unless something comes up.

Dan.