Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ to = "/plugins"
status = 301
force = true

[[redirects]]
from = "/tags/pdf-beta"
to = "/tags/pdf"
status = 301
force = true

[[redirects]]
from = "/"
to = "/guide"
Expand Down
82 changes: 0 additions & 82 deletions docs/source/tags/pdf-beta.md

This file was deleted.

97 changes: 75 additions & 22 deletions docs/source/tags/pdf.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,26 @@ meta_title: PDF tag for loading PDF documents
meta_description: Label Studio PDF tag for loading PDF documents for machine learning and data science projects.
---

The `Pdf` tag displays a PDF document in the labeling interface. Use this tag to perform document-level annotations, transcription, and summarization.
The `Pdf` tag displays a PDF document in the labeling interface. You can use this tag to:

Use with the following data types: PDF.

{% insertmd includes/tags/pdf.md %}

### Supported control tags

The `<Pdf>` tag is intended for document-level classification tasks and does not support applying annotations to the actual content of the PDF.
- Perform document-level annotations such as classification, transcription, and summarization.
- Perform OCR validation on supported PDFs. <span class="badge"></span>

For example, if you want to apply labels for OCR tasks, you will need to convert the PDF into images first. For more information, see [Multi-Page Document Annotation](/templates/multi-page-document-annotation).
Supports:
* Zoom
* Rotation
* PDFs up to 100 pages

You can use the following control tags:

- [Choices](choices)
- [DateTime](datetime)
- [Number](number)
- [Pairwise](pairwise)
- [Rating](rating)
- [Taxonomy](taxonomy)
- [TextArea](textarea)
Use with the following data types: PDF.

