I need to output a table of text and images (somehow)

Describe the problem/error/question

I’m using one arm of the workflow to generate a set of unique urls, and I then generate QR codes for these.
I use a merge node to merge the two together, and I can see the info about each one in the JSON, and also the binary files after the merge. So far so good.

I then need to group these URLs by category (which I can do with a code node).

I then need to generate a pdf for each category, with a table inside listing the urls and the QR code for each.

I’ve tried various things:

  • generating HTML, but I can’t seem to get the QR codes in the HTML. The plan was to generate the pdf from the HTML.
  • saving the QR codes to Google Drive and accessing the images from there. I can save them, (but this is very slow, in the end I need to process 1000 categories, ~10,000 urls in total.
  • pushing the content to Google Docs and generating pdfs from there, but again, I can’t seem to push the images in there, either directly or via Google Drive.

What is the error message (if any)?

There are usually no error messages.

For example, when I tried moving the images from Google Drive to Google Docs, the image doesn’t render, insead the text is just:

{url} | IMAGE{url of image of QR code of url}

I had a similar issue with the HTML generation,

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: cloud
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @Alex_Argyros

Yes, currently Google Docs nodes don’t support inserting images, but fortunately I developed a solution,

You can check it out here

Utilize the n8n node-dev package to render PDFs in-line. Implement a custom node that employs a PDF library such as pdfkit to create each category’s PDF programmatically, inserting the QR code images directly from their binary data into the document tables within it. This eliminates external services and keeps all data internal.

if you think this helped please mark it
thanks

Thakns for your reply @mohamed3nan . I don’t think I can use this options because each file I need to generate is unique and doesn’t have a template per se, and I need to process about 10,000 images, and 1000 files. I’m not sure if this will be slow.

Thanks for your reply @Hasnain_Javed , I’m running the cloud version of n8n, and my understanding is that it’s not an option on the cloud version.

I kept working through this. In the end what worked was:

  • Creating a set of Google Sheets spreadsheets using a Google Sheets node
  • Creating sheets within each spreadsheet using a HTTP node. The Google Sheets node didn’t handle multiple spreadsheets and created all the sheets in the first spreadsheet.

Multiple spreadsheets/sheets is not necessary, it’s just how I need to organise the data. Then:

  • I used a HTTP node to write the data to the sheets. The Google Sheets nodes didn’t work, they ended up writing all the data to the first spreadsheet and first sheet only. I had to watch out for rate limit exceptions here.
  • Instead of generating the QR codes in n8n itself, I passed the API request url to the Google Sheets inside an =IMAGE() function. I used api.qrserver.com. This created and rendered the image directly in the Google Sheet.

This bypassed the problems I was having of:

  • Not being able to handle/render the binary image files of the QR codes inside n8n
  • Sending the files to Google Drive as an intermediate step being too slow

The one unexpected thing was that the HTTP node sending data to the Google Sheet API couldn’t handle variables in the JSON, I had to separately create the required JSONs in another function node.

I realise that I’ve dropped the original requirement of creating pdfs - turns out the Google Sheets will do for now. I also realise that I’m new to n8n and some of the complications may be due to my ignorance.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.