如何使用以下命令转换多个文档文件转换服务。
我有 50-100 个 MS Word 和 PDF 文档,我想使用convert_documentAPI方法?
例如,您可以提供多个 .pdf 或 *.doc 文件吗?:
curl -u "username":"password" -X POST
-F "config={\"conversion_target\":\"ANSWER_UNITS\"};type=application/json"
-F "file=@\*.doc;type=application/msword"
"https://gateway.watsonplatform.net/document-conversion-experimental/api/v1/convert_document"
不幸的是,这给出了一个错误:curl:(26)无法打开文件“*.doc”。
我也尝试过“菲尔[电子邮件受保护],file2.doc,file3.doc”,但这也会产生错误。
该服务一次仅接受一个文件,但您可以多次调用它。
#!/bin/bash
USERNAME="<service-username>"
PASSWORD="<service-password>"
URL="https://gateway.watsonplatform.net/document-conversion-experimental/api/v1/convert_document"
DIRECTORY="/path/to/documents"
for doc in *.doc
do
echo "Converting - $doc"
curl -u "$USERNAME:$PASSWORD" \
-F 'config={"conversion_target":"ANSWER_UNITS"};type=application/json' \
-F "file=@$doc;type=application/pdf" "$URL"
done
文件转换文档 and API参考.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)