1

I'm trying to use the CloudConvert API with PHP to convert PDFs to HTML and it works but so far I can only receive the html file with all the assets (img, css, js, font) embedded within the html file. I'd like to be able to download the assets as separate files, either as a zip, or individual, and their web interface allows this but I'm struggling to get this to work using the API/SDK.
Appreciate any help! My code looks like this:

$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);
muenchdo
  • 2,161
  • 1
  • 17
  • 30
kk64738
  • 314
  • 4
  • 15

1 Answers1

2

The options embed_javascript, embed_css, etc are Boolean values:

$process->start([
  "input"=>"download",
  "file"=>$pdf_url,
  "outputformat" => "html",
  "converteroptions" => [
        "embed_css" => false,
        "embed_font" => false,
        "embed_javascript" => false,
        "embed_image" => false,
    ],
])->wait();
monday
  • 287
  • 2
  • 3
  • Thanks, tested and this worked! My only suggestion would be that the API Console might need correcting because when I used it to generate the API call and de-selected the embed options for the assets it ended up generating the php code as I put in the OP having [] instead of false. – kk64738 Sep 19 '16 at 22:31