I'm added PPTXGENJS using NPM, I added to my component in ANGULAR 5
But when I'm trying to use, I'm getting this error:
pptxgenjs_1.default is not a constructor
Code:
console.log('exporting');
const pptx = new PptxGenJS();
Console:
ERROR
TypeError: pptxgenjs_1.default is not a constructor
Hi @jorgelub12,
How are you including PptxGenJS in your project (in the .ts file, etc.) and how are you invoking it (via .html file)?
Installed via npm in angular project
```
import PptxGenJS from 'pptxgenjs';
createSkeletonPPT() {
const pptx = new PptxGenJS();
pptx.defineSlideMaster({
title: 'MASTER_SLIDE',
bkgd: 'f17f29'/*,
objects: [
{ 'image': { data: this.clientLogo, x: '85%', y: '2%', w: '12%', h: '6%', type: 'contain' } }
]*/
});```
Even im facing the same issue
Hey, try this:
const PptxGenJS = require('pptxgenjs');
const pptx = new PptxGenJS();
pptx.setBrowser(true);
export function generatePPT() {
const slide = pptx.addNewSlide();
const opts = { x: 1.0, y: 1.0, font_size: 42, color: '00FF00' };
slide.addText('Hello World!', opts);
pptx.save();
}
enabling "esModuleInterop": true in your tsconfig.json fixes the problem. link
Most helpful comment
Hey, try this: