Skip to main content

Optimize Document in Power Automate

PDF4me Optimize Document action enables optimizing Word documents for size and performance in Power Automate with three different compression levels and comprehensive optimization techniques. This powerful document optimization feature supports file size reduction, image compression, content cleanup, formatting normalization, and personal information removal with full control over optimization aggressiveness, perfect for document preparation, storage optimization, and performance improvement workflows across Microsoft 365.

Authenticating Your API Request

To access the PDF4me Web API through Power Automate, every request must include proper authentication credentials. Authentication ensures secure communication and validates your identity as an authorized user, enabling seamless integration between your Power Automate flows and PDF4me's powerful Word document optimization services.

Optimize Document Power Automate

Key Features

  • Three Optimization Levels: Low, Medium, and High compression with different techniques
  • File Size Reduction: Achieve 0-90% file size reduction depending on optimization level
  • Image Compression: Intelligent image optimization with quality preservation
  • Content Cleanup: Remove unused macros, comments, and hidden content
  • Formatting Normalization: Clean up redundant formatting and unused styles
  • Personal Information Removal: Remove author, manager, and company information
  • Font Optimization: Normalize fonts and remove unnecessary font properties
  • Compatibility Enhancement: Optimize documents for Word 2016 compatibility

Parameters

Complete list of parameters for the Optimize Document action. Configure these parameters to control document optimization behavior.

Important: Parameters marked with an asterisk (***) are required. Optimization level determines the aggressiveness of optimization techniques applied.

ParameterTypeDescriptionExample
File Content***Base64Source Word File Content
• Map Word file from previous action output
• Supports Word files from SharePoint, Dropbox, OneDrive, email attachments
• Can be dynamically retrieved from flow variables
• Direct base64 can be given in the file content also
• Must be valid Word document (.docx, .doc formats)
• Original document is not modified - new optimized version created
[File Content from Get File]
File Name***StringWord Document Name
• Specify Word file name with extension (.docx, .doc)
• Used for processing and output file naming
• Must include proper file extension
• Supports dynamic naming from flow variables
• Output filename matches input filename
document.docx
Optimization LevelStringCompression Level
Low - Minimal compression (~0-10%) - preserves most formatting and content
Medium - Moderate compression (~50-80%) - removes unused elements, compresses images
High - Maximum compression (~80-90%) - aggressive removal of all unnecessary content
• Default: "Medium"
• Controls aggressiveness of optimization techniques
"Medium"
Culture NameStringDocument Culture/Locale
• Culture code for document processing (e.g., "en-US", "de-DE", "fr-FR")
• Default: null (no culture-specific processing)
• Affects document language and formatting
• Use valid culture codes for international documents
• Used for metadata and localization handling
en-US

Optimization Level Comparison

Understanding the differences between optimization levels helps choose the right approach:

FeatureLowMediumHigh
File Size Reduction0-10%50-80%80-90%
Image Quality80%60%50%
FormattingPreservedNormalizedAggressive cleanup
CommentsPreservedRemovedRemoved
RevisionsPreservedPreservedRemoved
Personal InfoPreservedRemovedRemoved
MacrosPreservedRemovedRemoved
Unused StylesPreservedPreservedRemoved
Hidden ContentPreservedRemovedRemoved
Processing TimeFastMediumSlower

Output

The PDF4me Optimize Document action returns comprehensive output data for seamless Power Automate flow integration:

Table View

Response data in a structured table format:

ParameterTypeDescription
documentBase64Optimized Word document with reduced file size
SuccessBooleantrue if operation successful, false if failed
Error MessageStringError description (null if successful)
ErrorsArrayList of detailed error information (empty array if successful)

Common Error Messages

Understanding and troubleshooting errors helps ensure smooth document optimization workflows:

Error MessageCauseSolution
"Request is empty"Request object is nullProvide valid request object
"Document is empty"Document object is nullProvide valid Word document
"Error optimizing document"General exception during document optimizationCheck document format and parameters. Review exception details in Errors array
"Error loading document from bytes"Invalid or corrupted Word documentVerify the input document is a valid Word file (.docx)
"Error applying compression settings"Error during compression processDocument may be corrupted or have unsupported content

Workflow Examples

The PDF4me Optimize Document action in Power Automate provides comprehensive workflow templates designed for real-world business scenarios:

Automated Email Document Optimization Workflow

Streamline your email distribution with automated document optimization:

Complete Workflow Steps:

  1. Trigger: Document ready for email distribution in SharePoint
  2. Get Document: Retrieve Word document from document library
  3. Optimize Document: Apply Medium optimization for email distribution
  4. Set Parameters: Optimization Level = "Medium" for balanced size/quality
  5. Set Culture: Culture Name = "en-US" for consistent formatting
  6. Email Distribution: Send optimized document to stakeholders
  7. Archive Original: Store original document in archive folder
  8. Log Activity: Record optimization activity in document management system

Business Benefits:

  • Optimizes 200+ documents monthly for email distribution
  • Reduces email attachment sizes by 60-80%
  • Improves email delivery performance
  • Eliminates email size limit issues

Industry Use Cases & Applications

Legal & Professional Services Use Cases

  • Document Distribution: Optimize legal documents for client distribution
  • Public Filing: Prepare documents for public court filings
  • Archive Storage: Optimize legal documents for long-term storage
  • Compliance Documents: Clean up documents for regulatory submissions

Get Help