Open stancikcom opened 4 years ago
Yes, you can save PowerPoint as PDF.
presentation.saveAs({name: path.join(__dirname, 'Presentation01.pdf'), type: 'pdf'})
But not all 'PpSaveAsFileTypes' are currently supported. Only .ppt .pptx .pdf
I found also this code works
var press = app.Presentations.Open(template_filename);
var ppt = app.Presentations.Item(1);
// https://docs.microsoft.com/en-us/office/vba/api/powerpoint.ppsaveasfiletype
ppt.SaveAs(template_filename+'.pdf',32)
Are the underlying COM methods and attributes redefined? Would not be a thin wrapper secure enough / feasible?
Are the underlying COM methods and attributes redefined? Would not be a thin wrapper secure enough / feasible?_
For some reason, I thought pptx and pdf are the only necessary file types... I would prefer a more flexible wrapper today . And I think it is a useful feature, so I will add it when I get to it. https://github.com/Miramac/node-office-script/blob/master/src/OfficeScript/OfficeScript/Report/Presentation.cs#L256
If you want to use this node.js module for your task, this code should work
const Presentation = require('office-script').Presentation
let presentation
try {
// open a new Presentation
presentation = new Presentation('/full/path/to/your/presentation.pptx')
// Save presentation as PDF
presentation.saveAs({name: '/full/path/to/your/presentation.pdf'), type: 'pdf'})
} catch (e) {
console.error(e)
}
if (presentation) {
presentation.quit() // Close presentation & quit application
}
Is there a posibility when e.g. saving PowerPoint as PDF to add PpSaveAsFileType Enumeration parameters?
Reference: https://social.msdn.microsoft.com/Forums/office/en-US/e6c3cdbe-4920-4ff4-a23e-13641f2ac907/problem-automated-word-saveas-functionality?forum=worddev https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2010/ff760025(v=office.14)?redirectedfrom=MSDN