# MonkeyPDF Integration

**URL:** https://community.glideapps.com/t/monkeypdf-integration/65748
**Category:** Ask for Help
**Created:** [September 3, 2023, 8:59pm UTC](https://community.glideapps.com/t/monkeypdf-integration/65748 "2023-09-03T20:59:16Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![michael\_perkins](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/michael_perkins/32/60903_2.png) [@michael\_perkins](https://community.glideapps.com/u/michael_perkins)
#### Post date: [September 3, 2023, 8:59pm UTC](https://community.glideapps.com/t/monkeypdf-integration/65748/1 "2023-09-03T20:59:16Z")

</div>

I been trying to resolve this issue by following other similar cases however I am not sure what I am doing wrong. I made a html template on the suborders that follows format:

```auto
<tr>
<td>{{Code}}</td>
<td>{{Description}}</td>
<td>{{Call Type Total}}</td>
<td>{{Suborder Total}}</td>
<td>{{Total}}</td>
</tr>

```

Then I went back to orders to make a joint list and add a   
 to break each line, I assumed that once this was done I could pass then the joint list in the PDF integration and get the list but I currently everything shows blank. Here is the html I am using as a template:

```auto
<!--
  Invoice template.
  Styled using Tailwind CSS.
  Head to the CSS tab to learn more.
-->

<div class="flex flex-row items-center justify-between mb-8">
  <div>
    <img
      src= https://res.cloudinary.com/dclzqucbv/image/upload/v1674408757/Perks-1_dlovbe.png
      height="160"
      width="145"
    >
  </div>

  <div class="w-2/5">
    <h1 class="font-bold mb-2 text-4xl">{% if credit %}Credit{% else %}Invoice{% endif %}</h1>
    <dl class="flex flex-wrap justify-between">
      <dt class="pr-2 w-3/12">Number:</dt>
      <dd class="w-9/12">{{invoice_number}}</dd>

      <dt class="pr-2 w-3/12">Date:</dt>
      <dd class="w-9/12">{{invoice_date}}</dd>
    </dl>
  </div>
</div>

<div class="items-center flex justify-between mb-8">
  <dl class="flex flex-wrap justify-between w-1/2">
    <dt class="w-3/12">Client code:</dt>
    <dd class="w-9/12">{{client_code}}</dd>

    <dt class="w-3/12">Due date:</dt>
    <dd class="w-9/12">{{due_date}}</dd>
    
    <dt class="w-3/12">Payment:</dt>
    <dd class="w-9/12">{{payment_mode}}</dd>
  </dl>

  <div class="border-2 border-blue-600 px-4 py-2 w-1/2">
    {{client_name | upcase}}<br />
    {{billing_address | newline_to_br}}
  </div>
</div>

<table class="border-collapse mb-8 numeric-tabular table table-auto w-full">
  <thead>
    <tr class="bg-blue-600 text-white">
      <th class="font-normal text-left">Code</th>
      <th class="font-normal text-left">Description</th>
      <th class="font-normal text-right">Call Type Total</th>
      <th class="font-normal text-right">Suborder Total</th>
      <th class="font-normal text-right">Total</th>
    </tr>
  </thead>
  <tbody>
    {% for item in lineItems %}
				<tr>
        <td>{{Code}}</td>
        <td>{{Description}}</td>
        <td>{{Call Type Total}}</td>
        <td>{{Suborder Total}}</td>
        <td>{{Total}}</td>
				</tr>
		{% endfor %}
    <!-- Adding empty row to always have a minimum of 12 product rows -->
    {% for n in (lineItems.size..12) %}
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    {% endfor %}
  </tbody>
</table>

<div class="flex mb-8">
  <dl class="bg-blue-100 flex flex-wrap leading-snug ml-auto numeric-tabular py-2 w-2/5">
    <dt class="block m-0 p-0 pl-4 w-3/5">TOTAL</dt>
    <dd class="block m-0 p-0 pr-4 text-right w-2/5">${{total_without_vat | with_delimiter, precision: 2}}</dd>
  </dl>
</div>

<hr>

<p class="mt-4 text-center"><small>PERKS HVAC - 123 Waffles Roads 12345 Demo-Ville TestLand<br>
  VAT Number IE 1234567X</small></p>

```

I think I am missing something as I checked the passed items on the form and got the following result:

```auto
lineItems":"\u003ctr\u003e\n\u003ctd\u003e{{Sub Order 1}}\u003c/td\u003e\n\u003ctd\u003e{{Service}}\u003c/td\u003e\n\u003ctd\u003e{{$100.00}}\u003c/td\u003e\n\u003ctd\u003e{{$206.00}}\u003c/td\u003e\n\u003ctd\u003e{{$306.00}}\u003c/td\u003e\n\u003c/tr\u003e\n\u003cbr\u003e\n\u003ctr\u003e\n\u003ctd\u003e{{Sub Order 1}}\u003c/td\u003e\n\u003ctd\u003e{{Service}}\u003c/td\u003e\n\u003ctd\u003e{{$100.00}}\u003c/td\u003e\n\u003ctd\u003e{{$30.00}}\u003c/td\u003e\n\u003ctd\u003e{{$130.00}}\u003c/td\u003e\n\u003c/tr\u003e"}

```

I believe these codes \u003c represent the \< and stuff but I do not think the information should be passed in that format so I must of done something wrong. Any help is greatly appreciated.

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [September 4, 2023, 12:56am UTC](https://community.glideapps.com/t/monkeypdf-integration/65748/2 "2023-09-04T00:56:31Z")

</div>

> [@michael\_perkins](#):
>
> Then I went back to orders to make a joint list and add a  
> to break each line

Can you show us some screenshots of how you’re setting this part up?

> [@michael\_perkins](#):
>
> ```auto
> {% for item in lineItems %}
> <tr>
> <td>{{Code}}</td>
> <td>{{Description}}</td>
> <td>{{Call Type Total}}</td>
> <td>{{Suborder Total}}</td>
> <td>{{Total}}</td>
> </tr>
> 
> ```

Also this looks a bit odd for me. It looks like it should be item.code instead of Code.

---

<div class="post-metadata">

### Author: ![michael\_perkins](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/michael_perkins/32/60903_2.png) [@michael\_perkins](https://community.glideapps.com/u/michael_perkins)
#### Post date: [September 4, 2023, 3:14am UTC](https://community.glideapps.com/t/monkeypdf-integration/65748/3 "2023-09-04T03:14:55Z")

</div>

I made a few adjustments I think I am getting closer

```auto
{% for item in parsedLineItems %}
      <tr>
        <td>{{ item.line_items_code }}</td>
        <td>{{ item.line_items_description }}</td>
        <td>{{ item.line_items_calltypetotal }}</td>
        <td>{{ item.line_items_subordertotal }}</td>
        <td>{{ item.line_items_total }}</td>
      </tr>
    {% endfor %}

```

The current out put is:

```auto
"lineItems":"[{\"line_items_code\":\"Sub Order 1\",\"line_items_description\":\"Service\",\"line_items_calltypetotal\":200,\"line_items_subordertotal\":66,\"line_items_total\":266}, {\"line_items_code\":\"Sub Order 2\",\"line_items_description\":\"Maintenance\",\"line_items_calltypetotal\":30,\"line_items_subordertotal\":0,\"line_items_total\":30}]"

```

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [September 4, 2023, 3:16am UTC](https://community.glideapps.com/t/monkeypdf-integration/65748/4 "2023-09-04T03:16:50Z")

</div>

> [@michael\_perkins](#):
>
> `parsedLineItems`

Why is this parsedLineItems and not lineItems?

---

<div class="post-metadata">

### Author: ![michael\_perkins](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/michael_perkins/32/60903_2.png) [@michael\_perkins](https://community.glideapps.com/u/michael_perkins)
#### Post date: [September 4, 2023, 3:27am UTC](https://community.glideapps.com/t/monkeypdf-integration/65748/5 "2023-09-04T03:27:03Z")

</div>

> [@michael\_perkins](#):
>
> ```auto
> {% for item in parsedLineItems %}
> <tr>
> <td>{{ item.line_items_code }}</td>
> <td>{{ item.line_items_description }}</td>
> <td>{{ item.line_items_calltypetotal }}</td>
> <td>{{ item.line_items_subordertotal }}</td>
> <td>{{ item.line_items_total }}</td>
> </tr>
> {% endfor %}
> 
> ```

Apologize I been making changes to make it work and at some point I try to parse the thing to take out the n/ that were showing up. However, the output does not have those anylonger since I utilized the JSON function column type to format it and that seem to give me the current output.

```auto
    {% for item in lineItems %}
      <tr>
        <td>{{ item.line_items_code }}</td>
        <td>{{ item.line_items_description }}</td>
        <td>{{ item.line_items_calltypetotal }}</td>
        <td>{{ item.line_items_subordertotal }}</td>
        <td>{{ item.line_items_total }}</td>
      </tr>
		{% endfor %}

```

Here is that current portion of the code.

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [September 4, 2023, 3:40am UTC](https://community.glideapps.com/t/monkeypdf-integration/65748/6 "2023-09-04T03:40:15Z")

</div>

So is your file being generated correctly now?

---

<div class="post-metadata">

### Author: ![michael\_perkins](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/michael_perkins/32/60903_2.png) [@michael\_perkins](https://community.glideapps.com/u/michael_perkins)
#### Post date: [November 5, 2023, 6:29pm UTC](https://community.glideapps.com/t/monkeypdf-integration/65748/7 "2023-11-05T18:29:53Z")

</div>

All good! Thank you for all the help.
