---
title: Documenti e immagini
project: Total API
version: 2026
section: reference
language: it
license: 
url: https://totaljs.es/docs/it/total-api/2026/reference/documents-and-images/
updated: 2026-11-20T06:51:47.968Z
---

# Documenti e immagini

> Stampa, converti e leggi file: PDF, OCR, fatture, targhe e immagini captcha.

Ogni servizio è una richiesta `POST` con il tuo token. Leggi [Chiamare Total API da Total.js](../../guides/call-from-totaljs/) e [Chiamare Total API via HTTP](../../guides/call-over-http/).

## API

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

Type: `rest`

Stampa HTML o una pagina web in PDF, JPG o PNG.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `type` | `String` | yes |  | `pdf`, `jpg` o `png`. |
| `html` | `String` | no |  | L'HTML da stampare. Invia `html` oppure `url`. |
| `url` | `String` | no |  | L'indirizzo di una pagina web da stampare. |
| `page` | `String` | no | `A4` | `A3`, `A4`, `A5` o `Letter`. |
| `width` | `Number` | no |  | PDF: la larghezza della pagina. Immagine: la larghezza del browser, in pixel. |
| `height` | `Number` | no |  | PDF: l'altezza della pagina. Immagine: l'altezza del browser, in pixel. |
| `dpi` | `Number` | no | `96` | Solo PDF. |
| `margin` | `String` | no | `0 0 0 0` | Solo PDF: `top right bottom left` in millimetri. |
| `viewport` | `String` | no |  | `xs` (telefono), `sm` (tablet), `md` (schermo medio) o `lg` (schermo grande). |
| `quality` | `Number` | no |  | La qualità di un'immagine. |
| `orientation` | `String` | no | `portrait` | `portrait` o `landscape`. |
| `grayscale` | `Boolean` | no |  | Solo PDF: un documento in scala di grigi. |
| `lowquality` | `Boolean` | no |  | Solo PDF: un documento più leggero, di qualità inferiore. |
| `zoom` | `Number` | no | `100` | Lo zoom in percentuale. |

Returns: `Binary` Il file stesso (dati binari).

L'HTML o la pagina web possono pesare fino a 512 kB.

Example: Total.js
```js
var file = await API('TAPI', 'print', { type: 'pdf', html: '<h1>Invoice 2026-001</h1>' }).promise();
```

Example: REST
```bash
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
```

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

Type: `rest`

Converte un file in PDF, JPG o PNG.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `to` | `String` | yes |  | `pdf`, `jpg` o `png`. |
| `data` | `String` | yes |  | Il file come data URI, per esempio `data:application/pdf;base64,JVBERi0x...` |

Returns: `Binary` Il file convertito (dati binari).

Example: Total.js
```js
var image = await API('TAPI', 'convert', { to: 'jpg', data: 'data:application/pdf;base64,JVBERi0x...' }).promise();
```

Example: REST
```bash
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
```

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

Type: `rest`

Legge il testo di un file JPG, PNG o PDF.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `data` | `String` | yes |  | Il file come data URI: JPG, PNG o PDF. |
| `language` | `String` | no | `eng` | La lingua del testo di un'immagine, per esempio `eng`, oppure `slk+eng` per due lingue. I file PDF la ignorano. |

Returns: `Object` Un oggetto con il testo in `text`.

Le immagini vengono lette con il motore Tesseract 5, e il testo mantiene l'impaginazione dell'immagine. Il testo di un file PDF viene letto dal file stesso. Il file può pesare fino a 5 MB.

I codici delle lingue sono nell'[elenco delle lingue di Tesseract](https://tesseract-ocr.github.io/tessdoc/Data-Files-in-different-versions.html).

Example: Total.js
```js
var response = await API('TAPI', 'ocr', { data: 'data:image/png;base64,iVBORw0KGgo...', language: 'eng' }).promise();
console.log(response.text);
```

Example: REST
```bash
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" }'
```

Example: Risposta
```json
{ "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit..." }
```

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

Type: `rest`

Legge i dati di una fattura da un file PDF, JPG o PNG.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `data` | `String` | yes |  | La fattura come data URI: PDF, JPG o PNG. |

Returns: `Object` Il fornitore, il cliente e gli importi della fattura.

Example: Total.js
```js
var invoice = await API('TAPI', 'invoiceparser', { data: 'data:application/pdf;base64,JVBERi0x...' }).promise();
```

Example: REST
```bash
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..." }'
```

Example: Risposta
```json
{
	"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
}
```

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

Type: `rest`

Legge una targa da una foto JPG o PNG.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `data` | `String` | yes |  | La foto come data URI: JPG o PNG. |
| `code` | `String` | no | `eu` | Il tipo di targhe: `eu` o `us`. |

Returns: `Array` Un array delle targhe trovate, ognuna con la sua affidabilità in percentuale.

Example: Total.js
```js
var plates = await API('TAPI', 'platenumber', { data: 'data:image/jpeg;base64,/9j/4AAQSkZJRg...' }).promise();
```

Example: REST
```bash
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..." }'
```

Example: Risposta
```json
[
	{ "value": "BB197FJ", "confidence": 87.434 }
]
```

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

Type: `rest`

Disegna un'immagine captcha con il testo che invii.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `String` | yes |  | Il testo dell'immagine. |
| `width` | `Number` | no | `200` | La larghezza in pixel. |
| `height` | `Number` | no | `80` | L'altezza in pixel. |
| `dark` | `Boolean` | no | `false` | Un'immagine scura. |

Returns: `String` Un'immagine JPEG come data URI.

Conserva il testo del captcha sul tuo server e confrontalo con quello che scrive l'utente.

Example: Total.js
```js
var image = await API('TAPI', 'captcha', { value: '123456' }).promise();
```

Example: REST
```bash
curl -X POST https://api.totaljs.com/captcha/ \
	-H "Content-Type: application/json" \
	-H "X-Token: YOUR_TOKEN" \
	-d '{ "value": "123456" }'
```

Example: Risposta
```text
data:image/jpeg;base64,/9j/4AAQSkZ...
```