!!! error Enterprise
You can also use the PDF tag with [Prompts](https://docs.humansignal.com/guide/prompts_overview) to perform auto-labeling work such as PDF summarization, classification, information extraction, and document intelligence.

### Example
{% insertmd includes/tags/pdf.md %}

## Example: PDF classification

Labeling configuration to label PDF documents:
Labeling configuration apply document-level classification to PDF documents:

```html
<View>
Expand All @@ -46,11 +38,72 @@ Labeling configuration to label PDF documents:
</View>
```

**Example Input data:**
#### Example Input data:

```json
{
"pdf": "https://app.humansignal.com/static/samples/opossum-cuteness.pdf"
}
```

## Example: OCR <span class="badge"></span>

!!! error Enterprise
Label Studio Enterprise only.

For Community and Starter Cloud users who want to apply labels for OCR tasks, you will need to convert the PDF into images first and then use a labeling configuration similar to the [Multi-Page Document Annotation](/templates/multi-page-document-annotation) template.

Labeling configuration for PDFs:

```xml
<View>
<OcrLabels name="ocr" toName="pdf">
<Label value="Typo"/>
<Label value="Incorrect amount"/>
<Label value="Incorrect name"/>
</OcrLabels>

<Pdf name="pdf" value="$pdf"/>
</View>
```

#### Example Input data:

```json
{
"pdf": "https://app.humansignal.com/static/samples/sample.pdf"
"pdf": "https://app.humansignal.com/static/samples/opossum-cuteness.pdf"
}
```
### OcrLabels

This tag adds bounding boxes to the PDF and allows you to assign labels to them.


This tag must have one or more `Label` tag children, and supports standard parameters such as `maxUsages` (see [RectangleLabels](rectanglelabels) as an example).

#### Supported PDFs

PDFs that work best with the new OCR labeling are those that already contain a selectable text layer (text overlay).

In these PDFs, when you draw a bounding box, the tool can read and highlight the underlying text from that layer (see the video below).

Image-only PDFs such as scans or phone photos without a text layer won’t return text. For those, you may need to use an external OCR tool to add a text layer first. If a PDF’s text layer is misaligned or low quality, captured text may be incomplete or incorrect, and this feature can help you audit and improve those overlays.

**Results:**

| Result | Type | Description |
| --- | --- | --- |
| `x`, `y`, `width`, `height` | Number | Numbers from 0 to 1 that are relative to the page dimensions. |
| `rotation`| Number | Number in degrees clockwise from 0–360. Rotation is calculated with the origin at `(x, y)` (the top-left corner of the region). |
| `pageIndex` | Number | Page number, 1-based. |
| `ocrtext` | String | Captured text. This can be edited by selecting the region and then editing the text from the **Info** panel. |

!!! note
When you are rotating within the UI, it appears to originate from the center of the region. However, we store the origin as `(x, y)` - meaning in the top left corner of the region.

<br/>
<br/>

<video style="max-width: 800px;" class="gif-border" autoplay loop muted>
<source src="/images/tags/pdf-ocr.mp4">
</video>
3 changes: 3 additions & 0 deletions docs/source/templates/multi-page-document-annotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Multi-page document annotation allows you to annotate documents that consist of

If you just need to classify a PDF document as a whole, you can also use the [PDF Classification template](pdf_classification).

!!! error Enterprise
If you are performing OCR annotation and you are a Label Studio Enterprise users, see [OCR Labeling for PDFs](pdf_ocr).

<a href="https://app.humansignal.com/b/MTk4"
target="_blank" rel="noopener" aria-label="Open in Label Studio" style="all:unset;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;border-radius:4px;border:1px solid rgb(109,135,241);padding:8px 12px;background:rgb(87 108 193);color:white;font-weight:500;font-family:sans-serif;gap:6px;transition:background 0.2s ease;" onmouseover="this.style.background='rgb(97 122 218)'" onmouseout="this.style.background='rgb(87 108 193)'">
<svg style="width:20px;height:20px" viewBox="0 0 26 26" fill="none"><path fill="none" d="M3.5 4.5h19v18h-19z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M25.7 7.503h-7.087V5.147H7.588V2.792h11.025V.436H25.7v7.067Zm-18.112 0H5.225v10.994H2.863V7.503H.5V.436h7.088v7.067Zm0 18.061v-7.067H.5v7.067h7.088ZM25.7 18.497v7.067h-7.088v-2.356H7.588v-2.355h11.025v-2.356H25.7Zm-2.363 0V7.503h-2.363v10.994h2.363Z" fill="white"/></svg>
Expand Down
74 changes: 74 additions & 0 deletions docs/source/templates/pdf_ocr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
title: OCR Labeling for PDFs
type: templates
category: Computer Vision
cat: computer-vision
order: 126
meta_title: PDF OCR Data Labeling Template
meta_description: Template for correcting text in a PDF document.
---

Use this template to perform region-level OCR directly on native PDFs.

The `Pdf` tag renders multi-page documents (up to 100 pages) with zoom and rotation, while OcrLabels lets you draw bounding boxes, assign labels, and capture editable OCR text per region.

Each region stores normalized coordinates, rotation, and a page index, making outputs reliable for downstream extraction tasks.

Ideal for document intelligence, QA on OCR output, and structured data capture workflows.

!!! error Enterprise
This template can only be used with in Label Studio Enterprise.

![Screenshot](/images/templates-misc/pdf-opossum.png)

## Labeling Configuration

```xml
<View>
<Header value="Select text to correct" size="4"/>
<OcrLabels name="ocr" toName="pdf">
<Label value="Typo" />
<Label value="Incorrect Amount" />
<Label value="Incorrect Name" />
</OcrLabels>
<Pdf name="pdf" value="$pdf"/>
</View>

<!-- {
"data": {
"pdf": "/static/samples/opossum-cuteness.pdf"
}
} -->
```

## About the labeling configuration

* **`Pdf`**

This will display your PDF natively in Label Studio, allowing you to zoom in and rotate as needed.

Support for PDFs up to 100 pages.

* **OcrLabels**

Used only with the `Pdf` tag, and allows you to draw bounding boxes around text. Note that the PDF must have a text overlay for this to work (for example, verify whether you can highlight text in the PDF using your cursor).

Select the text under the **Regions** panel to correct it.

<img src="/images/templates-misc/ocrlabels.png" alt="" class="gif-border" style="max-width:400px" />



## Input data

```json
{
"data": {
"pdf": "/static/samples/opossum-cuteness.pdf"
}
}
```

## Related tags
- [Header](/tags/header.html)
- [Pdf](/tags/pdf.html)
Binary file added docs/themes/v2/source/images/tags/pdf-ocr.mp4
Binary file not shown.
Binary file removed docs/themes/v2/source/images/tags/pdf2-ocr.mp4
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading