繁体   English   中英

逻辑应用程序 + 表单识别器无法将 PDF 发送到服务

[英]Logic Apps + Form Recognizer unable to send PDF to service

我有一个 Azure 逻辑应用程序,它对Analyze Document for Prebuilt or Custom models (v3.0 API) 自定义 Model 很好,我可以毫无问题地用 Postman 打它。

当我尝试从 Sharepoint 获取 PDF 并将其发送到服务时,我收到一条错误消息:

{
  "error": {
    "code": "InvalidRequest",
    "message": "Invalid request.",
    "innererror": {
      "code": "InvalidContent",
      "message": "The file is corrupted or format is unsupported. Refer to documentation for the list of supported formats."
    }
  }
}

我试过了:

  • Get file content直接传递给Document/Image File Content输入
  • 传递body('Get_file_content)['$content']
  • 传递concat('data:application/pdf;base64,',body('Get_file_content')['$content']
    • 这个在 Base64-to-PDF 工具中转换为 PDF 所以我知道 Base64 是好的
  • 然后我发现该服务需要二进制格式:
    • 传递base64ToBinary(body('Get_file_content')['$content'])
    • 还是没有 go

为什么我不能将文件发送到表单识别器服务?

在此处输入图像描述


编辑:

感谢@vijaya。 他们帮助我看到Document/Image URL参数不是必需的。 将其留空并使用原始的Get File Content就可以了!

在此处输入图像描述

问题在于内容类型。 您需要将内容类型与分析文档的内容一起传递。 我已经从我这边复制了问题,下面是我遵循的步骤,

  1. 最初创建的逻辑应用程序如下所示,在此处输入图像描述

  2. 逻辑应用因错误The file is corrupted or format is unsupported. Refer to documentation for the list of supported formats. The file is corrupted or format is unsupported. Refer to documentation for the list of supported formats.在此处输入图像描述

  3. 接下来修改logic app如下图,在此处输入图像描述

  4. 在 Compose 操作中,将内容设置为outputs('Get_blob_content_(V2)')?['body']?['$content']并将内容类型作为 application/pdf 传递,因为我们正在处理 pdf 个文件。在此处输入图像描述

  5. 在 Analyze Document for Prebuilt or Custom models (v3.0 API) 操作中,使用在文档/图像文件内容中撰写的输出。

在此处输入图像描述

  1. 逻辑应用成功运行,如下所示,

在此处输入图像描述 Analyze Document的Output如下图,在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM