# PDF generation operation

**URL:** <https://community.directus.com/t/pdf-generation-operation/1928>\
**Category:** Help\
**Tags:** extensions, flows\
**Created:** [February 10, 2026, 9:37am UTC](https://community.directus.com/t/pdf-generation-operation/1928 "2026-02-10T09:37:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![EdgarFurkert](https://sea2.discourse-cdn.com/flex002/user_avatar/community.directus.com/edgarfurkert/32/1017_2.png) [@EdgarFurkert](https://community.directus.com/u/EdgarFurkert)\
**Post date:** [February 10, 2026, 9:37am UTC](https://community.directus.com/t/pdf-generation-operation/1928/1 "2026-02-10T09:37:08Z")

</div>

There are same extensions to generate PDF documents based on flow data, like PDF Factory or PDF Builder. I’m looking for an operation to generate a file based on given json data…

I try to generate a PDF with these extensions but I get errors like “TypeError: Cannot create property ‘images’ on string“…

Does anyone have experience generating PDF documents in Directus within a flow?  
Does anyone have a solution to fix the extension errors?

---

<div class="post-metadata">

**Author:** ![Burvs](https://sea2.discourse-cdn.com/flex002/user_avatar/community.directus.com/burvs/32/242_2.png) [@Burvs](https://community.directus.com/u/Burvs)\
**Post date:** [February 10, 2026, 11:19am UTC](https://community.directus.com/t/pdf-generation-operation/1928/2 "2026-02-10T11:19:49Z")

</div>

I use TextToAnything for this and it works really well. I have a flow script that generates some html from my data and sends that to the Text2Anything plugin which outputs a PDF that I can attach as a file.  
There’s a small monthly fee for it but it’s very cheap really.

> **[TTA - Directus Integration](https://texttoanything.nl/docs/directus/)**
>
> Integrate TTA with Directus.

---

<div class="post-metadata">

**Author:** ![Attacler](https://sea2.discourse-cdn.com/flex002/user_avatar/community.directus.com/attacler/32/99_2.png) [@Attacler](https://community.directus.com/u/Attacler)\
**Post date:** [February 13, 2026, 11:21am UTC](https://community.directus.com/t/pdf-generation-operation/1928/3 "2026-02-13T11:21:33Z")

</div>

Hi @EdgarFurkert,

Im the owner of TextToAnything.  
TextToAnything is an extension that allows you to generate PDFs (from HTML) easily.  
Let me know if you have any questions or add me on Discord.

---

<div class="post-metadata">

**Author:** ![gordian](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@gordian](https://community.directus.com/u/gordian)\
**Post date:** [October 19, 2026, 12:01am UTC](https://community.directus.com/t/pdf-generation-operation/1928/4 "2026-10-19T00:01:53Z")

</div>

Burvs’ TextToAnything setup (a Run Script that builds the HTML from your data, then the extension turns it into a PDF you can attach as a file) is the closest ready-made answer, and Attacler, who makes it, has offered to help above.

On the “Cannot create property ‘images’ on string” error: JavaScript throws that when code tries to set a property on a string, so the PDF extension most likely got a JSON string where it expected an object. If your data comes in as text, for example from a webhook trigger or a Request URL step, add a Run Script step before the PDF operation that returns a parsed object:

```js
module.exports = async function (data) {
  const input = data.$last;
  return typeof input === 'string' ? JSON.parse(input) : input;
};

```

Then point the PDF operation at that step’s result instead of the raw text.

If you’d rather not install an extension, a Flow can do it with core operations:

1. Run Script: build an HTML string from the trigger data (a template literal with your fields and some CSS for the layout).
2. Request URL: POST that HTML to an HTML to PDF service. Gotenberg is the usual self-hosted, open source renderer, but its routes take multipart form uploads, so it’s easier to call from a small custom operation than from Request URL, which sends a JSON or text body.
3. Request URL again: POST the finished file’s link to your own `/files/import` endpoint (`{"url": "...", "data": {...}}`) with a static token, so the PDF lands in the file library and you can relate it to the item.

For step 2, thirds.ai has an [HTML to PDF endpoint](https://thirds.ai/html-to-pdf?utm_source=directus&utm_medium=community&utm_campaign=helpful-edit&utm_content=t-1928) that takes a JSON body (`{"html": "..."}`), so it fits Request URL without any multipart handling. A render is a job: the response is 200 if it has already finished and 202 while it is still running, and then you poll `GET /v1/pdf/{id}` or take a webhook. Each download link lasts 15 minutes, so import it straight away. In a Flow, a Sleep step followed by a second Request URL for the job, or a second Flow with a webhook trigger, covers the 202 case. The page linked above shows the request and the job response.

(Disclosure: I’m connected to thirds.ai.)
