Introduction
Welcome to the UrltoDoc documentation! This page and its sections contain all of the information you need to get started consuming the API, converting your website links and raw HTML to formatted PDFs.
Use the links in the sidebar to skip through the different sections of this documentation, or continue scrolling down.
In order to start using the API, you'll have to register for an account on the website. You can click the 'Sign Up' button at the very top-right of this page, or go to the link here.
Once your account has been created, you'll be taken to the dashboard. From there, you can view your API access key by clicking the 'Show Key' button in the dashboard menu. This will reveal the key that you'll need to make calls to the API, as we'll explain further down.
Additionally, when your account was created, you were gifted 20 free conversion credits. These are used to make calls to the API, and are spent when a website or raw HTML has been converted successfully to a PDF. Only a single credit is used per conversion regardless of any options set, and by default you'll be notified via email when your account starts to run low. Additional conversion credits can then be purchased through your dashboard in the billing section.
Usage
After you've obtained your authorization key, you can start making calls to the API right away. Authentication is possible in two ways:
Calls to the API may also be made via either POST or GET requests. The command below is probably the most basic call you can make to the API. After it completes the GET request, it will return back an Amazon S3 url containing google.com converted into a PDF.
curl -v http://urltodoc.com/api/convert?url=https://google.com&key=my-key-here&store=true
Below you'll find a few examples of UrltoDoc implemented in a few popular programming languages and frameworks.
Javascript
import axios from 'axios';
axios.post('http://urltodoc.com/api/convert', {
key: 'my-key-here',
store: true,
url: 'https://google.com',
images: false,
margins: '1,3'
})
.then((response) => {
alert(response.data);
})
.catch((error) => {
console.error(error);
});
PHP
use GuzzleHttp\Client;
$client = new Client();
$response = $client->request('POST', 'http://urltodoc.com/api/convert', [
'json' => [
'key' => 'my-key-here',
'store' => true,
'url' => 'https://google.com',
'images' => false,
'margins' => '1,3'
]
]);
$pdfUrl = $response->getBody();
return $pdfUrl;
Python
import requests
data = {
'key': 'my-key-here',
'store': true,
'url': 'https://google.com',
'images': false,
'margins': '1,3'
}
r = requests.post(url = 'http://urltodoc.com', data = data)
pdf_url = r.text
If you have any questions about this documentation, need help using the UrltoDoc API, or have comments on the platform in general, please don't hesitate to reach out to us.
We're available by email at hi@htmltopdf.test.