【问题标题】:Printing PowerPoints to PDF using Powershell使用 Powershell 将 PowerPoint 打印为 PDF
【发布时间】: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


    【解决方案1】:

    如果您对如何将其转换为 PDF 没有特定要求,您可以使用此脚本执行打印为 PDF 部分,然后只需提出要保存到的文件名。

    How to automate print to pdf with windows powershell

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-10
      • 1970-01-01
      • 2023-03-09
      • 1970-01-01
      • 1970-01-01
      • 2018-03-15
      • 2015-08-21
      • 1970-01-01
      相关资源
      最近更新 更多