Adobe Extract PDF - Multiple Files / Multiple calls - Node.JS

Community Beginner ,
Jul 08, 2021 Jul 08, 2021

Copy link to clipboard

Copied

In the workflow I'm attempting to structure, I am splitting a large PDF into separate 100 page files, OCRing those files, then attempting to use Extract to grab text information from them. The first PDF always runs fine, however, the files following give me the following error...

Exception encountered while executing operation Error: Operation instance must only be invoked once
    at ExtractPdfOperation.validate (C:\Users\huntera\Desktop\Test\adobe-dc-pdf-services-sdk-node-samples\node_modules\@adobe\pdfservices-node-sdk\src\operation\extract-pdf-operation.js:172:10)

 I am utilizing Node.JS to compile/run the scripts.

TOPICS
General , PDF Extract API , PDF Services API

Views

45

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 08, 2021 Jul 08, 2021

Copy link to clipboard

Copied

LATEST

Turns out my solution throughout this entire process has served me well once again!

A big help throughout my process has been only a single line...

require('child_process').fork(__dirname + '/dir/to/file/with/next/script.js');

 

To solve my issue above, I used some sequential processing. After each extract was created, I used fs.readdir() to count how many files were in the output folder, and used the number already processed to iterate through the files I needed to extract. Each time a file extract finished, I called a child process fork (the above line of code) on the same script that was currently running, effectively creating a for loop. Just had to double check my edge cases. 

 

This getting an official fix would be very nice, but for now the workaround is functional. Also, I'm unsure if this is just a Node.JS thing or not, so if someone could confirm that, that'd be great.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources