PptxGenJS
PptxGenJS copied to clipboard
writeFile() does not return
Hello,
Has anyone encountered the writeFile() function not returning? There are no errors in the console, the then() and catch() are never hit either...
pptx.writeFile(fileName) .then(fileName => { console.log(created file: ${fileName}); }).catch(err => { console.error("ERROR:",err); });
Thank you, Chris
Is PptxGenJS loaded, is pptx instantiated?
Try a test in the console:
// STEP 1: Create a new Presentation
var pptx = new PptxGenJS();
// STEP 2: Add a new Slide to the Presentation
var slide = pptx.addSlide();
// STEP 3: Add any objects to the Slide (charts, tables, shapes, images, etc.)
slide.addText(
'BONJOUR - CIAO - GUTEN TAG - HELLO - HOLA - NAMASTE - OLÀ - ZDRAS-TVUY-TE - こんにちは - 你好',
{ x:0.0, y:0.25, w:'100%', h:1.5, align:'center', fontSize:24, color:'0088CC', fill:{ color:'F1F1F1' } }
);
// STEP 4: Send the PPTX Presentation to the user, using your choice of file name
pptx.writeFile({ fileName: 'PptxGenJs-Basic-Slide-Demo' })
Hi gitbrent,
Yes, it is initiated. I have narrowed the issue down to images.
slide.addImage({ path: imgPath + "logo.png", x: 1, y: 1, w: .5, h: .5, sizing: { type: "contain", w: .5, h: .5 } });
I have verified that the image path is correct. Is there some way to to see where the code is stopping inside of writeFile()? Perhaps a logging option?
Thanks again, Chris
It's a promise-based operation, so you should expect a return of some kind.
If you discover some exception that is preventing proper error handling, please provide the details.
Iam run Angular 13 with pptgenjs 3.10.0 version in my project the PPT was not download , here pptx.writeFile() is not working please help to me , Thanks