Skip to content
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

Output yields a file as large as my template, however, it should be removing slides, and just a resave yields a fraction of the size. #90

Closed
creedmangrum opened this issue Mar 12, 2024 · 7 comments
Labels
question Further information is requested

Comments

@creedmangrum
Copy link

creedmangrum commented Mar 12, 2024

Hello,

This library is a lifesaver. I love it. I am seeing a strange issue though. I have a template that has ~150 slides and the file is ~2GB. The process I use only re-adds a few of the slides so the output is only 10 slides. The file remains ~2GB. If I open the pptx file, then just save it again it decreases to 50MB. I have tried turning on "cleanup" and "removeExistingFiles" to no avail. Even increasing the compression level doesn't do anything. The file is always ~2GB on output, even though the contents are much smaller. This is an issue because the file appears to be so large that it does not upload/download to aws from our api very quickly, and our api's node version doesn't write files that are >2GB.

I removeExistingFiles then add slides to the presentation if they are supposed to be included. If I add zero slides to the deck, i get an empty deck, but the size is still 2GB on initial output.

Thanks, I'm sure I am missing something silly. Any help would be appreciated.

EDIT: I figured I would include a loom describing what I'm seeing.

https://www.loom.com/share/e4908c62aa294d87967fa65a68ccc56c

@singerla
Copy link
Owner

Hi! I'm happy to hear that you like it! :) And, I'm excited, it is the first time for me to see it in action like this :) Wow!

I guess it is because you have discovered one of the darkest secrets of pptx-automizer: If you truncate root presentation, it will only clear the slides list, but not remove any data from pptx archive.

Try the following:

  • Take your root template in PowerPoint and delete all slides. Save it as an empty root presentation.
  • .load your original root template as a slides library
  • Optionally, try to split your slides template into several files. You could group them by slide master to prevent unused slide masters from being loaded.
  • You could also try to remove all "special" slide masters from RootTemplate and use automizer with autoImportSlideMasters: true.

It could look like this:

  const pres = automizer
    .loadRoot(`RootTemplate.pptx`)  // Contains generic slide masters, but no slides
    .load(`SlidesGroup1.pptx`)
    .load(`SlidesGroup2.pptx`);

This way, pptx-automizer will only copy the required data to your output presentation. Take a look at the slide masters in your output and see if there are any unused layouts. Continue splitting your loaded templates until it fits.

I'm happy to get your feedback!

@singerla singerla added the question Further information is requested label Mar 12, 2024
@creedmangrum
Copy link
Author

Thank you for the feedback! I will give your suggestions a try and follow up here. Appreciate the quick reply as well.

@singerla
Copy link
Owner

You might have already discovered #40, maybe there is something helpful there.

@creedmangrum
Copy link
Author

I was able to generate a new deck from the empty one and the size was much better and it had the correct number of slides, however the slide backgrounds and images got all messed up. Might just need to keep playing with it. Do you know if slide backgrounds will work given that they are some of the image data from the other slide? Maybe I will send another video later of what I am seeing.

@singerla
Copy link
Owner

singerla commented Mar 13, 2024

I'm glad to hear that you could partially solve it. Regarding slide backgrounds, it seems to be related to #86 and #85. I've never had an image as a slide background in my projects, so I have not implemented anything for it :)

@MP70: Am I right that you just needed to define the background color? Or will you also need import/modify background images?

Regarding background images, I've created #91

@singerla
Copy link
Owner

In the meantime, you might be able to avoid issues with related background images if you don't use PowerPoint's function to select an image as background format, but to simply place it directly as a "normal" image on the slide master.

@MP70
Copy link
Collaborator

MP70 commented Mar 13, 2024

@MP70: Am I right that you just needed to define the background color? Or will you also need import/modify background images?

Both ideally as I'm doing them manually at the moment. If you need a hand please give me a shout! @singerla

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants