1

我正在尝试使用 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);
4

1 回答 1

2

options embed_javascript,embed_css等是布尔值:

$process->start([
  "input"=>"download",
  "file"=>$pdf_url,
  "outputformat" => "html",
  "converteroptions" => [
        "embed_css" => false,
        "embed_font" => false,
        "embed_javascript" => false,
        "embed_image" => false,
    ],
])->wait();
于 2016-09-18T12:12:23.737 回答