Subscribe to News feed

Use Microsoft Flow to convert and archive incoming emails in PDF format

Posted at: 2:45 PM on 12 April 2017 by Muhimbi

gmailAs part of our ongoing series about using the Muhimbi PDF Converter Services Online in combination with Microsoft Flow, Logic Apps and PowerApps, we present an example about how to automatically convert the body of incoming emails to PDF, and archive the results in DropBox.

For those not familiar with the product, the Muhimbi PDF Converter Services Online is a popular product to PDF Convert, Merge, Watermark, Secure and OCR files from Microsoft Flow, Logic Apps, PowerApps as well as your own code using C#, Java, Python, JavaScript, PHP, Ruby and most other modern platforms. Leave a message below or contact us if you have any questions.

 

Earlier today we were contacted by a Flow user who wanted to convert incoming emails to PDF. Now, the Muhimbi PDF Converter actually comes with an awesome email to PDF converter, but it expects an MSG or EML file as the input. Unfortunately the various email based triggers that currently ship with Flow (Outlook for Office 365, Outlook.com, Gmail) do not provide files in this format (Please vote here to have it added).  Instead, they expose the message Body, Subject, From, To, Attachments etc.

Even though the MSG file is not available, all the individual elements are. We managed to ‘knock up’ a functional email to PDF converter using Flow in absolute no-time. You may want to customise it further by using the Compose Action to add the subject, from and to fields to the body before sending it into the PDF Converter. You can even use our Merge documents Action to convert the attachments and merge them all, alongside the main body, into a single PDF.

Similar to our other examples, this Flow is just a starting point. You can use a different email service as a trigger (outlook.com, Outlook for Office 365) and send the generated PDF to SharePoint, OneDrive, Google Drive, email, you name it.

 

From a high level, the Flow works as follows:

Convert Email Body to PDF - Overview
The full Flow can be found below. It is automatically created by the Flow Template named Convert Email to PDF and archive in DropBox. After selecting the template make sure the following fields are changed:

  • DropBox Output folder (for HTML emails): The DropBox folder to write the PDF files to.
  • DropBox Output folder (for Text emails): The DropBox folder to write the PDF files to.
     

The Flow itself is relatively straight-forward, but there is one complication. Email may appear to be a simple format, but content can be represented in HTML format, Plain Text and even RTF. Depending on the format we need to send the body either to the HTML converter or the Text converter. In this Flow we use a simple and dirty trick, which is to check if either ‘<html’, ‘<p’ or ‘<br’ can be found in the email body. If it is then we send it to the HTML converter, otherwise the Text converter.

 

Convert Email Body to PDF - Detail - Part 1Convert Email Body to PDF - Detail - Part 2Convert Email Body to PDF - Detail - Part 3 
That is all there is to it. I left this flow running by mistake and when I came in the next day DropBox had synced dozens of emails to my local PC. They looked brilliantly though when opened in a PDF reader.

 

For more details about using Muhimbi’s Flow actions, see the Core Concepts knowledge base article as well as all other Flow related posts.

If you have any questions about extending this template, or implementing it in your environment, then please leave a message below or contact our friendly support desk. We are here to help.

.

Labels: , , , , , ,

Use Microsoft Flow to Convert HTML / Blog posts to PDF

Posted at: 11:43 AM on by Muhimbi

rss

As part of our ongoing series about using the Muhimbi PDF Converter Services Online in combination with Microsoft Flow, Logic Apps and PowerApps, we present a useful example which converts a blog post (basically HTML) to PDF when a new post is added to an RSS feed.

For those not familiar with the product, the Muhimbi PDF Converter Services Online is a popular product to PDF Convert, Merge, Watermark, Secure and OCR files from Microsoft Flow, LogicApps, PowerApps as well as your own code using C#, Java, Python, JavaScript, PHP, Ruby and most other modern platforms. Leave a message below or contact us if you have any questions.

 

We needed a good showcase for converting HTML to PDF. It was hard to narrow it down as everything nowadays is HTML. We settled for combining our HTML conversion sample with one of Flow’s other services, the ability to trigger a Flow when a new post is added to a Blog.

Once converted, the PDF is sent to the author of the Flow, but remember that this is just an example. Other options are to archive the generated PDF somewhere in SharePoint, DropBox, OneDrive, Google Drive or other file storage system. This example uses the RSS feed for the Microsoft Flow blog, naturally any other RSS feed or web page can be used as well.

 

From a high level, the Flow works as follows:

Convert Blog Post & Email - Overview


The full Flow can be found below. It is automatically created by the Flow Template named Send updates from the Flow blog as a PDF by email. Although the default settings are fully functional (send a PDF copy of Flow related blog posts), you may want to change the following fields:

  • RSS feed URL: The URL of the RSS feed to monitor for new posts. Try changing it to http://feeds.feedburner.com/MuhimbiBlog.
  • Email recipients: The recipient of the generated PDF.
     
Convert Blog Post & Email - Detail - Part 1

Convert Blog Post & Email - Detail - Part 2 
That is all there is to it. We were pleasantly surprised by the usefulness of this simple flow. New blog posts are delivered by email to your mobile device overnight. While commuting on a train with a spotty internet connection we were able to read our favourite blog posts.

For more details about using Muhimbi’s Flow actions, see the Core Concepts knowledge base article as well as all other Flow related posts.

If you have any questions about extending this template, or implementing it in your environment, then please leave a message below or contact our friendly support desk. We are here to help.

.

Labels: , , , , , , ,

Need support from experts?

Access our Forum

Download Free Trials