Convert URLs and HTML Code to PDF
Our API is a free solution for converting web pages and HTML documents to PDF.
POSTGET *https://api.dotmaui.com/client/1.1/htmltopdf/
Parameters
Field | Type | Description | Required |
---|---|---|---|
apikey | String |
.Maui Api key |
True |
url | String |
A valid URL address |
1 |
html | String |
An HTML string
|
1 |
pagesize | String |
Set paper size. Default is A4.
|
False |
grayscale | Boolean |
PDF will be generated in grayscale. Default is false.
|
False |
orientation | String |
Set orientation to Landscape or Portrait. Default is Portrait.
|
False |
lowquality | Boolean |
Generates lower quality PDF. Default is false.
|
False |
1 There must be one of these values
Success 200 - Default Mode
Output will be to a pdf file
Testing calls
You can try this service through our API-based tool available here: https://dotmaui.com/api-powered/html-to-pdf.jsp
Examples
<?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.1/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);
Using client As New Net.WebClient Dim reqparm As New Specialized.NameValueCollection reqparm.Add("apikey", "YOUR_API_KEY") reqparm.Add("url", "https://example.com") Dim responsebytes = client.UploadValues("https://api.dotmaui.com/client/1.1/htmltopdf/", "POST", reqparm) System.IO.File.WriteAllBytes("C:\MyPdfFiles\Exmple.pdf", responsebytes) End Using