API Reference
Cmdlet
Add-OfficePdfAttachment
Adds an embedded file attachment to a generated PDF document.
Remarks
Adds an embedded file attachment to a generated PDF document.
Examples
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:
ContextParameters
- Description String
- Optional human-readable attachment description.
- MimeType String
- Optional MIME type for the embedded file.
- Name String
- Optional embedded file name. The source file name is used when omitted.
- PassThru SwitchParameter
- Emit the updated document.
- Path String
- File path to embed in the generated PDF.
- Relationship PdfAssociatedFileRelationship
- 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:
DocumentParameters
- Description String
- Optional human-readable attachment description.
- Document PdfDocument
- PDF document to update outside the DSL context.
- MimeType String
- Optional MIME type for the embedded file.
- Name String
- Optional embedded file name. The source file name is used when omitted.
- PassThru SwitchParameter
- Emit the updated document.
- Path String
- File path to embed in the generated PDF.
- Relationship PdfAssociatedFileRelationship
- Associated-file relationship between the PDF and the embedded file.
- Possible values:
Unspecified,Source,Data,Alternative,Supplement
Outputs
OfficeIMO.Pdf.PdfDocument