-
Notifications
You must be signed in to change notification settings - Fork 666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node module appends to last generated PPT on save() #38
Comments
Thanks for opening an issue. I was not able to reproduce this, however, I was using the same name for the output file which I can see might cause the Zip library to append instead of creating a new one. I've now added a timestamp to the output filename so that this situation will be avoided. Let me know if the issue persists. |
Hi @gitbrent Thanks for looking into it. I've tried using different filename and also tried deleting the old PPT before generating the new one. Neither worked. Here's a Node script that reproduces the issue (and possibly another issue).
|
I also had this issue and fixed it by invalidating cache.
That should solve your issue. |
Excellent. That fixed it. Thanks @shivampadaliya |
Ohhh, I completely misunderstood what you @alexanderpepper reported. This is the expected behavior. The act of saving a Presentation doesn't automatically clear all the existing Slides, which is what is sounds like you were expecting. You can continue to .add* lots of things to the same In order to generate new, unique Presentations, one would just grab a new instance of the library, which is what @shivampadaliya 's solution provides. var pptx = new PptxGenJS();
pptx.addNewSlide().addText('pres 1', {x:1, y:1});
pptx.save('PptxGenJS-Sandbox-1');
// "Reset" pptx
pptx = new PptxGenJS();
pptx.addNewSlide().addText('pres 2', {x:1, y:1});
pptx.save('PptxGenJS-Sandbox-2'); Thanks to you both for reporting this and helping document the behavior. |
I've made a reset function to reset the pptx object like this:
and call this function to reset the last generated ppt... |
This works if you do it on client with Angular for example; let PptxGenJS=Object.getPrototypeOf(pptx).constructor; It resets the object |
This issue is resolved now (v 2.0.0). See Issue #83 |
I'm using the node module in a Sails.js project.
The first time I generate a PPT, everything looks good. When I generate a second PPT, the output file contains both presentations. A third call to .save() will produce a file with all three presentations.
I've tried requiring the module each time my generating method is called instead of a single time at the top of the file, but that's not working.
Is the library caching the last presentation? Is there any way to clear it?
The text was updated successfully, but these errors were encountered: