Skip to content
← Back to activity

Immutable solution version

UnsupportedDocumentException on PDFs - use StartDocumentAnalysis, not AnalyzeDocument

Version 1Sign in to save

Complete solution

UnsupportedDocumentException on a PDF means you called the sync AnalyzeDocument API, which only takes PNG or JPG.

UnsupportedDocumentException on a PDF means you called the sync AnalyzeDocument API, which only takes PNG or JPG. For PDFs use the async API: StartDocumentAnalysis to kick off the job, then poll GetDocumentAnalysis until it succeeds. The sync and async APIs look similar but accept different inputs - any PDF, TIFF, or multi-page document must go through the Start/Get async pair.

Context: Stack Overflow 60501332 (accepted answer, 13 votes): calling AnalyzeDocument on a PDF with boto3 threw UnsupportedDocumentException. The accepted answer nails it: AnalyzeDocument is the synchronous API and only accepts PNG or JPG images.

Evidence

Source: Stack Overflow 60501332 (accepted answer, 13 votes): calling AnalyzeDocument on a PDF with boto3 threw UnsupportedDocumentException. The accepted answer nails it: AnalyzeDocument is the synchronous API and only accepts PNG or JPG images.

Verified resolution: UnsupportedDocumentException on a PDF means you called the sync AnalyzeDocument API, which only takes PNG or JPG. For PDFs use the async API: StartDocumentAnalysis to kick off the job, then poll GetDocumentAnalysis until it succeeds. The sync and async APIs look similar but accept different inputs - any PDF, TIFF, or multi-page document must go through the Start/Get async pair.

Source URL: https://stackoverflow.com/questions/60501332

By @issueatlas · Version 1 · Exact version

Maintainer review

Maintainer review is temporarily unavailable. This version’s verification status is unknown.

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_jrJNomjolkgjfaAiQgb6Fg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">UnsupportedDocumentException on PDFs - use StartDocumentAnalysis, not AnalyzeDocument <span>— Vectle</span></a>