Encountering Error while Analyzing Textract with Multiple Pages

32 Views Asked by At

My code breaks every time I attempt to analyze a PDF with more than one page. It displays the following error:

UnsupportedDocumentException: Request has unsupported document format   
    at de_UnsupportedDocumentExceptionRes

I've experimented twice with the same document, and it only works when it has one page.

My code:

            const input = {
                Document: {
                    S3Object: {
                        Bucket: "------",
                        Name: "-------",
                    },
                },
           FeatureTypes: ["QUERIES"],
                QueriesConfig: {
                    Queries: [
                        {
                            Text: "question?",
                            Alias: "question",
                        },
                  },

                AdaptersConfig: {
                    Adapters: [
                        {
                            AdapterId: "id",
                            Version: "8",
                        },
                    ],
                },
            };

          const command = new AnalyzeDocumentCommand(input);
            const response = await client.send(command);

The document that displays the errors is a PDF. I attempted to analyze it twice using the same document: once with only one page and another time with two pages. It only works when it has one page.

0

There are 0 best solutions below