api - Google Vision Api 支持 PDF 和 TIFF 文本检测,但它也可以与包含图像的 PDf 一起使用吗?
问题描述
我正在尝试使用包含图像的 pdf 以及 google vision API,但它会引发以下错误:
下午 4:35:12.207 info dialogflowFirebaseFulfillment Dialogflow 请求标头:{"host":"us-central1-detecttext-5a0c3.cloudfunctions.net","user-agent":"Apache-HttpClient/4.5.4 (Java/1.8. 0_181)","传输编码":"chunked","accept":"text/plain, /x-macromania, x-macsymbol, x-macthai, x-macturkish, x-macukraine, x-ms932_0213, x-ms950-hkscs, x-ms950-hkscs-xp, x-mswin-936, x-pck, x- sjis_0213, x-utf-16le-bom, x-utf-32be-bom, x-utf-32le-bom, x-windows-50220, x-windows-50221, x-windows-874, x-windows-949, x-windows-950, x-windows-iso2022jp","内容类型":"应用程序/json; charset=UTF-8","function-execution-id":"dvrpphf9f855","x-appengine-api-ticket":"4b7e84f29e9ce22b","x-appengine-city":"?","x-appengine- citylatlong":"0.000000,0.000000","x-appengine-country":"US","x-appengine-https":"on","x-appengine-region":"?","x-appengine-用户 IP":"35.193.50.245","x-cloud-trace-context":"
dialogflowFirebaseFulfillment ERROR: { Error: Error in extracting images from PDF file gs://detecttext-5a0c3.appspot.com/NFM-11099M1.pdf at GoogleError.Error (native) at new GoogleError (/user_code/node_modules/@google-cloud /vision/node_modules/google-gax/build/src/GoogleError.js:46:42) 在 Operation._unpackResponse (/user_code/node_modules/@google-cloud/vision/node_modules/google-gax/build/src/longrunning. js:228:29) 在 /user_code/node_modules/@google-cloud/vision/node_modules/google-gax/build/src/longrunning.js:214:18 代码:13}
解决方案
我有同样的问题 - 在我的情况下,gzip: true
上传设置导致问题:
this.client
.bucket(bucketName)
.upload(fullPath, {
gzip: false, // setting gzip: true causes the pdf annotator to fail
metadata: {
cacheControl: 'no-cache',
},
})
.then(...)
推荐阅读
- javascript - 识别多边形内的点(包括位于边界和边缘上的点)
- c++ - Harvest(Heat) Wix - 在 msi 中存档资源
- linux - docker bind mount:不是目录
- php - PHP - 通过某个属性合并两个数组中对象的属性
- sql - SQL查询导致错误“关键字'order'附近的语法不正确”
- c# - Control-M - .exe 在计划任务中工作正常
- mysql - 如何使用 MySQL 在本地设置 Hybris 6.7
- c# - Saving and loading different windows forms at run time in Visual Studio C#
- azure - 从 azure 数据工厂访问 Azure Blob 存储帐户
- file-upload - 根据上传数据集的变量创建多个数字输入