Embedding fonts to pdf using report engine api

DangermouseDangermouse Junior Member
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

  • mwilliamsmwilliams BIRT Guru
    edited December 31, 1969
    Hi Stefan,



    Here's a thread from eclipse.org that might help you out with that.



    http://dev.eclipse.org/newslists/news.eclipse.birt/msg01127.html



    Hope it helps!

    Regards,

    Michael Williams

    eSignLive Evangelism & Community Manager | eSignLive by VASCO
     
    Find me on:
    Twitter
    Facebook
    Blog
    LinkedIn

    eSignLive Developer Community
     
    Email me:
    Google: [email protected]

  • DangermouseDangermouse Junior Member
    edited December 31, 1969
    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:


    ...





    ...



    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
  • gliugliu Junior Member
    edited December 31, 1969
    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.
  • CBRCBR Member
    edited December 31, 1969
    Hi,



    i m not sure if it's enough to just add the font to that xml file.

    I already embedded custom fonts while running reports using the report engine api directly.

    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:





    ... // i asume that you already have a object of type IPDFRenderOption

    pdfRenderOption.setFontDirectory("C:/myFontLocation");

    pdfRenderOption.setEmbededFont(true);





    also see IPDFRenderOption (Birt Engine API) for javadoc
  • 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 here.

  • Hello,


     


    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? 


     


    If not, how else do I make sure that the report continues to use the same font ion the server?


     


    Thanks!


  • How will you be generating/viewing the report on the server?


     


    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.


    Regards,

     

    Jesse Freeman

    Solution Consultant

    OpenText Corporation

    http://www.actuate.com | http://www.opentext.com

     

  • Thanks, So installing the font on the server where the report will be generated should work right?


     


    I used RCP Designer to design the report using the Century Gothic font on a Windows Machine. 


     


    But when I open it in the Eclipse All-in-one on a Mac which has the same font installed, the report defaults to some other font.


     


    In eclipse on Mac I only have the font choices of Cursive, Fantasy, Monospace, Sans Serif and Serif


     


    How do I make sure the same font displays all the time?


     


    Thanks!


     


  • I would make sure that the font is installed properly on the other machine.

    If the font is installed on the machine in the default location it should be picked up by the eclipse designer.


     


    You should also inspect the fontsConfig.xml for you environment and make sure that the location where your fonts are installed is listed.


    Regards,

     

    Jesse Freeman

    Solution Consultant

    OpenText Corporation

    http://www.actuate.com | http://www.opentext.com

     

  • 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

Sign In or Register to comment.