API Reference

Cmdlet

Export-OfficeDocumentPdf

Namespace PSWriteOffice
Inputs
System.Object System.String
Outputs
System.IO.FileInfo

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

Authored help example

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: Document

Parameters

Document Object requiredposition: 0pipeline: True (ByValue)
Live Word, Excel, PowerPoint, Markdown, or RTF document to export. Saved FileInfo and path strings from the pipeline are opened automatically.
ExcelOptions ExcelPdfSaveOptions optionalposition: namedpipeline: False
Excel-specific PDF options.
MarkdownOptions MarkdownPdfSaveOptions optionalposition: namedpipeline: False
Markdown-specific PDF options.
Open SwitchParameter optionalposition: namedpipeline: Falsealiases: Show
Open the PDF after exporting it.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the saved PDF file.
Password String optionalposition: namedpipeline: False
Password used to open an encrypted Word, Excel, or PowerPoint source file.
Path String requiredposition: 1pipeline: Falsealiases: FilePath, OutputPath
Destination PDF path.
PdfConversionReportVariable String optionalposition: namedpipeline: False
Variable name that receives the structured PDF conversion report.
PdfWarningVariable String optionalposition: namedpipeline: False
Variable name that receives structured PDF conversion warnings.
PowerPointOptions PowerPointPdfSaveOptions optionalposition: namedpipeline: False
PowerPoint-specific PDF options.
RtfOptions RtfPdfSaveOptions optionalposition: namedpipeline: False
RTF-specific PDF options.
WordOptions WordPdfSaveOptions optionalposition: namedpipeline: False
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: Path

Parameters

ExcelOptions ExcelPdfSaveOptions optionalposition: namedpipeline: False
Excel-specific PDF options.
InputPath String requiredposition: 0pipeline: True (ByPropertyName)aliases: FullName, SourcePath
Source .docx, .xlsx, .pptx, .md, .markdown, or .rtf file.
MarkdownOptions MarkdownPdfSaveOptions optionalposition: namedpipeline: False
Markdown-specific PDF options.
Open SwitchParameter optionalposition: namedpipeline: Falsealiases: Show
Open the PDF after exporting it.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the saved PDF file.
Password String optionalposition: namedpipeline: False
Password used to open an encrypted Word, Excel, or PowerPoint source file.
Path String requiredposition: 1pipeline: Falsealiases: FilePath, OutputPath
Destination PDF path.
PdfConversionReportVariable String optionalposition: namedpipeline: False
Variable name that receives the structured PDF conversion report.
PdfWarningVariable String optionalposition: namedpipeline: False
Variable name that receives structured PDF conversion warnings.
PowerPointOptions PowerPointPdfSaveOptions optionalposition: namedpipeline: False
PowerPoint-specific PDF options.
RtfOptions RtfPdfSaveOptions optionalposition: namedpipeline: False
RTF-specific PDF options.
WordOptions WordPdfSaveOptions optionalposition: namedpipeline: False
Word-specific PDF options.

Outputs

System.IO.FileInfo