Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Convert-OfficeDocument

Module
PSWriteOffice
Inputs
System.Object System.String System.String[]
Outputs
OfficeIMO.OfficeConversionReport OfficeIMO.OfficeBatchItemReport OfficeIMO.OfficeBatchPlan System.IO.FileInfo System.String

Converts files through OfficeIMO's native routes and portable batch engine.

Syntax

Convert-OfficeDocument
[-AllowEmpty]
[-AllowLegacyImportLoss]
[-AsString]
[-AutoRename]
[-CheckpointPath <String>]
[-CompressPdf]
[-Extension <String[]>]
[-FailOnLoss]
[-From <String>]
[-JobName <String>]
[-MaximumFiles <Int32>]
[-MaximumInputBytes <Int64>]
[-MaximumOutputBytes <Int64>]
[-MaximumXmlCharactersInPart <Int64>]
[-NoClobber]
[-Options <Object[]>]
[-OutputDirectory <String>]
[-OutputProfile <Faithful|Lightweight|PrintReady|TextOnly>]
[-Password <SecureString>]
[-PasswordVariable <String>]
[-Path] <String[]>
[-PdfPasswordVariable <String>]
[-Plan]
[-Recurse]
[-ReportPath <String>]
[-Resume]
[-RetryFailed]
[-Route <String>]
[-SaveJob <String>]
[-SkipUpToDate]
[-SummaryVariable <String>]
[-ThrottleLimit <Int32>]
-To <String>
[<CommonParameters>]
#
Parameter set: Path
Convert-OfficeDocument
[-AllowEmpty]
-JobPath <String>
[-Plan]
[-ReportPath <String>]
[-RetryFailed]
[-SummaryVariable <String>]
[<CommonParameters>]
#
Parameter set: Job
Convert-OfficeDocument
[-AllowEmpty]
[-AllowLegacyImportLoss]
[-AsString]
[-AutoRename]
[-CheckpointPath <String>]
[-CompressPdf]
[-Extension <String[]>]
[-FailOnLoss]
[-From <String>]
[-JobName <String>]
-LiteralPath <String[]>
[-MaximumFiles <Int32>]
[-MaximumInputBytes <Int64>]
[-MaximumOutputBytes <Int64>]
[-MaximumXmlCharactersInPart <Int64>]
[-NoClobber]
[-Options <Object[]>]
[-OutputDirectory <String>]
[-OutputProfile <Faithful|Lightweight|PrintReady|TextOnly>]
[-Password <SecureString>]
[-PasswordVariable <String>]
[-PdfPasswordVariable <String>]
[-Plan]
[-Recurse]
[-ReportPath <String>]
[-Resume]
[-RetryFailed]
[-Route <String>]
[-SaveJob <String>]
[-SkipUpToDate]
[-SummaryVariable <String>]
[-ThrottleLimit <Int32>]
-To <String>
[<CommonParameters>]
#
Parameter set: LiteralPath
Convert-OfficeDocument
[-AllowLegacyImportLoss]
[-AutoRename]
[-CompressPdf]
[-FailOnLoss]
[-From <String>]
[-MaximumInputBytes <Int64>]
[-MaximumOutputBytes <Int64>]
[-MaximumXmlCharactersInPart <Int64>]
[-NoClobber]
[-Options <Object[]>]
[-OutputPath] <String>
[-OutputProfile <Faithful|Lightweight|PrintReady|TextOnly>]
[-Password <SecureString>]
[-Path] <String[]>
[-Route <String>]
[-SkipUpToDate]
[-SummaryVariable <String>]
[-To <String>]
[<CommonParameters>]
#
Parameter set: PathFile
Convert-OfficeDocument
[-AllowLegacyImportLoss]
[-AutoRename]
[-CompressPdf]
[-FailOnLoss]
[-From <String>]
-LiteralPath <String[]>
[-MaximumInputBytes <Int64>]
[-MaximumOutputBytes <Int64>]
[-MaximumXmlCharactersInPart <Int64>]
[-NoClobber]
[-Options <Object[]>]
[-OutputPath] <String>
[-OutputProfile <Faithful|Lightweight|PrintReady|TextOnly>]
[-Password <SecureString>]
[-Route <String>]
[-SkipUpToDate]
[-SummaryVariable <String>]
[-To <String>]
[<CommonParameters>]
#
Parameter set: LiteralPathFile
Convert-OfficeDocument
[-AllowLegacyImportLoss]
[-AsString]
[-AutoRename]
[-CompressPdf]
[-FailOnLoss]
-From <String>
[-MaximumInputBytes <Int64>]
[-MaximumOutputBytes <Int64>]
[-MaximumXmlCharactersInPart <Int64>]
[-NoClobber]
[-Options <Object[]>]
[[-OutputPath] <String>]
[-OutputProfile <Faithful|Lightweight|PrintReady|TextOnly>]
[-Password <SecureString>]
[-Route <String>]
[-SummaryVariable <String>]
[-Text] <String>
-To <String>
[<CommonParameters>]
#
Parameter set: Text
Convert-OfficeDocument
[-AllowLegacyImportLoss]
[-AsString]
[-AutoRename]
[-CompressPdf]
[-Document] <Object>
[-FailOnLoss]
[-From <String>]
[-MaximumInputBytes <Int64>]
[-MaximumOutputBytes <Int64>]
[-MaximumXmlCharactersInPart <Int64>]
[-NoClobber]
[-Options <Object[]>]
[[-OutputPath] <String>]
[-OutputProfile <Faithful|Lightweight|PrintReady|TextOnly>]
[-Password <SecureString>]
[-Route <String>]
[-SkipUpToDate]
[-SummaryVariable <String>]
[-To <String>]
[<CommonParameters>]
#
Parameter set: Document

