# Extracting Hyperlinks from PDFs

> Learn how to extract hyperlinks from PDFs using the Datalab API, preserving both link text and destinations.

- Canonical: https://www.datalab.to/blog/extracting-hyperlinks-from-pdfs
- Published: 2025-12-19
- Authors: Vik Paruchuri

Extracting hyperlinks from PDFs can be challenging, as links are often embedded within the document structure in non-obvious ways. Today we're announcing support for hyperlink extraction in our parsing API.

## How It Works

When you parse a PDF with Datalab, our API now automatically extracts and preserves hyperlinks. The output includes:

- **Link text**: The visible clickable text
- **Destination URL**: Where the link points to
- **Position**: Bounding box coordinates for the link

## Using the API

To extract hyperlinks, simply add the `extract_links` parameter to your API request:

```python
import datalab

client = datalab.Client()
result = client.parse(
    file="document.pdf",
    extract_links=True
)

for link in result.links:
    print(f"Text: {link.text}")
    print(f"URL: {link.url}")
    print(f"Page: {link.page}")
```

## Supported Link Types

Our hyperlink extraction supports:

- **Web URLs**: Standard http/https links
- **Email links**: mailto: links
- **Internal links**: Links to other pages within the document
- **Anchors**: Named destinations within the document

## Try It Now

Hyperlink extraction is available in our [playground](https://www.datalab.to/playground) and through the API. Sign up for free credits at [datalab.to](https://www.datalab.to) to get started.
