Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将CloudConvert API与PHP SDK结合使用,将转换下载为多个文件?_Php_Api_Pdf_Converter_Cloudconvert - Fatal编程技术网

如何将CloudConvert API与PHP SDK结合使用,将转换下载为多个文件?

如何将CloudConvert API与PHP SDK结合使用,将转换下载为多个文件?,php,api,pdf,converter,cloudconvert,Php,Api,Pdf,Converter,Cloudconvert,我正在尝试使用CloudConvert API和PHP将PDF转换为HTML,但到目前为止,我只能接收HTML文件中嵌入了所有资产(img、css、js、字体)的HTML文件。我希望能够将资产作为单独的文件下载,无论是作为zip文件还是个人文件,他们的web界面允许这样做,但我正在努力使用API/SDK使其正常工作。 谢谢你的帮助! 我的代码如下所示: $process = $api->createProcess([ "inputformat" => "pdf", "outp

我正在尝试使用CloudConvert API和PHP将PDF转换为HTML,但到目前为止,我只能接收HTML文件中嵌入了所有资产(img、css、js、字体)的HTML文件。我希望能够将资产作为单独的文件下载,无论是作为zip文件还是个人文件,他们的web界面允许这样做,但我正在努力使用API/SDK使其正常工作。
谢谢你的帮助! 我的代码如下所示:

$process = $api->createProcess([
  "inputformat" => "pdf",
  "outputformat" => "html",
]);

$process->start([
  "input"=>"download",
  "file"=>$pdf_url,
  "outputformat" => "html",
  "converteroptions" => [
        "zoom" => 1,
        "page_width" => 900,
        "page_height" => 1100,
        "embed_css" => [],
        "embed_font" => [],
        "embed_javascript" => [],
        "embed_image" => [],
    ],
])->wait();

$process->downloadAll($download_dir);

选项
embed\u javascript
embed\u css
等是布尔值:

$process->start([
  "input"=>"download",
  "file"=>$pdf_url,
  "outputformat" => "html",
  "converteroptions" => [
        "embed_css" => false,
        "embed_font" => false,
        "embed_javascript" => false,
        "embed_image" => false,
    ],
])->wait();

谢谢,测试成功了!我唯一的建议是,API控制台可能需要更正,因为当我使用它生成API调用并取消选择资产的嵌入选项时,它最终生成php代码,正如我在OP中输入的那样,使用[]而不是false。