# PDF.co

> Automate PDF conversions, barcode reading, document editing, and data extraction with PDF.co.

App · File Conversion · 9 actions. Web page: https://docs.lodol.com/docs/integrations/pdfco

## Actions

### Add text watermark

Stamp a line of text across every page of a PDF at a chosen position.

**Inputs**

- Source URL (`source_url`, text, required): Public URL of the PDF to watermark.
- Text (`text`, text, required): Watermark text to place in the PDF.
- Horizontal position (X) (`x`, number): Horizontal position for the watermark text, in points.
- Vertical position (Y) (`y`, number): Vertical position for the watermark text, in points.

**Outputs**

- `url` (text): Download link for the watermarked PDF file.

**Example output**

```json
{
  "url": "mock_value"
}
```

### Convert HTML to PDF

Turn HTML content into a PDF file, with an optional file name.

**Inputs**

- HTML (`html`, text, required): The HTML content to turn into a PDF.
- File name (`name`, text): Optional file name for the generated PDF.

**Outputs**

- `name` (text): File name of the generated PDF.
- `url` (text): Download link for the generated PDF file.

**Example output**

```json
{
  "name": "mock_value",
  "url": "mock_value"
}
```

### Convert PDF to CSV

Turn the tables in a PDF into a CSV spreadsheet file.

**Inputs**

- Source URL (`source_url`, text, required): Public URL of the PDF to convert.
- Pages (`pages`, text): Optional pages to convert. The first page is 0, so 0-2 means the first three pages. Leave blank to convert every page.

**Outputs**

- `csv_url` (text): Download link for the generated CSV file.

**Example output**

```json
{
  "csv_url": "mock_value"
}
```

### Convert PDF to text

Extract the plain text from a PDF using PDF.co.

**Inputs**

- Source URL (`source_url`, text, required): Public URL of the PDF to convert.
- Pages (`pages`, text): Optional pages to convert. The first page is 0, so 0-2 means the first three pages. Leave blank to convert every page.

**Outputs**

- `text` (text): The plain text extracted from the PDF.

**Example output**

```json
{
  "text": "mock_value"
}
```

### List document parser templates

List the Document Parser templates on the account, both your own and the ones PDF.co provides, with the ID needed to parse a document.

**Inputs**: None.

**Outputs**

- `remaining_credits` (number): PDF.co credits left on the account.
- `template_count` (number): How many templates were returned.
- `templates` (list): The templates available on the account.

**Example output**

```json
{
  "remaining_credits": 94229,
  "template_count": 2,
  "templates": [
    {
      "description": "Parses invoices and extracts invoice number, company name, due date, amount, tax",
      "id": "1",
      "title": "Invoice Parser",
      "type": "system"
    },
    {
      "description": "Untitled",
      "id": "40",
      "title": "Untitled",
      "type": "user"
    }
  ]
}
```

### Merge PDFs

Combine multiple PDF files into a single document.

**Inputs**

- PDF URLs (`file_urls`, list, required): The PDFs to merge, in order (at least two). Give one URL per entry, or paste them all separated by commas.
- Output name (`output_name`, text): Optional name for the merged file.

**Outputs**

- `file_count` (number): Number of PDF files that were merged.
- `url` (text): Download link for the merged PDF file.

**Example output**

```json
{
  "file_count": 1,
  "url": "mock_value"
}
```

### Parse document

Pull the fields and tables out of a PDF or image using one of your PDF.co Document Parser templates: for example the invoice number, due date, and line items on an invoice.

**Inputs**

- Source URL (`source_url`, text, required): Public URL of the PDF or image to parse.
- Template (`template_id`, text, required): The Document Parser template that says which fields and tables to pull out. PDF.co provides built-in templates (such as Invoice Parser), and you can create your own at https://app.pdf.co/document-parser/templates.
- Pages (`pages`, text): Optional pages to parse. The first page is 0, so 0-2 means the first three pages. Leave blank to parse every page.
- Password (`password`, text): Optional password, if the PDF is protected.

**Outputs**

- `fields` (object): Each field the template found, by name.
- `objects` (list): The raw result from PDF.co, including each value's position on the page.
- `page_count` (number): Number of pages in the document.
- `remaining_credits` (number): PDF.co credits left on the account.
- `tables` (list): Every table the template found.
- `template_name` (text): Name of the template used to read the document.
- `template_version` (text): Version of the template used to read the document.

**Example output**

```json
{
  "fields": {
    "companyName": "Amazon Web Services, Inc",
    "dateDue": "2018-04-03T00:00:00",
    "invoiceId": "123456789",
    "total": 6.58
  },
  "objects": [
    {
      "name": "invoiceId",
      "objectType": "field",
      "pageIndex": 0,
      "rectangle": [
        0,
        0,
        0,
        0
      ],
      "value": "123456789"
    }
  ],
  "page_count": 1,
  "remaining_credits": 60803,
  "tables": [
    {
      "name": "table",
      "row_count": 1,
      "rows": [
        {
          "amount": "5.57",
          "description": "Data Transfer"
        }
      ]
    }
  ],
  "template_name": "Generic Invoice [en]",
  "template_version": "4"
}
```

### Read barcodes

Scan a PDF or image and read any barcodes it contains.

**Inputs**

- Source URL (`source_url`, text, required): Public URL of the file containing barcodes.
- Barcode types (`barcode_types`, list, required): The barcode types to look for -- PDF.co needs to know which ones to decode. Give one type per entry, or paste them separated by commas. Common types are QRCode, Code128, Code39, EAN13, UPCA, PDF417, and DataMatrix; see https://docs.pdf.co/api/barcode/read-barcodes for the full list.

**Outputs**

- `barcodes` (list): The barcodes found, each with its type, value, and page.

**Example output**

```json
{
  "barcodes": [
    {}
  ]
}
```

### Split PDF by page ranges

Split a PDF into multiple files using page ranges.

**Inputs**

- Source URL (`source_url`, text, required): Public URL of the PDF to split.
- Page ranges (`page_ranges`, text, required): Where to split the PDF, given as page ranges. The first page is 0, so 0-1,2,3- splits after page 2, after page 3, and keeps the rest.

**Outputs**

- `urls` (list): Download links for each split PDF file.

**Example output**

```json
{
  "urls": [
    "mock_value"
  ]
}
```
