The problem is not the last parameter: 2.
It's the missing PrintRange parameter. The parameter is optional, but check this: https://sourceforge.net/p/pywin32/bugs/339/
(It defines "[in, optional, defaultvalue(0)] PrintRange* PrintRange" which leads to the generation of "PrintRange=0")
Same problem for jacob. I had the same problem and solved it like this:
I would like to export a PowerPoint presentation as PDF. It work by using the presetation method SaveAs:
comPowerpoint = new ActiveXComponent("PowerPoint.Application");
Dispatch comPresentations = Dispatch.get(comPowerpoint, "Presentations").toDispatch();
Dispatch comPresentation = Dispatch.call(comPresentations, "Open", "D:\temp\dummy.pptx").toDispatch();
Dispatch.call(comPresentation, "SaveAs", "D:\temp\dummy3.pdf", 32);
The magic number 32 selects PDF as output format.
But that would export the slides only. In order to export the notes, I tried to use the method ExportAsFixedFormat instead:
Dispatch.call(comPresentation, "ExportAsFixedFormat", "D:\temp\dummy3.pdf", 2);
(For notes instead of slides more parameters are necessary).
That call ends in an exception thrown:
com.jacob.com.ComFailException: A COM exception has been encountered:
At Invoke of: ExportAsFixedFormat
Description: 80020005 / Typkonflikt.
By trial and error I discovered that the magic number 2 seems to be the reason. But what do I have to supply as third parameter for selecting PDF?
Thanks in advance
Dirk
Long time ago, but still the same problem!
The problem is not the last parameter: 2.
It's the missing PrintRange parameter. The parameter is optional, but check this:
https://sourceforge.net/p/pywin32/bugs/339/
(It defines "[in, optional, defaultvalue(0)] PrintRange* PrintRange" which leads to the generation of "PrintRange=0")
Same problem for jacob. I had the same problem and solved it like this:
Above code is not production ready because empty presentations are not checked, but this shouldn't be a big problem.