Convert HTML, Merge PDFs And Adobe Sign Approval Using Power Automate

Introduction

 
In this article, we will learn to implement the Inventory Approval and Sign system using Power Automate. In this scenario, we will insert the inventory items SharePoint list and attach a quotation of the inventory as an attachment. An inventory request will be sent to the inventory manager to sign the inventory request document with an attached quotation. Once the inventory manager will sign the document request document it will change the status of the Inventory request item in the SharePoint list. Here we will implement the whole process using Power automate flow.
 
Note
Here we will use some premium connector to merge the pdfs, sign the inventory request document which needs Adobe premium accounts.
 

Create Inventory List in SharePoint Site

 
We need to create an Appropriate list with appropriate columns.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 

Create Power Automate which triggers on Create of InventoryDemo list item

 
To create a flow, we can visit https://flow.microsoft.com/ and click on Create from left navigation.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Select the Automated Cloud Flow template.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
We will see the dialog box where we need to enter the name of flow and select the When an item is created action and click on Create button.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
The flow will be created with the trigger we have selected where we can select the SharePoint site and our InventoryDemo list to set the trigger.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 

Add Actions to the Flow

 
Add logic actions that will perform when we create items in the InventoryDemo list. Actions will include generate HTML using inserted item data, fetch attachments, converting it into pdf format, and merge it into one pdf then sending it to the Manager for Sign. The signed document should store in the Approved Inventory library. This logic also includes changing the status of the item to pending, Approved, and Declined according to the progress of the document. Every Action is given below with details.
 
Update Item Status to Pending.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Initialize the string variable and place the Html design with current item values.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Html code to paste in Request Html variable is given below.,
  1. <!DOCTYPE html>    
  2. <html>    
  3.     
  4. <head>    
  5.     <meta name="generator" content="Microsoft Flow" />    
  6.     <title>Check Request</title>    
  7.     <style>    
  8.         body {    
  9.             color: #000;    
  10.             font-family: Arial;    
  11.             max-width: 800px;    
  12.             font-size: 14px;    
  13.             padding: 20px;    
  14.         }    
  15.     
  16.         table {    
  17.             width: 100%;    
  18.         }    
  19.     
  20.         table td {    
  21.             vertical-align: top;    
  22.             text-align: left;    
  23.             width: 50%;    
  24.         }    
  25.     
  26.         h1 {    
  27.             font-size: 24px;    
  28.             font-weight: 600;    
  29.             color: #000;    
  30.             text-align: center;    
  31.         }    
  32.    
  33.         #top {    
  34.             padding-bottom: 30px;    
  35.         }    
  36.    
  37.         #top .topTable td {    
  38.             vertical-align: middle;    
  39.         }    
  40.    
  41.         #top .field {    
  42.             font-weight: 600;    
  43.             font-size: x-large;    
  44.             background-color: rgba(250, 70, 22, .3);    
  45.             padding: 10px;    
  46.             width: 50%;    
  47.         }    
  48.    
  49.         #top .value {    
  50.             background-color: rgb(255 242 204);    
  51.             padding: 3px 10px;    
  52.             overflow-wrap: anywhere;    
  53.             width: 50%;    
  54.         }    
  55.    
  56.         #middle .valueTable td {    
  57.             vertical-align: middle;    
  58.         }    
  59.     
  60.         .section {    
  61.             padding: 16px 0 10px;    
  62.             margin-bottom: 20px;    
  63.             border-top: 1px dotted #999;    
  64.         }    
  65.     
  66.         h2 {    
  67.             font-size: 16px;    
  68.             font-weight: 600;    
  69.             color: #000;    
  70.     
  71.         }    
  72.    
  73.         #middle .value {    
  74.             background-color: rgb(255, 242, 204);    
  75.             padding: 3px 10px;    
  76.             display: inline-block;    
  77.             word-breakbreak-word;    
  78.             width: 420px;    
  79.             min-height: 12px;    
  80.         }    
  81.    
  82.         #totalAmount {    
  83.             font-weight: bold;    
  84.             font-size: 1.2em;    
  85.             overflow-wrap: anywhere;    
  86.         }    
  87.    
  88.         #bottom {    
  89.             clear: both;    
  90.             border-top: 1px dotted #999;    
  91.         }    
  92.     
  93.         .valueTable {    
  94.             page-break-after: always;    
  95.         }    
  96.     
  97.         .topTable tr {    
  98.             height: 60px    
  99.         }    
  100.     </style>    
  101. </head>    
  102.     
  103. <body>    
  104.     <div id="top">    
  105.         <h1>Inventory Details</h1>    
  106.     
  107.         <table class="topTable">    
  108.             <tr>    
  109.                 <td class="field">Item Name</td>    
  110.                 <td class="value">@{triggerOutputs()?['body/Title']}</td>    
  111.             </tr>    
  112.             <tr>    
  113.                 <td class="field">Details</td>    
  114.                 <td class="value">@{triggerOutputs()?['body/Details']}</td>    
  115.             </tr>    
  116.     
  117.             <tr>    
  118.                 <td class="field">Quantity</td>    
  119.                 <td class="value">@{triggerOutputs()?['body/Quantity']}</td>    
  120.             </tr>    
  121.             <tr>    
  122.                 <td class="field">Price</td>    
  123.                 <td class="value">@{triggerOutputs()?['body/Price']}</td>    
  124.             </tr>    
  125.             <tr>    
  126.                 <td class="field">Requested By</td>    
  127.                 <td class="value">@{triggerOutputs()?['body/Author/DisplayName']}</td>    
  128.             </tr>    
  129.             <tr>    
  130.                 <td class="field">Requested Date</td>    
  131.                 <td class="value">@{formatDateTime(triggerOutputs()?['body/Created'],'yyyy-dd-MM')}</td>    
  132.             </tr>    
  133.         </table>    
  134.     </div>    
  135. </body>    
  136.     
  137. </html>    
