> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/umbraco-cms/develop-with-umbraco/application-code/examine/pdfindex-multisearcher.md).

# PDF Indexes and Multisearchers

If you want to index PDF files and search for them, you will need to use the [UmbracoExamine.Pdf extension package](https://github.com/umbraco/UmbracoExamine.PDF).

## Installation

Install with NuGet:`dotnet add package Umbraco.ExaminePDF`

Installing the package creates a new Examine index called **PDFIndex**, which appears in the **Examine Management** dashboard under the **Settings** section. This index extracts and indexes the text content of PDF files uploaded to the Media section, not their filenames.

![PDFIndex index under Examine Management section](/files/fmaSIms0K8GFP00xLExI)

To get results, search for words that appear inside the PDF. Scanned or image-based PDFs have no extractable text and will return no results.

![PDFIndex Search Results](/files/VJnxmWVdAAdHoXHMXubV)

## Multi-index searchers

A multi-index searcher is a searcher that can search multiple indexes. The multi-index searcher can be helpful when you want to search both the external and internal indexes.

You can register a multi-index searcher with the ExamineManager on startup:

```csharp
using Examine;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using UmbracoExamine.PDF;

namespace MySite.MyCustomIndex;

[ComposeAfter(typeof(ExaminePdfComposer))]
public class ExamineComposer : IComposer
{
    public void Compose(IUmbracoBuilder builder)
    {
        builder.Services.AddExamineLuceneMultiSearcher("MultiSearcher", new[] {Constants.UmbracoIndexes.ExternalIndexName, PdfIndexConstants.PdfIndexName});
    }
}
```

With this approach, the multi-index searcher will show up in the **Examine Management** dashboard.

![MultiSearcher Search in the "Examine Management" dashboard](/files/9CrauGxC3NgNfRbzV9t6)

The multi-index searcher can be resolved in code from the ExamineManager:

```csharp
if (_examineManager.TryGetSearcher("MultiSearcher", out var searcher))
{
    //TODO: use the `searcher` to search
}
```

{% hint style="warning" %}
The implementation of `IPdfTextExtractor` is `PdfSharpTextExtractor` in this library, which uses `PDFSharp` to extract the bytes to convert to text. The implementation does not deal well with Unicode text, which means when some PDF files are read, the result will be 'junk' strings.

You can replace the `IPdfTextExtractor` using your own composer:

`composition.RegisterUnique<IPdfTextExtractor, MyCustomSharpTextExtractor>();`

The `iTextSharp` library deals with Unicode in a better way but is a paid license. If you wish to use `iTextSharp` or another PDF library, you can swap out the `IPdfTextExtractor` with your own implementation.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.umbraco.com/umbraco-cms/develop-with-umbraco/application-code/examine/pdfindex-multisearcher.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
