Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
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

Authored help example

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, ByPropertyName)aliases: FilePath, FullName, LiteralPath
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.