Convert URLs and HTML Code to PDF with PHP

Our API is a free solution for converting web pages and HTML documents to PDF with PHP.
Here is a simple example:

<?php

$data = array("apikey"   => "YOUR_API_KEY", 
              "html"     => "<p>My first pdf with <b>.Maui APIs</b>.</p>");

$curl = curl_init("https://api.dotmaui.com/client/1.0/htmltopdf/");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 

$output = curl_exec($curl);  

curl_close($curl);

$downloadPath = "download/mypdf.pdf";
$file = fopen($downloadPath, "w+");
fputs($file, $output);
fclose($file);

 

Leave a Comment

Your email address will not be published. Required fields are marked *