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

# Documentos e imágenes

> Imprime, convierte y lee archivos: PDF, OCR, facturas, matrículas e imágenes captcha.

Cada servicio es una petición `POST` con tu token. Consulta [Llama a Total API desde Total.js](../../guides/call-from-totaljs/) y [Llama a Total API por HTTP](../../guides/call-over-http/).

## API

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

Type: `rest`

Imprime HTML o una página web en PDF, JPG o PNG.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `type` | `String` | yes |  | `pdf`, `jpg` o `png`. |
| `html` | `String` | no |  | El HTML que quieres imprimir. Envía `html` o `url`. |
| `url` | `String` | no |  | La dirección de una página web que quieres imprimir. |
| `page` | `String` | no | `A4` | `A3`, `A4`, `A5` o `Letter`. |
| `width` | `Number` | no |  | PDF: el ancho de la página. Imagen: el ancho del navegador, en píxeles. |
| `height` | `Number` | no |  | PDF: el alto de la página. Imagen: el alto del navegador, en píxeles. |
| `dpi` | `Number` | no | `96` | Solo PDF. |
| `margin` | `String` | no | `0 0 0 0` | Solo PDF: `top right bottom left` en milímetros. |
| `viewport` | `String` | no |  | `xs` (móvil), `sm` (tableta), `md` (pantalla mediana) o `lg` (pantalla grande). |
| `quality` | `Number` | no |  | La calidad de una imagen. |
| `orientation` | `String` | no | `portrait` | `portrait` o `landscape`. |
| `grayscale` | `Boolean` | no |  | Solo PDF: un documento en escala de grises. |
| `lowquality` | `Boolean` | no |  | Solo PDF: un documento más pequeño y de menor calidad. |
| `zoom` | `Number` | no | `100` | El zoom en porcentaje. |

Returns: `Binary` El propio archivo (datos binarios).

El HTML o la página web pueden ocupar hasta 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`

Convierte un archivo a PDF, JPG o PNG.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `to` | `String` | yes |  | `pdf`, `jpg` o `png`. |
| `data` | `String` | yes |  | El archivo como data URI, por ejemplo `data:application/pdf;base64,JVBERi0x...` |

Returns: `Binary` El archivo convertido (datos binarios).

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`

Lee el texto de un archivo JPG, PNG o PDF.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `data` | `String` | yes |  | El archivo como data URI: JPG, PNG o PDF. |
| `language` | `String` | no | `eng` | El idioma del texto de una imagen, por ejemplo `eng`, o `slk+eng` para dos idiomas. Los archivos PDF lo ignoran. |

Returns: `Object` Un objeto con el texto en `text`.

Las imágenes se leen con el motor Tesseract 5, y el texto conserva la disposición de la imagen. El texto de un archivo PDF se lee del propio archivo. El archivo puede ocupar hasta 5 MB.

Los códigos de los idiomas están en la [lista de idiomas de 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: Respuesta
```json
{ "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit..." }
```

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

Type: `rest`

Lee los datos de una factura de un archivo PDF, JPG o PNG.

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

Returns: `Object` El proveedor, el cliente y las cifras de la factura.

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: Respuesta
```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`

Lee una matrícula en una foto JPG o PNG.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `data` | `String` | yes |  | La foto como data URI: JPG o PNG. |
| `code` | `String` | no | `eu` | El tipo de matrículas: `eu` o `us`. |

Returns: `Array` Un array con las matrículas encontradas, cada una con su nivel de confianza en porcentaje.

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: Respuesta
```json
[
	{ "value": "BB197FJ", "confidence": 87.434 }
]
```

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

Type: `rest`

Dibuja una imagen captcha con el texto que envías.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `value` | `String` | yes |  | El texto de la imagen. |
| `width` | `Number` | no | `200` | El ancho en píxeles. |
| `height` | `Number` | no | `80` | El alto en píxeles. |
| `dark` | `Boolean` | no | `false` | Una imagen oscura. |

Returns: `String` Una imagen JPEG como data URI.

Guarda el texto del captcha en tu servidor y compáralo con lo que escribe el usuario.

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: Respuesta
```text
data:image/jpeg;base64,/9j/4AAQSkZ...
```