Description

Writes each completed file's conversion evidence as it finishes. Paths resolve through the FileSystem provider before background execution; LiteralPath preserves wildcard characters. Saved jobs use the same contract as Studio and the CLI.

Examples

Convert one document to PDF.

Convert-OfficeDocument -Path ./report.docx -OutputPath ./report.pdf

Convert a file pipeline and retain complete batch counts.

Get-ChildItem ./reports -Filter *.docx | Convert-OfficeDocument -To Pdf -OutputDirectory ./pdf -SummaryVariable summary
$summary

Save and preview a portable conversion job.

Convert-OfficeDocument -Path ./reports -Recurse -To Pdf -OutputDirectory ./pdf -SaveJob ./reports.officejob.json
Convert-OfficeDocument -JobPath ./reports.officejob.json -Plan

Parameters

-AllowEmpty SwitchParameter optionalsets: Path, Job, LiteralPath
Accept an intentionally empty selection without an error.
-AllowLegacyImportLoss SwitchParameter optionalsets: Path, LiteralPath, PathFile, LiteralPathFile, Text, Document
Explicitly accept the native legacy Word importer's reported reductions.
-AsString SwitchParameter optionalsets: Path, LiteralPath, Text, Document
Return converted text to the pipeline instead of publishing a main output file.
-AutoRename SwitchParameter optionalsets: Path, LiteralPath, PathFile, LiteralPathFile, Text, Document
Choose a unique destination name when the requested output exists.
-CheckpointPath String optionalsets: Path, LiteralPath
Checkpoint manifest file. With Resume, defaults to .officeimo-batch.json in the output folder.
-CompressPdf SwitchParameter optionalsets: Path, LiteralPath, PathFile, LiteralPathFile, Text, Document
Apply verified lossless compression to PDF output.
-Extension String[] optionalsets: Path, LiteralPath
Select these source extensions from directories.
-FailOnLoss SwitchParameter optionalsets: Path, LiteralPath, PathFile, LiteralPathFile, Text, Document
Reject a conversion that reports fidelity loss before publishing its output.
-From String required in Textsets: Path, LiteralPath, PathFile, LiteralPathFile, Text, Document
Source format family or exact codec extension. Overrides filenames while retaining their physical source identity.
-JobName String optionalsets: Path, LiteralPath
Display name stored in the saved definition.
-MaximumFiles Int32 optionalsets: Path, LiteralPath
Maximum discovered files, including skipped inputs; zero selects the largest supported bound.
-MaximumInputBytes Int64 optionalsets: Path, LiteralPath, PathFile, LiteralPathFile, Text, Document
Maximum source bytes per file.
-MaximumOutputBytes Int64 optionalsets: Path, LiteralPath, PathFile, LiteralPathFile, Text, Document
Maximum serialized output bytes per file.
-MaximumXmlCharactersInPart Int64 optionalsets: Path, LiteralPath, PathFile, LiteralPathFile, Text, Document
Maximum XML characters in one package part.
-NoClobber SwitchParameter optionalsets: Path, LiteralPath, PathFile, LiteralPathFile, Text, Document
Leave an existing destination unchanged and report its input as skipped.
-Options Object[] optionalsets: Path, LiteralPath, PathFile, LiteralPathFile, Text, Document
Format-owned settings, typed conversion options, or property hashtables.
-OutputDirectory String optionalsets: Path, LiteralPath
Destination folder for a batch.
-OutputProfile OfficeConversionProfile optionalsets: Path, LiteralPath, PathFile, LiteralPathFile, Text, Document
Output intent, subject to the selected route's supported profiles.
Possible values: Faithful, Lightweight, PrintReady, TextOnly
-Password SecureString optionalsets: Path, LiteralPath, PathFile, LiteralPathFile, Text, Document
Runtime source password; saved definitions contain references rather than password values.
-PasswordVariable String optionalsets: Path, LiteralPath
Admitted environment-variable reference for source passwords in a saved job.
-Path String[] requiredposition: 0pipeline: True (ByValue)sets: Path, PathFile
Input files or folders, with FileSystem provider wildcard expansion. Piped paths with OutputPath bind through Document.
-PdfPasswordVariable String optionalsets: Path, LiteralPath
Separate environment-variable reference for PDF source passwords in a mixed-format job.
-Plan SwitchParameter optionalsets: Path, Job, LiteralPath
Preview selected inputs and proposed destinations without output or checkpoint writes.
-Recurse SwitchParameter optionalsets: Path, LiteralPath
Traverse child directories when selecting a folder.
-ReportPath String optionalsets: Path, Job, LiteralPath
New durable run report outside the source, output, checkpoint and job trees.
-Resume SwitchParameter optionalsets: Path, LiteralPath
Continue a checkpointed batch, verifying completed output hashes before reuse.
-RetryFailed SwitchParameter optionalsets: Path, Job, LiteralPath
Retry failed checkpoint items while retaining verified completed outputs.
-Route String optionalsets: Path, LiteralPath, PathFile, LiteralPathFile, Text, Document
Exact executable route identifier from Get-OfficeDocumentCapability -Conversion.
-SaveJob String optionalsets: Path, LiteralPath
Save the portable batch definition instead of executing it; returns its FileInfo.
-SkipUpToDate SwitchParameter optionalsets: Path, LiteralPath, PathFile, LiteralPathFile, Document
Skip a file whose existing output has a strictly newer UTC modification time.
-SummaryVariable String optional
Final batch counts or single-file evidence assigned before any terminal batch error.
-ThrottleLimit Int32 optionalsets: Path, LiteralPath
Maximum simultaneous conversions.
-To String required in Path, LiteralPath, Textsets: Path, LiteralPath, PathFile, LiteralPathFile, Text, Document
Target format family, such as Pdf or Word, or an exact physical extension, such as .doc or .docx. Optional when OutputPath names the target.
-JobPath String requiredsets: Job
Portable job definition to run or preview; relative paths resolve against this file.
-LiteralPath String[] requiredpipeline: True (ByPropertyName)aliases: FullName, PSPathsets: LiteralPath, LiteralPathFile
Input files or folders without wildcard expansion; accepts FileInfo.FullName and provider PSPath.
-OutputPath String required in PathFile, LiteralPathFileposition: 1sets: PathFile, LiteralPathFile, Text, Document
Single-file destination. Its extension selects the target when To is omitted.
-Text String requiredposition: 0pipeline: True (ByValue)sets: Text
Literal source content, interpreted according to From rather than as a filename.
-Document Object requiredposition: 0pipeline: True (ByValue)sets: Document
Caller-owned live document. Conversion captures current edits without saving or closing its source. Piped FileInfo objects and path strings convert as files.

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.