Initialize the array variable with name arrayPDFs where we will bind HTML we generated previously and content of attachments.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Create a temporary HTML file in OneDrive using the HTML content we have generated previously.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Convert created HTML to pdf content.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Append generated pdf content to arrayPDFs array.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate

Fetch attachments of the current item.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Get content of all the attachments one by one using Apply to Each loop.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
We need to apply the condition to check if the attachment is pdf or another doc format. For that, we need to check the content type of the attachment content.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
If @body('Get_attachment_content')['body']['$content-type'] value is equals to application/pdf then we can directly append the attachment into arrayPDFs variable else we need to convert the content into pdf and then we can append converted pdf content into arrayPDFs variable.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Merge all the pdf content from the arrayPDFs variable to one single file.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Merge PDFs action is part of the premium Adobe connector. To use this connector, we need a premium Adobe account and sign in to it. For that, we need to generate the Connection from https://www.adobe.com/go/powerautomate_getstarted and provide the below information to sign in to power automate.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Now, we can delete the temporary HTML that we have created previously in OneDrive. We can pass the id of created file here to delete it. We can get that id as the output of creating file action.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
We need to upload the merged pdf to Adobe sign, and it will generate a document ID in response. For that, we need to pass the PDF file name and PDF file Content from the merge PDFs response. Adobe sign connector is a premium connector that required a premium Adobe Sign account. So we need to sign in to Adobe sign account before we use it.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
We need to create an Adobe sign agreement using Document ID which we get from the uploaded pdf document and send it to Approver. Here we are using a static Approver Email address to make the scenario simple and understandable, but we also can use a dynamic email address from the SharePoint library field, and also, we can use multiple approvers here. Approver will be notified using email and he/she can open the document and sign the merged PDF(it contains information of requested inventory and attached quotations in the same pdf).
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Below we have used Trigger action of Adobe Sign connector which will wait until Approver sign/decline the document. For that, we need to pass the Agreement ID of the agreement that we have created in the previous action. Also, we need to select two events for completion and rejection of the agreement.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
We need to use conditions here. We need to check if Agreement Status is SIGNED. If it is not signed, then we can update the Request Status to Declined.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
But if the condition becomes true then we need to fetch the signed documents in pdf format using Agreement ID.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Now we will store a signed pdf file in the SharePoint library called ApprovedInventory.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Finally, Update Status to Approved.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 

Create Inventory Request for Approval along with Quotation as Attachment

 
We need to go to the InventoryDemo list and create one inventory request item with all inventory details and upload the quotation of inventory as an attachment so the manager can review the quotation and approve or reject the inventory request.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Flow Execution
 
Once the inventory request item will be submitted to the list the Inventory Flow will trigger and change the status to Pending.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
We can also see the running workflow in the workflow history.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Inventory Request Details and quotation will be merged into one pdf and will be sent to the Inventory Manager to sign. The inventory manager can open the pdf using the Review and Sign button.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
The inventory Manager can apply the signature below the document.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Once Approver clicks on the signature field, the dialog for signature will open where Approver has different options to sign like Draw, Type, etc.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
After applying the signature Approver needs to select the button Click to Sign.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Approver also has the option to decline the Inventory or delegate to another approver from the Options dropdown. After Decline, the sign the Inventory request status will be set to Decline.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
If the Inventory manager approves the Inventory Request the Signed file will be stored in the Approved Inventory library and the request status of inventory will be set to Approve.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 
Also, we can see the flow is completed successfully.
 
Convert Html, Merge PDFs and Adobe Sign Approval using Power Automate
 

Summary

 
After reading this article we have a good understanding of implementing functionalities like Converting Html to PDF, merging more than one PDFs to a single PDF file using Adobe Connector, and how Adobe Sign can be implemented in this scenario using Power Automate. This article also gives an understanding of how the Inventory Approval System can be implanted using SharePoint lists/libraries and Power Automate.
 
Feel free to provide feedback for this article. You can also post the next topics you want to explore in the comments 


Similar Articles