我提出了同样的要求,将DOCX,excel.ppt转换为PDF,他们的工作。但是合并PDF不起作用。我选择PDF的文件选择器,然后我发送请求到convertApi。但是ConvertApi返回我的原始pdf,而不是合并的pdf。
var url = Uri.parse(
'https://v2.convertapi.com/convert/pdf/to/merge?Secret=XXXX');
int len = widget.docs.length;
var request = MultipartRequest("POST", url);
for (int i = 0; i < len; i++) {
final element = widget.docs[i];
request.files.add(
await MultipartFile.fromPath(
"Files",
element.path,
filename: element.name,
),
);
}
var response = await Response.fromStream(await request.send());
var decoded =
base64.decode(await jsonDecode(response.body)["Files"][0]["FileData"]);发布于 2021-05-05 18:25:01
这是一个CURL示例,Files参数必须有如下索引:files[0],files[1]。请编辑您的Files参数名称,并为每个传递的新文件添加括号和索引。
curl -F "Files[0]=@/path/to/file1.pdf" -F "Files[1]=@/path/to/file2.pdf" https://v2.convertapi.com/convert/pdf/to/merge?Secret=<YOUR SECRET HERE>https://stackoverflow.com/questions/67398276
复制相似问题