Some PDF files contain scanned or other ‘inefficient’ content, resulting in extremely large files, slow download speeds and high storage cost.
In this post, we will show a quick and easy way to optimize / compress PDF documents using the Muhimbi Converter Service Online and Power Automate (MS Flow). In this example we use SharePoint for storing files, but other storage providers – including OneDrive, DropBox, Google Drive – work equally well.
Reducing the file size of the PDF will improve download time, bandwidth and storage costs.
Please make sure the following prerequisites are in place:
- An Office 365 subscription with SharePoint Online license.
- Muhimbi PDF Converter Services Online Full or trial subscription (Sign up). Note that the the Free tier does not support this functionality.
- Appropriate privileges to create Flows.
- Working knowledge of SharePoint Online and Microsoft Power Automate (Flow).
Step 1: For this demo, we will use the “When an item is created or modified” SharePoint ‘Trigger’.
In the trigger specify the path to the SharePoint Online List to monitor for new items.
Step 2: Add the Muhimbi “Convert document” action.
- Source file name: “File Name”(the output of the SharePoint “When a file is created or modified in a folder” trigger.).
- Source file content: “File Content” (the output of the SharePoint “When a file is created or modified in a folder” trigger).
- Output format: PDF
- Override settings:
<Override> <ConversionSettings> <!-- Set the output profile --> <PDFProfile>PDF_1_7</PDFProfile> <!-- Force post processing --> <OutputFormatSpecificSettings type="OutputFormatSpecificSettings_PDF"> <FastWebView>false</FastWebView> <EmbedAllFonts>false</EmbedAllFonts> <SubsetFonts>false</SubsetFonts> <PostProcessFile>true</PostProcessFile> </OutputFormatSpecificSettings> </ConversionSettings> </Override>
If you look at the XML Override above, you’ll see that we are converting the document to PDF 1.7. This completely takes the PDF apart and rebuilds it using the facilities of the PDF 1.7 format, which allows for better compression. Please keep in mind that the generated PDF has exactly the same resolution as the source documents, and that in some cases the saving may not be significant. Make sure you run tests using your own documents.
Talk to Muhimbi’s support team if you have any questions, or need assistance.
Step 3: Use the “Create file” SharePoint action to write the PDF document to the SharePoint document library.
- File name: “Base File name.pdf” (output variable of the “Convert document” action).
- File content: “Processed file content” the (output variable of the “Convert document” action).
All done.. Happy converting….