Node "Edit Image" - Access second page of PDF


This thread shows how to convert a pdf to png by using the “Edit Image”-node (imagemagick). Node PDF to Picture / Manipulate PDF
This works fine - for the first page. But how do I convert the second or third page?

Thanks in advance :slight_smile:

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

Hey @schnipo,

I don’t think the node supports multiple pages so you may need to use an external service or try to use the execute command node along with Imagemagick to manually try the conversion.

Hello @Jon I really try it by myself but after a lot of tryings and unsuccessful result, I’m asking if could you give me a light to solve this. Here is the nodes and code that I’m trying to use.

Thanks in advance.

if I try to use the previous suggestion using Edit node, I got error, here is my nodes.

Here is the result of error

  "errorMessage": "Stream yields empty buffer",
  "errorDetails": {},
  "n8nDetails": {
    "n8nVersion": "1.33.1 (Self Hosted)",
    "binaryDataMode": "default",
    "stackTrace": [
      "Error: Stream yields empty buffer",
      "    at Socket.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/gm/lib/command.js:56:21)",
      "    at Socket.emit (node:events:529:35)",
      "    at Socket.emit (node:domain:489:12)",
      "    at endReadableNT (node:internal/streams/readable:1400:12)",
      "    at processTicksAndRejections (node:internal/process/task_queues:82:21)"

Hey @rodrigoscdc,

I have done some digging on this one, It looks like when it comes to working with PDFs GraphicsMagick requires Ghostscript to be installed which we do not include. This sadly means using the node on it’s own or trying an execute command option won’t work without a custom image, As a quick test I have accessed my Docker image as root and ran apk add ghostscript and the node then works as expected.

To then take a multi page route you could try something like the below

If you wanted to make a custom image that includes Ghostscript you could use the below as your dockerfile.

FROM n8nio/n8n:latest

USER root
RUN apk add ghostscript
USER node
1 Like