API Reference

Cmdlet

Add-OfficePdfAttachment

Aliases: PdfAttachment
Namespace PSWriteOffice
Aliases
PdfAttachment
Inputs
OfficeIMO.Pdf.PdfDocument
Outputs
OfficeIMO.Pdf.PdfDocument

Adds an embedded file attachment to a generated PDF document.

Remarks

Adds an embedded file attachment to a generated PDF document.

Examples

Authored help example

Embed source data in a generated PDF.

PS>


$dataPath = '.\Examples\Documents\ServiceData.json'
            Set-Content -Path $dataPath -Value '{ "service": "Directory", "status": "Healthy" }'
            New-OfficePdf -Path .\Examples\Documents\PdfWithAttachment.pdf {
                Add-OfficePdfHeading -Text 'Service report'
                Add-OfficePdfAttachment -Path $dataPath -Name 'service-data.json' -MimeType 'application/json' -Description 'Source data used by the report.'
            }
        

Embeds a supporting JSON file in the generated PDF.

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

Add-OfficePdfAttachment [-Description <String>] [-MimeType <String>] [-Name <String>] [-PassThru] -Path <String> [-Relationship <Unspecified|Source|Data|Alternative|Supplement>] [<CommonParameters>]
#
Parameter set: Context

Parameters

Description String optionalposition: namedpipeline: False
Optional human-readable attachment description.
MimeType String optionalposition: namedpipeline: False
Optional MIME type for the embedded file.
Name String optionalposition: namedpipeline: False
Optional embedded file name. The source file name is used when omitted.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the updated document.
Path String requiredposition: 0pipeline: Falsealiases: FilePath
File path to embed in the generated PDF.
Relationship PdfAssociatedFileRelationship optionalposition: namedpipeline: Falsevalues: 5
Associated-file relationship between the PDF and the embedded file.
Possible values: Unspecified, Source, Data, Alternative, Supplement

Outputs

OfficeIMO.Pdf.PdfDocument

Add-OfficePdfAttachment [-Description <String>] -Document <PdfDocument> [-MimeType <String>] [-Name <String>] [-PassThru] -Path <String> [-Relationship <Unspecified|Source|Data|Alternative|Supplement>] [<CommonParameters>]
#
Parameter set: Document

Parameters

Description String optionalposition: namedpipeline: False
Optional human-readable attachment description.
Document PdfDocument requiredposition: namedpipeline: True (ByValue)
PDF document to update outside the DSL context.
MimeType String optionalposition: namedpipeline: False
Optional MIME type for the embedded file.
Name String optionalposition: namedpipeline: False
Optional embedded file name. The source file name is used when omitted.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the updated document.
Path String requiredposition: 0pipeline: Falsealiases: FilePath
File path to embed in the generated PDF.
Relationship PdfAssociatedFileRelationship optionalposition: namedpipeline: Falsevalues: 5
Associated-file relationship between the PDF and the embedded file.
Possible values: Unspecified, Source, Data, Alternative, Supplement

Outputs

OfficeIMO.Pdf.PdfDocument