Flying saucer not considering lower priority font family

33 Views Asked by At

I am using Flying saucer 9.x to generate pdf from HTML document.

I added ArialUnicodeMS font to support all the Asian languages. However, the font takes effect if and only if it is mentioned as first priority like below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <style type="text/css">
        .multiLang {
            font-family: "ArialUnicodeMS", "Arial", "sans-serif", "serif";
        }
    </style>
    <title>Test</title>
</head>

<body>

<div class="multiLang">
    <h1>
        This is from the div: <br/>

        <i>
            KA:ಸ್ವತಂತ್ರರಾಗಿ<br/>
            HN:प्रत्येक व्यक्ति<br/>
            CH: 长部山 卡什亚普<br/>
            JP: アルン <br/>
            Thai: อรุณ <br/>
            Russia: Приходите <br/>
            Korean: 와서 먹어 <br/>
        </i>
    </h1>
</div>
</body>
</html>

The problem here is that it changes the look and feel of the PDF because I have given ArialUnicodeMS as first priority fonts. So I added ArialUnicodeMS as last priority font.

    .multiLang {
        font-family: "Arial", "sans-serif", "serif", "ArialUnicodeMS";
    }

Although it considers Arial sans-serif font for rendering, it fails to print all language fonts (Because, ArialUnicodeMS as last priority is ignored.)

This however works in browsers but not while generating PDF. Am I making some syntactical error here? I tried replacing double quotes with single quotes but still no luck.

0

There are 0 best solutions below