PptxGenJS : How to add font in PptxGenJS

1k Views Asked by At

I am creating PPT from a HTML table using PptxGenJS. While exporting it is taking default font. How i can change font in PPT. I need to know how i can pass font family property while i am generating PPT from HTML table.

1

There are 1 best solutions below

0
On

use "fontFace".

slide.addText("Arial, 32pt, green, bold, underline, 0 inset", {
    x: 0.5,
    y: 5.0,
    w: "90%",
    margin: 0.5,
    fontFace: "Arial",
    fontSize: 32,
    color: "00CC00",
    bold: true,
    underline: true,
    isTextBox: true,
});

note: You cannot just add a custom font without that font first being loaded to whichever presentation software you are using. If you really need to use a special font and have no access to the presentation sotware then you can consider taking a screenshot of the div or text container of the text - save it to base64 and load to your generated ppt as an image.