PptxGenJS icon indicating copy to clipboard operation
PptxGenJS copied to clipboard

writeFile() does not return

Open chrisheld2 opened this issue 4 years ago • 4 comments

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

chrisheld2 avatar Feb 16 '21 20:02 chrisheld2

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' })

gitbrent avatar Feb 17 '21 03:02 gitbrent

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

chrisheld2 avatar Feb 17 '21 13:02 chrisheld2

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.

gitbrent avatar Feb 24 '21 01:02 gitbrent

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

anil957 avatar May 11 '22 01:05 anil957