Completed
Last Updated: 14 Sep 2016 16:15 by ADMIN
Art
Created on: 06 Nov 2015 17:58
Type: Feature Request
17
Reporting -- Exporting PDFs -- Embedding/Using Fonts without being installed on a computer
Note: This is related to Support Ticket #985541

When generating a report, we'd like to use a font which is not installed on the system, but which is distributed with our application in a sub-directory of our application's install directory as a .ttf font file.  As part of application initialization, we're making the font available to the application using the below code.

        private static PrivateFontCollection _privateFontCollection;

              if (_privateFontCollection == null)
              {
                   string fontPath = "";
                    try
                    {
                       _privateFontCollection = new PrivateFontCollection();
                       var exePathF = System.Reflection.Assembly.GetExecutingAssembly().Location;
                       var exeDirF = System.IO.Path.GetDirectoryName(exePathF);
                       fontPath = System.IO.Path.Combine(exeDirF, "sub dir with font file", "fontfile.ttf");
                       _privateFontCollection.AddFontFile(fontPath);
                   }
                   catch (Exception ex)
                   {
                       Debug.WriteLine("Exception adding font file, " + fontPath + ", " + ex);
                   }
               }

With the above in place, we're able to specify the font face name provided by the .ttf file and the report works and correctly shows the font.  The issue is when we export to PDF.  It appears that even when we request full font embedding, the font must be installed on the machine (at the time the PDF is created) in order to be embeded in the PDF file.

What we need is to be able to create a PDF with the font embedded but without having installed the font to the machine.  i.e. the PDF generation code needs to be able to handle a font which is not installed but which is added to the application via the PrivateFontCollection class and embed that font in the PDF file.
3 comments
ADMIN
Peter
Posted on: 14 Sep 2016 16:15
Telerik Reporting R3 2016 is live and includes the Private Fonts functionality. For more information check out the following blog post: http://www.telerik.com/blogs/reporting-r3-2016-arrives-packed-with-new-features 

Any feedback is appreciated.
ADMIN
Peter
Posted on: 26 Jul 2016 09:12
We have implemented this feature in Telerik Reporting R3 Beta 1. For more information checkout the following blog post: 

http://www.telerik.com/blogs/sneak-peak-new-features-in-telerik-reporting-r3-beta-1 

Give it a try and let us know about your experience.
Dave
Posted on: 06 Nov 2015 19:17
Excellent Idea!!!!!  2 thumbs up!