pdf-generationapache-fophindi

Apache FOP 2.6 Hindi Rendering issue


I have a standalone program which uses Apache FOP 2.6 to write Hindi text to a PDF using Amiko font using the following font metric configuration (on CentOS 7 / Java 11):

<fop version="2.6">
    <renderers>
        <renderer mime="application/pdf">
            <fonts>
                <font metrics-url="Fonts/Amiko.xml" kerning="yes" embed-url="Fonts/Amiko.ttf" embedding-mode="full">
                    <font-triplet name="any" style="normal" weight="normal" />
                </font>
        <auto-detect/>
            </fonts>
        </renderer>
    </renderers>
</fop>

The Hindi text produced by the above is correct and shows up as follows in the PDF enter image description here

If I remove <auto-detect/>, it changes to enter image description here which is incorrect in almost every word.

So, with the auto-detect tag in place and using the same method with generates the PDF but called from an application server (Wildfly 18 in my case), it always generates the incorrect hindi text as in the last image above. I have tried putting script attribute with deva/dev2 values but it further deteriorates the hindi text in the PDF.

Please help me understand what is missing when the same code is run through app server.


Solution

  • Thanks for looking into this. The issue is resolved now. It seems if additional font families are used in the XSL, they cause this issue. In my case we needed only English & Hindi together on the PDF, we removed the other fonts used from the XSL & it is now producing the correct output.