Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Get-OfficePdfAttachment

Module
PSWriteOffice
Inputs
System.String
Outputs
OfficeIMO.Pdf.PdfExtractedAttachment System.IO.FileInfo

Gets or extracts embedded file attachments from a PDF.

Syntax

Get-OfficePdfAttachment
[-IgnorePermissionRestrictions]
[-Name <String>]
[-OutputDirectory <String>]
[-Password <String>]
[-Path] <String>
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Examples

List and extract embedded PDF attachments.

$proof = @(
    Get-OfficePdfAttachment -Path .\Examples\Documents\PdfWithAttachment.pdf
    Get-OfficePdfAttachment -Path .\Examples\Documents\PdfWithAttachment.pdf -OutputDirectory .\Examples\Documents\Attachments
)
$proof

First returns attachment metadata, then writes embedded files to disk.

Parameters

-IgnorePermissionRestrictions SwitchParameter optional
After successful password authentication, explicitly ignore owner-imposed extraction restrictions.
-Name String optional
Optional attachment name or file name filter.
-OutputDirectory String optional
Optional directory where attachments should be written.
-Password String optional
Password used to read a Standard password-encrypted PDF.
-Path String requiredposition: 0pipeline: True (ByValue)aliases: FilePath
PDF file path.

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.