This is a migrated thread and some comments may be shown as answers.

Add bold version of a font

3 Answers 215 Views
ClientExportManager
This is a migrated thread and some comments may be shown as answers.
Ahmad
Top achievements
Rank 1
Ahmad asked on 04 Oct 2015, 03:02 PM

Hi

I'm having trouble adding bold version of Calibri font to client export manager pdf setting. Here's what I'm using :

 

RadClientExportManager1.PdfSettings.Fonts.Add("Calibri", "Styles/Fonts/Calibri.ttf");
RadClientExportManager1.PdfSettings.Fonts.Add("Calibri Bold", "Styles/Fonts/CalibriBold.ttf");

 

When I export my element to pdf, parts of text that are not bold look fine, but bold parts fonts is changed to something else. What can I do to add Calibri Bold to pdf setting?

Thanks

3 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 07 Oct 2015, 12:12 PM
Hello,

Our export test, using the Calibri Bold font, showed that when the exported text is not bold it will be exported bold and vice versa. To achieve a consistent look where all of the exported text is bold you can use the k-pdf-export class, which is related to the ClientExportManager's Change the Exported Content before Export functionality. For example, if you want to export the content of the "textExport" div in the following sample:
<div class="textExport">  Normal text <b>bold text</b> normal text <strong>strong text</strong> </div>

You can add the CSS rules posted below, which set a normal font-weight to the <b> and <strong> elements just before the export occurs (using the k-pdf-export class) and the exported content will look like this in the .PDF file:
<style type="text/css">
    .textExport {
        font-family: 'Calibri Bold';
    }
 
    .k-pdf-export .textExport, .k-pdf-export .textExport b, .k-pdf-export .textExport strong {
        font-weight: normal;
    }
</style>

Regards,
Ivan Danchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Hugo Augusto
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 23 Oct 2019, 10:13 PM
What if you need to have a pdf with normal text and bold text? How to support that?
0
Vessy
Telerik team
answered on 25 Oct 2019, 12:20 PM

Hi Hugo,

You can achieve that by using the same approach described by my colleague Ivan, but defining different font weight for the desired class/tag names:

    <style type="text/css">
        .textExport {
            font-family: 'Calibri Bold';
        }

        .k-pdf-export .textExport {
            font-weight: normal;
        }

            .k-pdf-export .textExport b,
            .k-pdf-export .textExport strong {
                font-weight: bold;
            }
    </style>

 

Regards,
Vessy
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ClientExportManager
Asked by
Ahmad
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Hugo Augusto
Top achievements
Rank 2
Iron
Veteran
Iron
Vessy
Telerik team
Share this question
or