# PDF to image converter

## Availability

Orbeon Forms 2016.1 and newer.

## Introduction

This processor converts a PDF document into a single image document.

When the output format is TIFF, the processor creates a multi-page TIFF containing one page for each page in the PDF document. For other output formats, only the first page of the PDF document is used and a single image is created.

When using the TIFF format, if the destination format is bitonal (black and white), dithering is applied.

## Basic usage example

```markup
<p:processor name="oxf:pdf-to-image">
    <p:input name="data" href="#pdf-data"/>
    <p:input name="config">
        <config>
            <format>tiff</format>
            <compression>
                <type>LZW</type>
                <quality>0.8</quality>
            </compression>
            <scale>2.0</scale>
        </config>
    </p:input>
    <p:output name="data" id="image-data"/>
</p:processor>
```

## Inputs and outputs

* `data` input: receives the PDF document to convert as a binary document.
* `config` input: receives the configuration of the transformation.
* `data` output: produces the resulting image as a binary document.

The `config` input supports the following elements:

* `format`:
  * one of `gif`, `png`, `jpeg`, or `tiff`
  * mandatory
* `scale`:
  * scaling factor
  * optional
  * defaults to `1.0`
* `compression`
  * compression settings
  * optional
  * `type` child element
    * only meaningful for `tiff` format
    * one of `CCITT RLE`, `CCITT T.4`, `CCITT T.6`, `LZW`, `JPEG`, `ZLib`, `PackBits`, `Deflate`, `EXIF JPEG` or `none`
    * defaults to `none`
  * `quality` child element
    * only meaningful for `gif`, `jpeg` and `tiff` formats
    * value is a double-precision number from `0.0` to `1.0`

### Examples of configurations

GIF output:

```markup
<config>
    <format>gif</format>
    <scale>3.0</scale>
    <compression>
        <quality>0.5</quality>
    </compression>
</config>
```

JPEG output:

```markup
<config>
    <format>jpeg</format>
    <scale>3.0</scale>
    <compression>
        <quality>1.0</quality>
    </compression>
</config>
```

PNG output:

```markup
<config>
    <format>png</format>
    <scale>3.0</scale>
</config>
```

Black and white TIFF output with "CCITT T.6" compression:

```markup
<config>
    <scale>3.0</scale>
    <format>tiff</format>
    <compression>
        <type>CCITT T.6</type>
        <quality>0.5</quality>
    </compression>
</config>
```

Uncompressed TIFF output:

```markup
<config>
    <scale>3.0</scale>
    <format>tiff</format>
    <compression>
        <type>none</type>
    </compression>
</config>
```

Compressed TIFF output with LZW compression:

```markup
<config>
    <scale>3.0</scale>
    <format>tiff</format>
    <compression>
        <type>LZW</type>
        <quality>1.0</quality>
    </compression>
</config>
```


---

# 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://doc.orbeon.com/xml-platform/processors/pdf-to-image-converter.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.
