I have a four page PDF file and page 3 contains a table I want to extract:
with open(f"{data_dir}/{file_name}", "rb") as fd:
document = fd.read()
poller = document_analysis_client.begin_analyze_document("prebuilt-layout", document)
result = poller.result()
print(result)
Running this, it does not find any tables in the document.
However when I run exactly the same only adding page="3"
or page="2-"
as an argument to begin_analyze_document
, it works perfectly!
document = fd.read()
poller = document_analysis_client.begin_analyze_document("prebuilt-layout", document, pages="3")
result = poller.result()
print(result)
What is going on here?
Actually you have to specify the page range in the parameters of the method begin_analyze_document()
you're calling. https://learn.microsoft.com/en-us/python/api/azure-ai-formrecognizer/azure.ai.formrecognizer.documentanalysisclient?view=azure-python#azure-ai-formrecognizer-documentanalysisclient-begin-analyze-document
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.