API Reference
Cmdlet
Export-OfficeDocumentPdf
Exports a Word, Excel, PowerPoint, Markdown, or RTF document to PDF.
Remarks
Accepts either a live OfficeIMO document from the pipeline or a supported source file.
Examples
Export a live Word document.
PS>
$document | Export-OfficeDocumentPdf -Path .\Report.pdf
Export a supported file without opening it explicitly.
PS>
Export-OfficeDocumentPdf -InputPath .\Report.docx -Path .\Report.pdf -PassThru
Configure Markdown PDF export with ordinary PowerShell parameters.
PS>
$options = New-OfficeMarkdownPdfOptions -Title 'Service report' -IncludeLocalImages -BaseDirectory .\Assets
Export-OfficeDocumentPdf -InputPath .\Report.md -Path .\Report.pdf -MarkdownOptions $options
The New-Office*PdfOptions commands build every format-specific options object; no hashtable or .NET constructor is required.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.
Syntax
Export-OfficeDocumentPdf -Document <Object> [-ExcelOptions <ExcelPdfSaveOptions>] [-MarkdownOptions <MarkdownPdfSaveOptions>] [-Open] [-PassThru] [-Password <String>] -Path <String> [-PdfConversionReportVariable <String>] [-PdfWarningVariable <String>] [-PowerPointOptions <PowerPointPdfSaveOptions>] [-RtfOptions <RtfPdfSaveOptions>] [-WordOptions <WordPdfSaveOptions>] [<CommonParameters>]#Parameter set:
DocumentParameters
- Document Object
- Live Word, Excel, PowerPoint, Markdown, or RTF document to export. Saved FileInfo and path strings from the pipeline are opened automatically.
- ExcelOptions ExcelPdfSaveOptions
- Excel-specific PDF options.
- MarkdownOptions MarkdownPdfSaveOptions
- Markdown-specific PDF options.
- Open SwitchParameter
- Open the PDF after exporting it.
- PassThru SwitchParameter
- Emit the saved PDF file.
- Password String
- Password used to open an encrypted Word, Excel, or PowerPoint source file.
- Path String
- Destination PDF path.
- PdfConversionReportVariable String
- Variable name that receives the structured PDF conversion report.
- PdfWarningVariable String
- Variable name that receives structured PDF conversion warnings.
- PowerPointOptions PowerPointPdfSaveOptions
- PowerPoint-specific PDF options.
- RtfOptions RtfPdfSaveOptions
- RTF-specific PDF options.
- WordOptions WordPdfSaveOptions
- Word-specific PDF options.
Outputs
System.IO.FileInfo
Export-OfficeDocumentPdf [-ExcelOptions <ExcelPdfSaveOptions>] -InputPath <String> [-MarkdownOptions <MarkdownPdfSaveOptions>] [-Open] [-PassThru] [-Password <String>] -Path <String> [-PdfConversionReportVariable <String>] [-PdfWarningVariable <String>] [-PowerPointOptions <PowerPointPdfSaveOptions>] [-RtfOptions <RtfPdfSaveOptions>] [-WordOptions <WordPdfSaveOptions>] [<CommonParameters>]#Parameter set:
PathParameters
- ExcelOptions ExcelPdfSaveOptions
- Excel-specific PDF options.
- InputPath String
- Source .docx, .xlsx, .pptx, .md, .markdown, or .rtf file.
- MarkdownOptions MarkdownPdfSaveOptions
- Markdown-specific PDF options.
- Open SwitchParameter
- Open the PDF after exporting it.
- PassThru SwitchParameter
- Emit the saved PDF file.
- Password String
- Password used to open an encrypted Word, Excel, or PowerPoint source file.
- Path String
- Destination PDF path.
- PdfConversionReportVariable String
- Variable name that receives the structured PDF conversion report.
- PdfWarningVariable String
- Variable name that receives structured PDF conversion warnings.
- PowerPointOptions PowerPointPdfSaveOptions
- PowerPoint-specific PDF options.
- RtfOptions RtfPdfSaveOptions
- RTF-specific PDF options.
- WordOptions WordPdfSaveOptions
- Word-specific PDF options.
Outputs
System.IO.FileInfo