Step 3: Crafting Our PDF and Connecting PDFMonkey

We’ll be using PDFMonkey to generate our PDFs. If you haven’t already, head over to their website and register for a free account.

Once logged in, click “Create my first Template.”

Click the “Sample data” tab in the newly created template and paste the unformatted meal plan from the previous step. Click the “Save & Refresh” button.

Next, go to the “HTML” tab and paste the following code.

<table id="recipes">
  <tr>
    <th>Day</th>
    <th>Meal</th>
    <th>Name</th>
    <th>Ingredients</th>
    <th>Instructions</th>
    <th>Image</th>
  </tr>
  
  <tr>
    <td>1</td>
    <td>{{ data.mealPlan[0].meals[0].meal }}</td>
    <td>{{ data.mealPlan[0].meals[0].recipe.name }}</td>
    <td>{{ data.mealPlan[0].meals[0].recipe.ingredientLines }}</td>
    <td>{{ data.mealPlan[0].meals[0].recipe.instructions }}</td>
    <td><img src="{{ data.mealPlan[0].meals[0].recipe.mainImage }}" style="max-width: 200px;"></td>
  </tr>
  <tr>
    <td>1</td>
    <td>{{ data.mealPlan[0].meals[1].meal }}</td>
    <td>{{ data.mealPlan[0].meals[1].recipe.name }}</td>
    <td>{{ data.mealPlan[0].meals[1].recipe.ingredientLines }}</td>
    <td>{{ data.mealPlan[0].meals[1].recipe.instructions }}</td>
    <td><img src="{{ data.mealPlan[0].meals[1].recipe.mainImage }}" style="max-width: 200px;"></td>
  </tr>
  <tr>
    <td>1</td>
    <td>{{ data.mealPlan[0].meals[2].meal }}</td>
    <td>{{ data.mealPlan[0].meals[2].recipe.name }}</td>
    <td>{{ data.mealPlan[0].meals[2].recipe.ingredientLines }}</td>
    <td>{{ data.mealPlan[0].meals[2].recipe.instructions }}</td>
    <td><img src="{{ data.mealPlan[0].meals[2].recipe.mainImage }}" style="max-width: 200px;"></td>
  </tr>
</table>

Click “Save & Refresh” again; you should see your meal plan come to life on the right half of your screen. Awesome!

Click “Publish” to save your template.

Head back to Integromat and add another module by clicking “Add another module” on the previously added HTTP module.

Search for “pdfmonkey,” select the module, then select the “Generate a Document” action.

Have a look at PDFMonkey’s API documentation for additional information.

Select your API connection, the App you created in PDFMonkey, the template we created earlier, and add the unformatted meal plan data (from the HTTP module’s response).

To test whether the PDFMonkey module is working correctly, right-click the module, click “Run this module only,” copy and paste the unformatted meal plan data from the HTTP module’s response, and click “OK.”

PDFMonkey will generate your PDF and provide you with the URL to download the PDF. To view the output and download URL, click the number one, top right corner of the module.

As with our earlier HTTP requests, we should see a success message under the “Status” property.

The response will hold additional information regarding the just-generated PDF, the date and time when it was generated, for example, and, more importantly, a URL where the document can be downloaded.

Last updated