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

Set proper MIME type for PPTX presentation #471

Closed
StefanBrand opened this issue Jan 7, 2019 · 3 comments
Closed

Set proper MIME type for PPTX presentation #471

StefanBrand opened this issue Jan 7, 2019 · 3 comments
Assignees
Milestone

Comments

@StefanBrand
Copy link

When I save() a presentation and manually remove the ".pptx" at the end of the file name, I get a file that doesn't automatically open with Powerpoint. This is confusing to my users because they like to rename their output presentations (and Powerpoint adds the file extension after pressing the save button).

I suspect that this depends on the MIME type -- if it is not set properly, a file will have no extension unless manually appended. According to this SO answer the MIME type of PPTX presentations is

application/vnd.openxmlformats-officedocument.presentationml.presentation

Can the library support saving with the correct MIME type? A quick try with setting mimeType in zip.generateAsync(...) did not work for me.

PS.: I'm using Electron to build an app and I'm not sure about the implications. It's both a browser and Node.js in some way... All I could find out is that it executes the statement on line 1823.

@StefanBrand
Copy link
Author

StefanBrand commented Jan 8, 2019

I think what I want to accomplish is related to #277. In order to be able to use the proper Electron methods PptxGenJs would have to give me access to fs.

@gitbrent
Copy link
Owner

gitbrent commented Feb 7, 2019

Hi @StefanBrand

Same here. I tried adding a MIME type to the zip call, but it just creates a file that PowerPoint complains abut being corrupt.

The JSZip docs says MIME-type is only for blob files, so it may be that we use nodebuffer for fs calls... i'm not sure.

I'd encourage you to play around with the code and see what you can find.

@gitbrent
Copy link
Owner

gitbrent commented Sep 8, 2019

Hi @StefanBrand

This is now fixed in the current branch and in 3.0

IMG_1705

@gitbrent gitbrent closed this as completed Sep 8, 2019
ericrockey pushed a commit to WeTransfer/PptxGenJS that referenced this issue Mar 24, 2020
ericrockey pushed a commit to WeTransfer/PptxGenJS that referenced this issue Mar 24, 2020
ericrockey pushed a commit to WeTransfer/PptxGenJS that referenced this issue Mar 24, 2020
ericrockey pushed a commit to WeTransfer/PptxGenJS that referenced this issue Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants