Skip to main content
Participant
April 7, 2024
Question

Error "Location is not defined" while extracting data from stream object of pdf

  • April 7, 2024
  • 0 replies
  • 231 views

While trying to extract data from pdf, where pdf is being served from aws S3 bucket as a stream object as follow:

  const storageFileName = `${dirName}/${fileName}`;
  const objectParams = {...};
  const s3 = new S3({...});

  const streamObject = await s3.getObject(objectParams).createReadStream();

Later passing this streamObject to PDFServiceSdk.FileRef.createFromStream as input.

const input = PDFServicesSdk.FileRef.createFromStream(
   streamObject,
   PDFServicesSdk.ExtractPDF.SupportedSourceFormat.pdf
);
extractPDFOperation.setInput(input);
const result = await extractPDFOperation.execute(executionContext);

 Resulting into:

ReferenceError: location is not defined

PDF Size: 100 mb.

env: Node.js 18

    This topic has been closed for replies.