Documents connector

This connector helps you to automatically generate and convert documents with the help of Microsoft Flow. Before starting, ensure that you added Plumsail Documents connector to Microsoft Flow.

Create DOCX document from template

Created Word DOCX document from template. Review Word DOCX templates section for more information about template syntax.

We have an article describing how to work with this action in case of managing documents.

Output Parameters

Parameter Description Example
File Content The content of the result .docx file. It is the content of the result file.

Input Parameters

Parameter Description Example
Document content

The raw content of the source .docx template file. You can extract file content from other connectors like:

  • SharePoint
  • Salesforce
  • Box
  • OneDrive
  • Google Drive
  • Dropbox
  • SFTP
  • File System

List of Microsoft Flow connectors

Review Word DOCX templates section for more information about template syntax.

Example of simple table template:

Simple table template
Template data Data to bind to the template in JSON format. You can get this data from some other Microsoft Flow connector. For example you can query SharePoint list or some other system.
[
    {
        "firstName": "Efren",
        "lastName": "Gaskill",
        "email": "egaskill0@opensource.org",
        "payments": [
            {
                "date": "3/10/2018",
                "amount": "$8.91"
            },
            {
                "date": "1/7/2018",
                "amount": "$0.56"
            }
        ]
    }
]

Example

Create document from DOCX template Example

Create XLSX document from template

Created Word XLSX document from template. Review Excel XLSX templates section for more information about template syntax.

Also there is an article describing how to work with this action in case of managing documents.

Output Parameters

Parameter Description Example
File Content The content of the result .xlsx file. It is the content of the result file.

Input Parameters

Parameter Description Example
Document content

The raw content of the source .xlsx template file. You can extract file content from other connectors like:

  • SharePoint
  • Salesforce
  • Box
  • OneDrive
  • Google Drive
  • Dropbox
  • SFTP
  • File System

List of Microsoft Flow connectors

Review Word XLSX templates section for more information about template syntax.

Example of simple table template:

Simple table template
Template data Data to bind to the template in JSON format. You can get this data from some other Microsoft Flow connector. For example you can query SharePoint list or some other system.
[
    {
        "firstName": "Efren",
        "lastName": "Gaskill",
        "email": "egaskill0@opensource.org",
        "payments": [
            {
                "date": "3/10/2018",
                "amount": "$8.91"
            },
            {
                "date": "1/7/2018",
                "amount": "$0.56"
            }
        ]
    }
]

Example

Create document from XLSX template Example

Create HTML from template

Generates raw HTML from a raw HTML template with the help of Microsoft Flow. You can find more examples in this article.

Output Parameters

Parameter Description Example
Result HTML Raw HTML result created from a source HTML template.
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>HTML from template</title>
</head>
<body>
    <ul>
        <li>David Navarro </li>
        <li>Jessica Adams</li>
        <li>Derek Clark</li>
    </ul>
</body>
</html>

Input Parameters

Parameter Description Example
Source HTML

HTML content of a source template. You can specify raw HTML here or extract file content from other connectors like:

  • SharePoint
  • Salesforce
  • Box
  • OneDrive
  • Google Drive
  • Dropbox
  • SFTP
  • File System

List of Microsoft Flow connectors

You can find description of template syntax in this article.

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>HTML from template</title>
</head>
<body>
    <ul>
        {{#each data}}
        <li>{{name}}</li>
        {{/each}}
    </ul>
</body>
</html>
Template data Data to bind to the template in JSON format. You can get this data from some other Microsoft Flow connector. For example you can query SharePoint list or some other system.
{
    "data": [
        {
            "name": "David Navarro "
        },
        {
            "name": "Jessica Adams"
        },
        {
            "name": "Derek Clark"
        }
    ]
}

Example

Convert HTML document to PDF Example

Fill Merge Fields in DOCX document

Creates .docx document by filling merge fields in a .docx document with the help of Microsoft Flow. You can find more examples in this article.

Output Parameters

Parameter Description Example
File Content The content of the result .docx file. It is a Base64 encoded content of the result file.

Input Parameters

Parameter Description Example
DOCX document content

The raw content of the source .docx file with merge fields. You can extract file content from other connectors like:

  • SharePoint
  • Salesforce
  • Box
  • OneDrive
  • Google Drive
  • Dropbox
  • SFTP
  • File System

List of Microsoft Flow connectors

You can find insturctions about creation of a document with merge fields in this article.

Use this link to download the sample document.

Template data Data in JSON format that will be used to fill merge fields in the source document. You can get this data from some other Microsoft Flow connector. For example you can query SharePoint list or some other system.
{
    "EmployerFullName": "David Navarro",
    "EmployeeFullName": "Anil Mittal",
    "CompanyName": "Contoso LLC",
    "Position": "Marketing manager",
    "SalaryAmount": 5000,
    "ListOfBenefits": "list of any benefits that come with employment",
    "BonusesPolicyDescription": "annual evaluation",
    "EffectiveDate": "10/27/2017",
    "TerminationDate": "10/27/2018",
    "State": "New York"
}

Example

Create document from DOCX template Example

Convert DOCX to PDF

Converts .docx document to PDF document with the help of Microsoft Flow. You can find more examples in this article.

Output Parameters

Parameter Description Example
File Content The content of the result PDF file. It is a Base64 encoded content of the result file.

Input Parameters

Parameter Description Example
Document content

The raw content of the source .docx file. You can extract file content from other connectors like:

  • SharePoint
  • Salesforce
  • Box
  • OneDrive
  • Google Drive
  • Dropbox
  • SFTP
  • File System

List of Microsoft Flow connectors

It is a Base64 encoded content of the source template file.

Example

Convert DOCX document to PDF Example

Convert HTML to PDF

Converts HTML document to PDF document with the help of Microsoft Flow. You can find more examples in this article.

Output Parameters

Parameter Description Example
File Content The content of the result PDF file. It is a Base64 encoded content of the result file.

Input Parameters

Parameter Description Example
Source HTML

HTML content of a source file. You can specify raw HTML here or extract file content from other connectors like:

  • SharePoint
  • Salesforce
  • Box
  • OneDrive
  • Google Drive
  • Dropbox
  • SFTP
  • File System

List of Microsoft Flow connectors

<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title>HTML to PDF example
    <style>
        div {
            border: 1px solid lightgray;
            padding: 5px;
            float: left;
        }
    </style>
</head>
<body>
    <div>
        Text in box1
    </div>
    <div>
        Text in box2
    </div>
</body>
</html>
Papper Size Paper size for output PDF file.
  • A4
  • Letter
  • LetterSmall
  • Tabloid
  • Ledger
  • Legal
  • Statement
  • Executive
  • A2
  • A3
  • A4Small
  • A5
  • B4
  • B5
Orientation Page orientation for output PDF file.
  • Portrait
  • Landscape

Example

Convert HTML document to PDF Example

Split PDF

Split PDF document with the help of Microsoft Flow. You can find more examples in this article.

Output Parameters

Parameter Description Example
Result Files Contents The array of raw content of result files. It is an array of Base64 encoded files. You can iterate through them and save them somewhere.

Input Parameters

Parameter Description Example
PDF Document Content Raw content of PDF document.

You may get the content of the source PDF file by "Get file content" action from "SharePoint" connector or from some other connector.

You may use this link to download a sample 10 pages PDF file.

Start Page Index of the first page to start split from (indexes start from 1). 3
End Page Index of the last page to split (inclusive). By default will use the last page of the source document. 7
Split at Page Number of pages per partition. 2
Password The password to decrypt the source document. If it was encrypted earlier. PAs$word

Example

Split PDF Example

Merge PDF

Merge PDF document with the help of Microsoft Flow.

Output Parameters

Parameter Description Example
File Content Raw content of the result file. It is a Base64 encoded content of the result file.

Input Parameters

Parameter Description Example
PDF Documents Content The array of raw content of PDF documents. You may get the content of the source PDF file by "Get file content" action from "SharePoint" connector or from some other connector.

Example

Merge PDF Example

Extract text from PDF document

Extracts text from PDF document to Raw or HTML format with the help of Microsoft Flow.

Output Parameters

Parameter Description Example
File Content Text or raw HTML from the result file.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head><title></title>
            <meta http-equiv="Content-Type" content="text/html; charset="UTF-8">
        </head>
        <body>
            <div style="page-break-before:always; page-break-after:always">
                <div>
                    <p>
                        <b>3</b>
                    </p>
                </div>
            </div>
            <div style="page-break-before:always; page-break-after:always">
                <div>
                    <p>
                        <b>4</b>
                    </p>
                </div>
            </div>
            <div style="page-break-before:always; page-break-after:always">
                <div>
                    <p>
                        <b>5</b>
                    </p>
                </div>
            </div>
            <div style="page-break-before:always; page-break-after:always">
                <div>
                    <p>
                        <b>6</b>
                    </p>
                </div>
            </div>
            <div style="page-break-before:always; page-break-after:always">
                <div>
                    <p>
                        <b>7</b>
                    </p>
                </div>
            </div>

            </div></div>
        </body>
    </html>

Input Parameters

Parameter Description Example
PDF Document Content Raw content of PDF document. You may get the content of the source PDF file by "Get file content" action from "SharePoint" connector or from some other connector.
Start Page Index of the first page to start extraction (indexes start from 1). 3
End Page Index of the last page to extract (inclusive). By default we will use the last page of the source document. 7
Result Type Raw or HTML. HTML
Password The password to decrypt the source document. If it was encrypted earlier. PAs$word

Example

Extract text from PDF Example

Convert PDF to Image

Converts PDF document to image (jpeg, png, gif, bmp) with the help of Microsoft Flow.

Output Parameters

Parameter Description Example
Result Files Contents The array of raw content of result image files. It is an array of Base64 encoded contents of result image files. You can iterate through them and save somewhere.

Input Parameters

Parameter Description Example
PDF Document Content Raw content of PDF document. You may get the content of the source PDF file by "Get file content" action from "SharePoint" connector or from some other connector.
Start Page Index of the first page to start extraction (indexes start from 1). 3
End Page Index of the last page to extract (inclusive). By default we will use the last page of the source document. 7
Pages Page numbers for extraction separated by ';' (only these pages will be extracted). 4;6;7
Image Format The format of the result image.
  • Jpeg
  • Png
  • Gif
  • Bmp
DPI The resolution of the result image (150 based). 300
Password The password to decrypt the source document. If it was encrypted earlier. PAs$word

Example

Convert PDF to Image Example

Fill in PDF Form

Fills in PDF form by provided data with the help of Microsoft Flow.

Output Parameters

Parameter Description Example
File Content Raw content of result file. It is a Base64 encoded content of result file.

Input Parameters

Parameter Description Example
PDF Document Content Raw content of PDF document. You may get the content of the source PDF file by "Get file content" action from "SharePoint" connector or from some other connector.
JSON Data The data that will be used to fill in the form.
{
    "FirstName": "David",
    "LastName": "Navarro",
    "CompanyName": "Contoso LLC",
    "Position": "Marketing manager"
}

Example

Fill in PDF Form Example

Get Form from PDF

Returns data from fillable PDF as JSON with the help of Microsoft Flow.

Output Parameters

Parameter Description Example
Form Data Data from fillable PDF form as JSON.
{
    "FirstName": "David",
    "LastName": "Navarro",
    "CompanyName": "Contoso LLC",
    "Position": "Marketing manager"
}

Input Parameters

Parameter Description Example
PDF Document Content Raw content of PDF document. You may get the content of the source PDF file by "Get file content" action from "SharePoint" connector or from some other connector.
Password The password to decrypt the source document. If it was encrypted earlier. PAs$word

Example

Get Form from PDF Example

Protect PDF document

Protects PDF by adding passwords, copy-, printing-, and other protections to PDF file with the help of Microsoft Flow.

Output Parameters

Parameter Description Example
File Content Raw content of result file. It is a Base64 encoded content of result file.

Input Parameters

Parameter Description Example
PDF Document Content Raw content of PDF document. You may get the content of the source PDF file by "Get file content" action from "SharePoint" connector or from some other connector.
Enable Printing Protect the PDF file from being printed out. Yes
Enable Modification Protect the PDF file from being edited. Yes
Enable Extract Data Allows extraction of text, images, and other media from the PDF file. Yes
Enable Annotate Allows annotation (e.g. comments, form fill-in, signing) of the PDF file. Yes
PDF Owner Password Enter an optional owner password here. This password can be used to disable document restrictions. OwNEr_PAs$word
PDF User Password Enter an optional user password here. Each time an user opens the PDF he will be asked for this password. If you do not want a password prompt then leave this field blank. U$er_PAs$word
Password The password to decrypt the source document. If it was encrypted earlier. PAs$word

Example

Protect PDF Example

Regular Expression Match

Searches an input string for all occurrences of a regular expression and returns all the matches with the help of Microsoft Flow. We would recommend you to use Regex Hero tool to test your expressions. It supports the same syntax as actions.

You can find more examples in this article.

Output Parameters

Parameter Description Example
Is Success True if the input string has at least one occurrences of a regular expression, otherwise false. true
Matches The dynamic response based on a pattern that is used in this action. Contains all matches groups that included in the pattern (named or unnamed). Match0, TaskId, status

Input Parameters

Parameter Description Example
Pattern Regular expression pattern. This pattern can contain inline options to modify behavior of the regular expression. Such options have to be placed in the beginning of the expression inside brackets with question mark: (?YOUR_OPTIONS). For example options (?mi) will allow to process multi line text with case insensitivity. You can find additional information about inline options in the MSDN article. Also you can find an example in this article. Task (?<TaskId>\d+):(?<status>Approve|Reject)
Text String to search for matches. Task 5:Approve\nTask 53:Reject\nTask 52:Approve

Example

Regular Expression Match Example

Regular Expression Replace

In a specified input string, replaces all strings that match a regular expression pattern with a specified replacement string. We would recommend you to use Regex Hero tool to test your expressions. It supports the same syntax as actions.

Output Parameters

Parameter Description Example
Result Result string with replaced substrings that match a regular expression pattern. sd-df-f-ddd-dff-fff

Input Parameters

Parameter Description Example
Pattern Regular expression pattern. This pattern can contain inline options to modify behavior of the regular expression. Such options have to be placed in the beginning of the expression inside brackets with question mark: (?YOUR_OPTIONS). For example options (?mi) will allow to process multi line text with case insensitivity. You can find additional information about inline options in the MSDN article. \s+
Text String to search for matches. sd    df f     ddd    dff   fff
Replacement Replacement string. -

Example

Regular Expression Replace Example

Regular Expression Test

Indicates whether the regular expression specified in the Regex constructor finds a match in a specified input string. We would recommend you to use Regex Hero tool to test your expressions. It supports the same syntax as actions.

Output Parameters

Parameter Description Example
Is Success True if the input string has at least one occurrences of a regular expression, otherwise false. true

Input Parameters

Parameter Description Example
Pattern Regular expression pattern. This pattern can contain inline options to modify behavior of the regular expression. Such options have to be placed in the beginning of the expression inside brackets with question mark: (?YOUR_OPTIONS). For example options (?mi) will allow to process multi line text with case insensitivity. You can find additional information about inline options in the MSDN article. (?<TestGroup1>\d4) (\d5)
Text String to search for matches. 24 45\n435 64 85

Example

Regular Expression Test Example