diff --git a/packages/nodes-base/nodes/ReadPdf.node.ts b/packages/nodes-base/nodes/ReadPdf.node.ts index 785683b8ae..0213969adb 100644 --- a/packages/nodes-base/nodes/ReadPdf.node.ts +++ b/packages/nodes-base/nodes/ReadPdf.node.ts @@ -1,6 +1,6 @@ import { BINARY_ENCODING, - IExecuteSingleFunctions, + IExecuteFunctions, } from 'n8n-core'; import { @@ -37,22 +37,30 @@ export class ReadPdf implements INodeType { ], }; + async execute(this: IExecuteFunctions): Promise { + const items = this.getInputData(); - async executeSingle(this: IExecuteSingleFunctions): Promise { + const returnData: INodeExecutionData[] = []; + const length = items.length as unknown as number; + let item: INodeExecutionData; - const binaryPropertyName = this.getNodeParameter('binaryPropertyName') as string; + for (let itemIndex = 0; itemIndex < length; itemIndex++) { + + item = items[itemIndex]; + const binaryPropertyName = this.getNodeParameter('binaryPropertyName', itemIndex) as string; - const item = this.getInputData(); + if (item.binary === undefined) { + item.binary = {}; + } - if (item.binary === undefined) { - item.binary = {}; + const binaryData = Buffer.from(item.binary[binaryPropertyName].data, BINARY_ENCODING); + returnData.push({ + binary: item.binary, + json: await pdf(binaryData), + }); + } - - const binaryData = Buffer.from(item.binary[binaryPropertyName].data, BINARY_ENCODING); - - return { - binary: item.binary, - json: await pdf(binaryData), - }; + return this.prepareOutputData(returnData); } + }