[英]Not Getting Line Items from "prebuilt-invoice"
If I submit an invoice in the Form Recognizer Studio, it finds and presents the line items from the invoice.如果我在 Form Recognizer Studio 中提交发票,它会查找并显示发票中的行项目。
If I then take that same invoice and submit it using the code from the Form Recognizer Studio, I do not get the line items in the JSON. I do get all the other data.如果我然后使用同一张发票并使用 Form Recognizer Studio 中的代码提交它,我不会获得 JSON 中的行项目。我确实获得了所有其他数据。
Any idea why?知道为什么吗?
<TargetFramework>net6.0</TargetFramework>
<PackageReference Include="Azure.AI.FormRecognizer" Version="4.0.0" />
public async Task<IActionResult> ProcessInvoice(IFormFile pdfInvoice) {
try {
string endpoint = "https://xxx.cognitiveservices.azure.com/";
string key = "xxx";
AzureKeyCredential credential = new AzureKeyCredential(key);
DocumentAnalysisClient client = new DocumentAnalysisClient(new Uri(endpoint), credential);
using var stream = pdfInvoice.OpenReadStream();
AnalyzeDocumentOperation operation = await client.AnalyzeDocumentAsync(WaitUntil.Completed, "prebuilt-invoice", stream);
AnalyzeResult result = operation.Value;
return Ok(JsonConvert.SerializeObject(result));
} catch (Exception ex) {
return BadRequest(ex.Message);
}
}
@VasaviLankipalle you are correct. @VasaviLankipalle 你是对的。 What I was looking for was that the
AnalyzeResult
JSON would just include the line items without the extra step of iterating through them.我一直在寻找的是
AnalyzeResult
JSON 将只包含行项目,而无需迭代它们的额外步骤。
I did end up iterating through the line items and building my own JSON to send back from the controller.我确实最终遍历了订单项并构建了我自己的 JSON 以从 controller 发回。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.