Cmdlet
New-OfficePdf
Creates a live PDF document or atomically saves a completed composition block.
Syntax
New-OfficePdf
[-BoldFontPath <String>]
[-BoldItalicFontPath <String>]
[-CenterWindow]
[-CreateOutlineFromHeadings]
[-DisplayDocTitle]
[-FileVersion <Pdf14| Pdf15| Pdf16| Pdf17| Pdf20>]
[-FitWindow]
[-FlattenVisualAnnotations]
[-Font <String>]
[-FontPath <String>]
[-Force]
[-HideMenubar]
[-HideToolbar]
[-HideWindowUI]
[-IncludePageLabels]
[-ItalicFontPath <String>]
[-OpenActionMode <PdfOpenActionDestinationMode>]
[-OpenActionPage <Int32>]
[-OpenActionTop <Double>]
[-OutlineExpansionLevel <Int32>]
[-OwnerPassword <SecureString>]
[-PageLabelPrefix <String>]
[-PageLayout <PdfCatalogPageLayout>]
[-PageMode <PdfCatalogPageMode>]
[-Password <SecureString>]
[[-Path] <String>]
[-Permission <PdfStandardPermissions>]
[-Size <OfficeLength>]
[-Theme <OfficeThemeInput>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]#Parameter set:
LiveNew-OfficePdf
[-AllowLoss]
[-BoldFontPath <String>]
[-BoldItalicFontPath <String>]
[-CenterWindow]
[-Content] <ScriptBlock>
[-CreateOutlineFromHeadings]
[-DisplayDocTitle]
[-FileVersion <Pdf14| Pdf15| Pdf16| Pdf17| Pdf20>]
[-FitWindow]
[-FlattenVisualAnnotations]
[-Font <String>]
[-FontPath <String>]
[-Force]
[-HideMenubar]
[-HideToolbar]
[-HideWindowUI]
[-IncludePageLabels]
[-ItalicFontPath <String>]
[-OpenActionMode <PdfOpenActionDestinationMode>]
[-OpenActionPage <Int32>]
[-OpenActionTop <Double>]
[-OutlineExpansionLevel <Int32>]
[-OwnerPassword <SecureString>]
[-PageLabelPrefix <String>]
[-PageLayout <PdfCatalogPageLayout>]
[-PageMode <PdfCatalogPageMode>]
[-PassThru]
[-Password <SecureString>]
[-Path] <String>
[-Permission <PdfStandardPermissions>]
[-Show]
[-Size <OfficeLength>]
[-Theme <OfficeThemeInput>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]#Parameter set:
ContentDescription
Without Content no file is written and the native document keeps its optional associated path. A completed block saves and closes; Force is required to replace an existing file.
Examples
Create a themed PDF report.
New-OfficePdf -Path ./Report.pdf -Theme Modern -PassThru {
PdfHeading 'Service review'
PdfParagraph 'All services are available.'
}Create a live document and save it explicitly.
$pdf = New-OfficePdf -Theme Classic -Size 11pt
Add-OfficePdfParagraph -Document $pdf -Text 'Reviewed and approved'
Save-OfficePdf -Document $pdf -Path ./Review.pdfParameters
- -BoldFontPath String
- Optional bold face used with FontPath.
- -BoldItalicFontPath String
- Optional bold italic face used with FontPath.
- -CenterWindow SwitchParameter
- Request PDF viewers to center the document window on screen.
- -CreateOutlineFromHeadings SwitchParameter
- Create PDF outline/bookmark entries from heading elements.
- -DisplayDocTitle SwitchParameter
- Request PDF viewers to display the document title instead of the file name.
- -FileVersion PdfFileVersion
- PDF file header version emitted by OfficeIMO.Pdf.
- Possible values:
Pdf14,Pdf15,Pdf16,Pdf17,Pdf20 - -FitWindow SwitchParameter
- Request PDF viewers to fit the document window to the first displayed page.
- -FlattenVisualAnnotations SwitchParameter
- Flatten generated FreeText and Highlight annotations into static page content.
- -Font String
- Body font family; inherited heading defaults follow the document font.
- -FontPath String
- Regular embedded font file; requires the Font family name.
- -Force SwitchParameter
- Allow a completed content block to replace an existing destination.
- Request PDF viewers to hide the menu bar.
- -HideToolbar SwitchParameter
- Request PDF viewers to hide the toolbar.
- -HideWindowUI SwitchParameter
- Request PDF viewers to hide user-interface elements.
- -IncludePageLabels SwitchParameter
- Emit generated catalog page labels.
- -ItalicFontPath String
- Optional italic face used with FontPath.
- -OpenActionMode PdfOpenActionDestinationMode
- Open-action destination mode.
- Possible values:
Xyz,Fit,FitHorizontal,FitVertical,FitRectangle,FitBoundingBox,FitBoundingBoxHorizontal,FitBoundingBoxVertical - -OpenActionPage Int32
- Initial one-based page shown by PDF viewers that honor open actions.
- -OpenActionTop Double
- Optional open-action top coordinate in the page's native UserUnit space.
- -OutlineExpansionLevel Int32
- Initial outline expansion level when heading outlines are created.
- -OwnerPassword SecureString
- Optional owner password for the generated encrypted PDF.
- -PageLabelPrefix String
- Optional generated page-label prefix.
- -PageLayout PdfCatalogPageLayout
- Catalog page layout hint emitted for generated PDFs.
- Possible values:
SinglePage,OneColumn,TwoColumnLeft,TwoColumnRight,TwoPageLeft,TwoPageRight - -PageMode PdfCatalogPageMode
- Catalog page mode hint emitted for generated PDFs.
- Possible values:
UseNone,UseOutlines,UseThumbs,FullScreen,UseOC,UseAttachments - -Password SecureString
- Password required to open the generated PDF.
- -Path String
- Optional associated destination for a live document; required when a content block saves a file.
- -Permission PdfStandardPermissions
- Operations allowed to readers; defaults to all Standard security permissions.
- Possible values:
Print,ModifyContents,CopyContents,ModifyAnnotations,FillForms,Accessibility,AssembleDocument,HighQualityPrint,All - -Size OfficeLength
- Default body font size. A bare number means points.
- -Theme OfficeThemeInput
- Built-in theme, theme object or document/template whose visual theme is read.
- -WhatIf SwitchParameter
- Shows what would happen if the command runs.
- -Confirm SwitchParameter
- Prompts for confirmation before running the command.
- -AllowLoss SwitchParameter
- Explicitly accept reductions reported by the content block's native save.
- -Content ScriptBlock
- Authoring block to complete before the document is atomically saved and closed.
- -PassThru SwitchParameter
- Return the saved FileInfo after a completed content block.
- -Show SwitchParameter
- Open the saved result in its registered application after the content block succeeds.
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.