Embedding fonts to pdf using report engine api

Dangermouse
edited February 11, 2022 in Analytics #1
Hi!

I try to generate a pdf report and embed some custom fonts in it.

Generating the report works. I configured the custom fonts in the fontConfig.xml of the report engine. But i dont't know how to tell birt to embed these fonts into the pdf file.

Any hints?

Thanks a lot!

Stefan

Comments

  • mwilliams
    edited December 31, 1969 #2
    Hi Stefan,<br />
    <br />
    Here's a thread from eclipse.org that might help you out with that.<br />
    <br />
    <a class='bbc_url' href='http://dev.eclipse.org/newslists/news.eclipse.birt/msg01127.html'>http://dev.eclipse.org/newslists/news.eclipse.birt/msg01127.html</a><br />
    <br />
    Hope it helps!
    Warning No formatter is installed for the format ipb
  • Dangermouse
    edited December 31, 1969 #3
    Hi!

    Thanks for your hint, but i couldn't find a solution to my problem.

    I read the posting you told me and found some differences to my situation.

    By the way im using birt 2.3.0 on linux

    I found the following instructions

    1. locating the FOP configuration file for BIRT (fop.xml)
    --> I can not find a fop.xml file. But i found a fontsConfig.xml file and added the following lines to the given xml sections:

    <font-paths>
    ...
    <path path="/usr/local/share/fonts" />
    </font-paths>

    <font-encodings>
    <encoding font-family="32768 NO" encoding="Cp1252" />
    ...
    </font-encodings>


    2. put the font information in the fop.xml
    --> Here, i should create a font metric file with apache fop and put some font information to fop.xml. I generated the file, but don't know where to put in the information. I found no 'fonts' section.

    3. create the font matrix file that is need by FOP
    --> I created the file, but it isn't in use, because of missing configuration in step 2, i think.

    With my configuration, i get a pdf and the font is correctly shown on my system, where the font is installed. But if i print the document on paper, the font is missing. I really get stucked!

    Regards,

    Stefan
  • gliu
    edited December 31, 1969 #4
    The posting discribes a solution in BIRT1.0. In BIRT1.0, FOP is used to convert PDF report. but since version 2.0, FOP is not used in BIRT.

    If you want embed a TrueType font to PDF report in BIRT2.3.0, what you shoud do is to add the font path to fontconfig.xml in org.eclipse.birt.report.engine.fonts plugin.
  • CBR
    CBR
    edited December 31, 1969 #5
    Hi,<br />
    <br />
    i m not sure if it's enough to just add the font to that xml file.<br />
    I already embedded custom fonts while running reports using the report engine api directly.<br />
    So when it comes to output format PDF i set the properties of the PDFRenderOption object accorindgly. All i needed to do was adding the following lines of Java code to my reporting service:<br />
    <br />
    <br />
    ... // i asume that you already have a object of type IPDFRenderOption<br />
    pdfRenderOption.setFontDirectory("C:/myFontLocation");<br />
    pdfRenderOption.setEmbededFont(true);<br />
    <br />
    <br />
    also see <a class='bbc_url' href='http://www.birt-exchange.org/documentation/BIRT_220/EngineJavadoc/engine/api/org/eclipse/birt/report/engine/api/IPDFRenderOption.html'>IPDFRenderOption (Birt Engine API)</a> for javadoc
  • <p>I had a compatible problem with Cyrillic fonts - it always was generated with Helvetica in PDF. I set a style with font-family defined on all containers and voila - I've got a pretty looking pdf. I've got this idea from <a data-ipb='nomediaparse' href='http://developer.actuate.com/community/forum/index.php/topic/23292-customizing-fontsconfig/'>here</a>.</p&gt;
  • <p>Hello,</p>
    <p> </p>
    <p>I have a similar requirement. I am using a font on my local machine in my report to generate PDFs. If upload this .rptdesign file on the server, will the font be automatically embedded in the file? </p>
    <p> </p>
    <p>If not, how else do I make sure that the report continues to use the same font ion the server?</p>
    <p> </p>
    <p>Thanks!</p>
  • <p>How will you be generating/viewing the report on the server?</p>
    <p> </p>
    <p>If you are wanting to generate PDF output on the server with the fonts embedded, then the font will need to be installed on the sever as well. The font is not embedded into the rptdesign directly.</p>
    Warning No formatter is installed for the format ipb
  • <p>Thanks, So installing the font on the server where the report will be generated should work right?</p>
    <p> </p>
    <p>I used RCP Designer to design the report using the Century Gothic font on a Windows Machine. </p>
    <p> </p>
    <p>But when I open it in the Eclipse All-in-one on a<strong> Mac</strong> which <u><em>h<em><u>as</u></em> the same font installed</em></u>, the report defaults to some other font.</p>
    <p> </p>
    <p>In eclipse on Mac I only have the font choices of <em>Cursive, Fantasy, Monospace, Sans Serif and Serif</em>. </p>
    <p> </p>
    <p>How do I make sure the same font displays all the time?</p>
    <p> </p>
    <p>Thanks!</p>
    <p> </p>
  • <p>I would make sure that the font is installed properly on the other machine.<br>
    If the font is installed on the machine in the default location it should be picked up by the eclipse designer.</p>
    <p> </p>
    <p>You should also inspect the fontsConfig.xml for you environment and make sure that the location where your fonts are installed is listed.</p>
    Warning No formatter is installed for the format ipb
  • Hello,

    For custom configuration we need to configure font path in birt runtime jar .
    For that you need to below point
    1. First we have to put custom fonts in separate path .
    2. Put font .ttf files int that path
    3.Extract org.eclipse.birt.runtime_4.4.2.v20150217-1805.jar
    4.Find fontConfig.xml .Go to section.Int that add .save the file
    5.Make all the files as jar and keep the jar in your birt location.
    6.Restart the Birt connector

    Thanks
    Yogesh