【发布时间】:2022-07-21 02:45:12
【问题描述】:
我正在尝试使用 Powershell 运行文件夹中的所有 PowerPoint,将它们转换为 PDF。我确实制作了一个执行此操作的脚本,但问题是我需要将它们保存为 Notes 格式,只有在您实际打印文档时才可以访问,即使您将其打印到 PDF,而不是将其直接保存到 PDF .
下面的脚本是我修改程序的最有希望的线索,但范围一直处于意外范围内,我不知道为什么。
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)
【问题讨论】:
标签: powershell pdf powerpoint