Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Optimize-OfficePdf

Module
PSWriteOffice
Inputs
System.String[]
Outputs
System.Object

Writes a smaller or sanitized copy of a PDF.

Syntax

Optimize-OfficePdf
[-AllowLarger]
[-IgnorePermissionRestrictions]
[-KeepDuplicateStream]
[-KeepUnreferencedObject]
[-LoadOptions <PdfLoadOptions>]
[-MinimumStreamCompressionSize <Int32>]
[-NoClobber]
[-NoCompressStream]
-OutputPath <String>
[-PassThru]
[-Password <SecureString>]
[-Path] <String[]>
[<CommonParameters>]
#
Parameter set: Path
Optimize-OfficePdf
[-AllowLarger]
[-IgnorePermissionRestrictions]
[-KeepDuplicateStream]
[-KeepUnreferencedObject]
[-LoadOptions <PdfLoadOptions>]
[-MinimumStreamCompressionSize <Int32>]
[-NoClobber]
[-NoCompressStream]
-OutputDirectory <String>
[-PassThru]
[-Password <SecureString>]
[-Path] <String[]>
[<CommonParameters>]
#
Parameter set: PathDirectory
Optimize-OfficePdf
[-HiddenDataOptions <OfficeHiddenDataOptions>]
[-IgnorePermissionRestrictions]
[-LoadOptions <PdfLoadOptions>]
[-NoClobber]
-OutputPath <String>
[-PassThru]
[-Password <SecureString>]
[-Path] <String[]>
-Sanitize
[<CommonParameters>]
#
Parameter set: PathSanitize
Optimize-OfficePdf
[-HiddenDataOptions <OfficeHiddenDataOptions>]
[-IgnorePermissionRestrictions]
[-LoadOptions <PdfLoadOptions>]
[-NoClobber]
-OutputDirectory <String>
[-PassThru]
[-Password <SecureString>]
[-Path] <String[]>
-Sanitize
[<CommonParameters>]
#
Parameter set: PathSanitizeDirectory
Optimize-OfficePdf
[-AllowLarger]
[-IgnorePermissionRestrictions]
[-KeepDuplicateStream]
[-KeepUnreferencedObject]
-LiteralPath <String[]>
[-LoadOptions <PdfLoadOptions>]
[-MinimumStreamCompressionSize <Int32>]
[-NoClobber]
[-NoCompressStream]
-OutputPath <String>
[-PassThru]
[-Password <SecureString>]
[<CommonParameters>]
#
Parameter set: LiteralPath
Optimize-OfficePdf
[-HiddenDataOptions <OfficeHiddenDataOptions>]
[-IgnorePermissionRestrictions]
-LiteralPath <String[]>
[-LoadOptions <PdfLoadOptions>]
[-NoClobber]
-OutputPath <String>
[-PassThru]
[-Password <SecureString>]
-Sanitize
[<CommonParameters>]
#
Parameter set: LiteralPathSanitize
Optimize-OfficePdf
[-AllowLarger]
[-IgnorePermissionRestrictions]
[-KeepDuplicateStream]
[-KeepUnreferencedObject]
-LiteralPath <String[]>
[-LoadOptions <PdfLoadOptions>]
[-MinimumStreamCompressionSize <Int32>]
[-NoClobber]
[-NoCompressStream]
-OutputDirectory <String>
[-PassThru]
[-Password <SecureString>]
[<CommonParameters>]
#
Parameter set: LiteralPathDirectory
Optimize-OfficePdf
[-HiddenDataOptions <OfficeHiddenDataOptions>]
[-IgnorePermissionRestrictions]
-LiteralPath <String[]>
[-LoadOptions <PdfLoadOptions>]
[-NoClobber]
-OutputDirectory <String>
[-PassThru]
[-Password <SecureString>]
-Sanitize
[<CommonParameters>]
#
Parameter set: LiteralPathSanitizeDirectory

Examples

Use the native OfficePdf command.

Optimize-OfficePdf -Path .\Reports\Annual-Report.pdf -OutputPath .\Reports\Annual-Report-Small.pdf

Parameters

-AllowLarger SwitchParameter optionalsets: Path, PathDirectory, LiteralPath, LiteralPathDirectory
AllowLarger for this operation.
-IgnorePermissionRestrictions SwitchParameter optional
After successful authentication only; never bypasses a missing password.
-KeepDuplicateStream SwitchParameter optionalsets: Path, PathDirectory, LiteralPath, LiteralPathDirectory
KeepDuplicateStream for this operation.
-KeepUnreferencedObject SwitchParameter optionalsets: Path, PathDirectory, LiteralPath, LiteralPathDirectory
KeepUnreferencedObject for this operation.
-LoadOptions PdfLoadOptions optional
LoadOptions for this operation.
-MinimumStreamCompressionSize Int32 optionalsets: Path, PathDirectory, LiteralPath, LiteralPathDirectory
MinimumStreamCompressionSize for this operation.
-NoClobber SwitchParameter optional
NoClobber for this operation.
-NoCompressStream SwitchParameter optionalsets: Path, PathDirectory, LiteralPath, LiteralPathDirectory
NoCompressStream for this operation.
-OutputPath String requiredsets: Path, PathSanitize, LiteralPath, LiteralPathSanitize
OutputPath for this operation.
-PassThru SwitchParameter optional
PassThru for this operation.
-Password SecureString optional
Argument transformation also accepts a plain string (with a warning) or a PSCredential (its password).
-Path String[] requiredposition: 0sets: Path, PathDirectory, PathSanitize, PathSanitizeDirectory
Path for this operation.
-OutputDirectory String requiredsets: PathDirectory, PathSanitizeDirectory, LiteralPathDirectory, LiteralPathSanitizeDirectory
OutputDirectory for this operation.
-HiddenDataOptions OfficeHiddenDataOptions optionalaliases: SanitizationOptionssets: PathSanitize, PathSanitizeDirectory, LiteralPathSanitize, LiteralPathSanitizeDirectory
Hidden-data categories that -Sanitize removes, from New-OfficeHiddenDataOptions or a hashtable such as @{ Kinds = 'ActiveContent, Attachments, DocumentProperties' }. Defaults to attachments and active content: scripts, unsafe actions and links, and rich media.
-Sanitize SwitchParameter requiredsets: PathSanitize, PathSanitizeDirectory, LiteralPathSanitize, LiteralPathSanitizeDirectory
Sanitize for this operation.
-LiteralPath String[] requiredpipeline: True (ByPropertyName)aliases: FullName, PSPathsets: LiteralPath, LiteralPathSanitize, LiteralPathDirectory, LiteralPathSanitizeDirectory
LiteralPath for this operation.

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.