0

I'm trying to use Powershell to run through all the PowerPoints in a folder convert them to PDF. I did make one script that does this but the problem is I need them in saved in Notes format which only seems accessible if you are actually printing the document even if you're printing it to a PDF as opposed to saving it directly to a PDF.

The script below has been my most promising lead to modifying my program but the range keeps being in an unexpected range and I'm not sure why.

Add-type -AssemblyName Office
Add-type -AssemblyName Microsoft.Office.Interop.PowerPoint

$p = new-object -comobject powerpoint.application 
$p.visible = 1  
$document = $p.presentations.open('somefile.ppt')
$ranges = $document.PrintOptions.Ranges
$range = $ranges.Add(1,1)


$document.ExportAsFixedFormat($Path, 
[Microsoft.Office.Interop.PowerPoint.PpFixedFormatType]::ppFixedFormatTypePDF, 
[Microsoft.Office.Interop.PowerPoint.PpFixedFormatIntent]::ppFixedFormatIntentScreen, 
[Microsoft.Office.Core.MsoTriState]::msoFalse, 
[Microsoft.Office.Interop.PowerPoint.PpPrintHandoutOrder]::ppPrintHandoutVerticalFirst, 
[Microsoft.Office.Interop.PowerPoint.PpPrintOutputType]::ppPrintOutputSlides, 
[Microsoft.Office.Core.MsoTriState]::msoFalse, 
$range, 
[Microsoft.Office.Interop.PowerPoint.PpPrintRangeType]::ppPrintAll, 
[System.Reflection.Missing]::Value, 
$true, 
$true, 
$true, 
$true, 
$false, 
[System.Reflection.Missing]::Value)
Grant
  • 11
  • 1

1 Answers1

0

If you don't have a specific requirement of how to get it to PDF you can use this script to perform the printing to PDF portion and then just come up with the file names to save to.

How to automate print to pdf with windows powershell

Jim
  • 692
  • 7
  • 15
  • I've been experimenting with this method and I'm fine with it except I haven't found a way to get it to print the Print Layout of Notes – Grant Jul 20 '22 at 18:54