Spanish Total.js
English
Documentation For AI agents
Contents

Documents and images

Print, convert and read files: PDF, OCR, invoices, license plates and captcha images.

.md Website
On this page

Every service is a POST request with your token. See Call Total API from Total.js and Call Total API over HTTP.

API

rest

POST https://api.totaljs.com/print/

Prints HTML or a web page to PDF, JPG or PNG.
ParameterTypeDescription
type String pdf, jpg or png.
html? String The HTML to print. Send html or url.
url? String The address of a web page to print.
page? String A3, A4, A5 or Letter. Default: A4
width? Number PDF: the width of the page. Image: the width of the browser, in pixels.
height? Number PDF: the height of the page. Image: the height of the browser, in pixels.
dpi? Number PDF only. Default: 96
margin? String PDF only: top right bottom left in millimeters. Default: 0 0 0 0
viewport? String xs (phone), sm (tablet), md (medium screen) or lg (large screen).
quality? Number The quality of an image.
orientation? String portrait or landscape. Default: portrait
grayscale? Boolean PDF only: a grayscale document.
lowquality? Boolean PDF only: a smaller document of lower quality.
zoom? Number The zoom in percent. Default: 100

Returns Binary The file itself (binary data).

The HTML or the web page can have up to 512 kB.

Total.js
var file = await API('TAPI', 'print', { type: 'pdf', html: '<h1>Invoice 2026-001</h1>' }).promise();
REST
curl -X POST https://api.totaljs.com/print/ \
	-H "Content-Type: application/json" \
	-H "X-Token: YOUR_TOKEN" \
	-d '{ "type": "pdf", "html": "<h1>Invoice 2026-001</h1>" }' \
	-o invoice.pdf
rest

POST https://api.totaljs.com/convert/

Converts a file to PDF, JPG or PNG.
ParameterTypeDescription
to String pdf, jpg or png.
data String The file as a data URI, for example data:application/pdf;base64,JVBERi0x...

Returns Binary The converted file (binary data).

Total.js
var image = await API('TAPI', 'convert', { to: 'jpg', data: 'data:application/pdf;base64,JVBERi0x...' }).promise();
REST
curl -X POST https://api.totaljs.com/convert/ \
	-H "Content-Type: application/json" \
	-H "X-Token: YOUR_TOKEN" \
	-d '{ "to": "jpg", "data": "data:application/pdf;base64,JVBERi0x..." }' \
	-o page.jpg
rest

POST https://api.totaljs.com/ocr/

Reads the text of a JPG, PNG or PDF file.
ParameterTypeDescription
data String The file as a data URI: JPG, PNG or PDF.
language? String The language of the text in an image, for example eng or slk+eng for two languages. PDF files ignore it. Default: eng

Returns Object An object with the text in text.

Images are read with the Tesseract 5 engine, and the text keeps the layout of the image. The text of a PDF file is read from the file itself. The file can have up to 5 MB.

The codes of the languages are in the list of Tesseract languages.

Total.js
var response = await API('TAPI', 'ocr', { data: 'data:image/png;base64,iVBORw0KGgo...', language: 'eng' }).promise();
console.log(response.text);
REST
curl -X POST https://api.totaljs.com/ocr/ \
	-H "Content-Type: application/json" \
	-H "X-Token: YOUR_TOKEN" \
	-d '{ "data": "data:image/png;base64,iVBORw0KGgo...", "language": "eng" }'
Response
{ "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit..." }
rest

POST https://api.totaljs.com/invoiceparser/

Reads the data of an invoice from a PDF, JPG or PNG file.
ParameterTypeDescription
data String The invoice as a data URI: PDF, JPG or PNG.

Returns Object The supplier, the customer and the numbers of the invoice.

Total.js
var invoice = await API('TAPI', 'invoiceparser', { data: 'data:application/pdf;base64,JVBERi0x...' }).promise();
REST
curl -X POST https://api.totaljs.com/invoiceparser/ \
	-H "Content-Type: application/json" \
	-H "X-Token: YOUR_TOKEN" \
	-d '{ "data": "data:application/pdf;base64,JVBERi0x..." }'
Response
{
	"supplier": {
		"name": "Example Supplies Ltd.",
		"address": "Main Street 1, 10000 Example City",
		"vatid": "CZ00000000"
	},
	"customer": {
		"name": "Demo Company Ltd.",
		"address": "Demo Street 2, 20000 Demo City",
		"vatid": "SK0000000000"
	},
	"date": "2026-07-17",
	"number": "2026-0042",
	"amount": 120.5,
	"total": 145.81,
	"currency": "EUR",
	"language": null,
	"tax": 25.31
}
rest

POST https://api.totaljs.com/platenumber/

Reads a license plate from a JPG or PNG picture.
ParameterTypeDescription
data String The picture as a data URI: JPG or PNG.
code? String The kind of plates: eu or us. Default: eu

Returns Array An array of the plates found, each with its confidence in percent.

Total.js
var plates = await API('TAPI', 'platenumber', { data: 'data:image/jpeg;base64,/9j/4AAQSkZJRg...' }).promise();
REST
curl -X POST https://api.totaljs.com/platenumber/ \
	-H "Content-Type: application/json" \
	-H "X-Token: YOUR_TOKEN" \
	-d '{ "data": "data:image/jpeg;base64,/9j/4AAQSkZJRg..." }'
Response
[
	{ "value": "BB197FJ", "confidence": 87.434 }
]
rest

POST https://api.totaljs.com/captcha/

Draws a captcha image with the text that you send.
ParameterTypeDescription
value String The text of the image.
width? Number The width in pixels. Default: 200
height? Number The height in pixels. Default: 80
dark? Boolean A dark image. Default: false

Returns String A JPEG image as a data URI.

Keep the text of the captcha on your server and compare it with what the user types.

Total.js
var image = await API('TAPI', 'captcha', { value: '123456' }).promise();
REST
curl -X POST https://api.totaljs.com/captcha/ \
	-H "Content-Type: application/json" \
	-H "X-Token: YOUR_TOKEN" \
	-d '{ "value": "123456" }'
Response
data:image/jpeg;base64,/9j/4AAQSkZ...
Made in Europe