PDF-Export method do not recognize font weight style

1 Answer 835 Views
PDFViewer
Daniil
Top achievements
Rank 1
Daniil asked on 19 May 2021, 04:23 PM | edited on 20 May 2021, 08:06 AM

I have such a method that converts div with id="pdf-div" to pdf.
Html looks correct, and has all styles that are needed, but result pdf has no font-weight style(that is like font-weight:900) on elements, but font-weight: bold works correct.

kendo.drawing.drawDOM("#pdf-div", {
        scale: scale,
        fitWidth: true,
        paperSize: "A4",
        landscape: isLandscape,
        margin: margin,
        })
        .then(function (group) {
            kendo.drawing.pdf.saveAs(group, fileName, proxyURL, function () {
            //    window.close();
            });
        })

1 Answer, 1 is accepted

Sort by
0
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 24 May 2021, 02:49 PM

Hello Daniil,

You can control the font-weight of an exported PDF utilizing CSS font-face declarations.  Please take a look at the following Progress Kendo UI Dojo which demonstrates one way you can configure it.

Regards,
Patrick
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

Daniil
Top achievements
Rank 1
commented on 25 May 2021, 11:28 AM

Thanks. That's right
Patrick | Technical Support Engineer, Senior
Telerik team
commented on 25 May 2021, 01:33 PM

Happy to help!  Glad all is working well now.  
Daniil
Top achievements
Rank 1
commented on 25 May 2021, 08:53 PM

Maybe you know how to set forceProxy=true in this method?
Cause setting it in with other parameters not working
Patrick | Technical Support Engineer, Senior
Telerik team
commented on 26 May 2021, 09:25 PM

In the Kendo.saveAs method, the forceProxy boolean parameter can be set to true.

Daniil
Top achievements
Rank 1
commented on 26 May 2021, 10:15 PM

Thank you for your answer, but don't you think, that it's bad and it would be better to add, cause as for me I need to have a callback function and force proxy together. But kendo.drawing.pdf.saveAs has only callback and no forceProxy, and kendo.saveAs has forceProxy but no callback...
Patrick | Technical Support Engineer, Senior
Telerik team
commented on 27 May 2021, 06:20 PM

One way you can use forceProxy with kendo.drawing.drawDOM is to use the kendo.drawing.exportPDF method and kendo.saveAs method:

    kendo.drawing.drawDOM("#content", {
        paperSize: "A4",
        margin: "2cm"
    }).then(function (group) {
        console.log("Export");
        return kendo.drawing.exportPDF(group);
    }).done(function (data) {
        kendo.saveAs({
            dataURI: data,
            fileName: "filename.pdf",
            forceProxy: true,
            proxyURL: "/Home/Save",
        });
    });

If you have any further questions regarding the matter, please create a new forum post, and we will continue to help!  

Tags
PDFViewer
Asked by
Daniil
Top achievements
Rank 1
Answers by
Patrick | Technical Support Engineer, Senior
Telerik team
Share this question
or