fraserxu / electron-pdf

📄 A command line tool to generate PDF from URL, HTML or Markdown files.
MIT License
1.24k stars 136 forks source link

Support exports to PowerPoint (Experimental) #111

Closed codecounselor closed 8 years ago

codecounselor commented 8 years ago

Requirements

When the output file has a .ppt or .pptx extension

fraserxu commented 8 years ago

This sound exciting! Thanks for the great work @codecounselor .

As for exporting .ppt and .pptx, this sounds a very special use case for me.

Do you think we can make this functionality a separate module, that works similar to what electron-pdf, that only does pdf2ppt or pdf2pptx.

And say if a user ever want to convert a markdown file to ppt, we use electron-pdf to convert it to a pdf first, and then user the pdf2ppt module to take over the work. This could be done either:

  1. call pdf2ppt inside electron-pdf, and we use it by make it a dependency of electron-pdf
  2. we separate this into 2 steps, and pass the result to pdf2ppt module.

We can discuss what tool we use for pdf2ppt later but I'd like to address how we approach to this problem first, what do you think?

codecounselor commented 8 years ago

I got this working today, I will probably push that later tonight. Separating it sounds good on paper for sure. But my use case is such that I may have a lot (> 100) of multi-page PDFs to turn into images and stick in a powerpoint. Being able to multi-thread that in a single process is why I'd like to leave it here for now. I'll follow up with more details in a later post, but maybe we could have some ENV settings to disable certain features if people don't want them.

As for the tools, I'm using pdf2images-multiple to split the PDF into images. Turns out pdf.js isn't really meant for that purpose.

codecounselor commented 8 years ago

Come to think of it, maybe if we just emit events when files are ready the powerpoint and pdf splitting could be somewhere else. I will try that

codecounselor commented 8 years ago

runExport now fires pdf-complete after each PDF is available on the filesystem with an object containing the property file pointing to the PDF on the local filesystem

codecounselor commented 8 years ago

I have created https://github.com/SpiderStrategies/pdf-powerpoint in order to perform the PDF->PPTX conversion