How to embed a Font in a PDF with RDLC

i am using Microsoft.Reporting.WebForms.LocalReport to generate some PDF, everything works like a charm, but now evil marketing wants to use a custom font (they are using such crazy arguments as "corporate identity" and stuff).

i already goggled around and now i know that

  • i need ReportViewer 2008 SP1 or greater
  • the font has to be marked as embedding allowed
  • the font has to be TrueType

but it still doesn't work. i belief that RDLC does not support this feature, does anybody know if this is the case? unfortunately i cant use Server-side reports cause i am lacking a Reporting Server.



Embedding font’s works with Microsoft Reporting 2010 or later the following restrictions still apply

  • Font must be marked as embedding allowed
  • Font must be of type TrueType

You may experience the problem that your Font is getting embedded but your PDF still displays text in Arial. This happened to me after i installed some new fonts on a Windows Server 2008 R2, restarting the AppPool (ASP.NET MVC) did not solve this Problem, a Server restart was needed.

I've done a simple test using Arial Narrow font with Visual Studio 2008 and it worked fine. I've tested the generated PDF on virtual XP machine that doesn't have the font and it rendered ok. Perhaps it's a problem with the font?

Hmm, perhaps it's this - in my test I've used Winforms.LocalReport not WebForms. Perhaps that's the trick?

I was having the same problem, but I've found that the font doesn't need to be embedded. The problem was with the Font Face attribute in the HTML. The HTML editor we were using generated the Font tag like this:

<font face="Impact,Charcoal,sans-serif" size="6">Impact </font>

Which was fine for the Report Viewer, but to produce a PDF file, it needed to look like this:

<font face="Impact" size="6">Impact </font>

So I added code to replace the the attribute values before it was bound to the report:

htmlValue = htmlValue.Replace("Impact,Charcoal,sans-serif", "Impact")
               .Replace("Arial,Helvetica,sans-serif", "Arial")
               .Replace("Georgia,serif", "Georgia")
               .Replace("Verdana,Geneva,sans-serif", "Verdana")
               .Replace("'Courier New',Courier,monospace", "Courier New")
               .Replace("'Lucida Console',Monaco,monospace", "Lucida Console")
               .Replace("Tahoma,Geneva,sans-serif", "Tahoma")
               .Replace("'Times New Roman',Times,serif", "Times New Roman")
               .Replace("'Trebuchet MS',Helvetica,sans-serif", "Trebuchet MS");

  • Font must be marked as embedding allowed
  • Font must be of type TrueType
  • Add your font to windows server fonts

If you do all of the above and font does not show in Pdf report RDLC file,

Maybe you must restart server , it does work for me

Need Your Help

C++ 2 dimensional array with variable size rows

c++ arrays vector multidimensional-array jagged-arrays

How can you create a 2D array,say, arr[][] with 5 rows and each row has a variable number of columns in it?

Splitting YYYYMMDD date into 3 parts in Perl

regex perl datetime

How do I split a date that is of the form YYYYMMDD into its constituents?