# Viewing PDFs

If you offer PDF documents on your website and want to include them in your Cobrowse sessions you just need to enable the PDF viewing feature on the Cobrowse SDK.

<figure><img src="/files/izpXc6DDFjYpHouX2m4p" alt=""><figcaption></figcaption></figure>

With this feature enabled an embedded viewer will load the documents directly into the browser without requiring downloads or the full device mode.

## Configuration

The PDF Viewer functionality is configured with URLs of the PDFs as they are linked on your website. To make it simpler to configure this be done using [glob patterns](https://www.npmjs.com/package/glob-to-regexp#usage) with which you can use to match different patterns:

```javascript
// links in your website ending with the .pdf extension
CobrowseIO.pdfLinks = ['*.pdf']

// links to the example.com domain with the path starting with /assets/pdfs/
CobrowseIO.pdfLinks = ['https://example.com/assets/pdfs/*']

// links to any domain with /pdfs/ as part of the path and the .pdf extension
CobrowseIO.pdfLinks = ['*/pdfs/*.pdf']
```

the same can be achieved using [Javascript RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp):

```javascript
// links in your website ending with the .pdf extension
CobrowseIO.pdfLinks = [/.*\.pdf/]

// links to the example.com domain with the path starting with /assets/pdfs/
CobrowseIO.pdfLinks = [/https\:\/\/example\.com\/assets\/pdfs\/.*\.pdf/]

// links to any domain with /pdfs/ as part of the path and the .pdf extension
CobrowseIO.pdfLinks = [/.*\/pdfs\/.*\.pdf/]
```

The `pdfLinks` property is an array which will accept either of these formats.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cobrowse.io/sdk-features/viewing-pdfs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
