API Reference

Cmdlet

Set-OfficePdfPageSetup

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

Sets PDF page size, orientation, and margins.

Remarks

Sets PDF page size, orientation, and margins.

Examples

Authored help example

Set page size and margins for a generated report.

PS>


New-OfficePdf -Path .\Examples\Documents\PdfPageSetup.pdf {
                Set-OfficePdfPageSetup -PageSize A4 -Margin 42
                Add-OfficePdfHeading -Text 'A4 report'
                Add-OfficePdfParagraph -Text 'The report uses custom margins.'
            }
        

Applies page setup before adding generated PDF content.

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

Set-OfficePdfPageSetup [-Bottom <Nullable`1>] [-Height <Nullable`1>] [-Landscape] [-Left <Nullable`1>] [-Margin <Nullable`1>] [-PageSize <String>] [-PassThru] [-Right <Nullable`1>] [-Top <Nullable`1>] [-Width <Nullable`1>] [<CommonParameters>]
#
Parameter set: Context

Parameters

Bottom Nullable`1 optionalposition: namedpipeline: False
Bottom margin in PDF points.
Height Nullable`1 optionalposition: namedpipeline: False
Custom page height in PDF points when -PageSize Custom is used.
Landscape SwitchParameter optionalposition: namedpipeline: False
Use landscape orientation.
Left Nullable`1 optionalposition: namedpipeline: False
Left margin in PDF points.
Margin Nullable`1 optionalposition: namedpipeline: False
Uniform margin in PDF points.
PageSize String optionalposition: namedpipeline: False
Page size name: A4, A5, Letter, Legal, or Custom.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the updated document.
Right Nullable`1 optionalposition: namedpipeline: False
Right margin in PDF points.
Top Nullable`1 optionalposition: namedpipeline: False
Top margin in PDF points.
Width Nullable`1 optionalposition: namedpipeline: False
Custom page width in PDF points when -PageSize Custom is used.

Outputs

OfficeIMO.Pdf.PdfDocument

Set-OfficePdfPageSetup [-Bottom <Nullable`1>] -Document <PdfDocument> [-Height <Nullable`1>] [-Landscape] [-Left <Nullable`1>] [-Margin <Nullable`1>] [-PageSize <String>] [-PassThru] [-Right <Nullable`1>] [-Top <Nullable`1>] [-Width <Nullable`1>] [<CommonParameters>]
#
Parameter set: Document

Parameters

Bottom Nullable`1 optionalposition: namedpipeline: False
Bottom margin in PDF points.
Document PdfDocument requiredposition: namedpipeline: True (ByValue)
PDF document to update outside the DSL context.
Height Nullable`1 optionalposition: namedpipeline: False
Custom page height in PDF points when -PageSize Custom is used.
Landscape SwitchParameter optionalposition: namedpipeline: False
Use landscape orientation.
Left Nullable`1 optionalposition: namedpipeline: False
Left margin in PDF points.
Margin Nullable`1 optionalposition: namedpipeline: False
Uniform margin in PDF points.
PageSize String optionalposition: namedpipeline: False
Page size name: A4, A5, Letter, Legal, or Custom.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the updated document.
Right Nullable`1 optionalposition: namedpipeline: False
Right margin in PDF points.
Top Nullable`1 optionalposition: namedpipeline: False
Top margin in PDF points.
Width Nullable`1 optionalposition: namedpipeline: False
Custom page width in PDF points when -PageSize Custom is used.

Outputs

OfficeIMO.Pdf.PdfDocument