> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/ios/generate/thumbnail.md).

# Generate a PDF page thumbnail on iOS

Learn how to create a PDF page thumbnail in various image formats like JPG, PNG, BMP, and TIFF. Get full code samples for converting PDF to images and saving them in PNG and JPEG formats. Explore diff

To create a PDF page thumbnail in multiple image formats.

{% tabs %}
{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
PTPDFDoc *doc = [[PTPDFDoc alloc] initWithFilepath: filename];

// set the output resolution
PTPDFDraw *draw = [[PTPDFDraw alloc] initWithDpi: 92];

// Rasterize the first page in the document and save the result as PNG.
PTPage* pg = [doc GetPage: 1];
[draw Export:pg filename: output_filename format: @"PNG"];
```

{% endcode %}
{% endtab %}

{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
let doc: PTPDFDoc = PTPDFDoc(filepath: filename)

// The output resolution is set to 92 DPI
let draw: PTPDFDraw = PTPDFDraw(dpi: 92)

// Rasterize the first page in the document and save the result as PNG.
let pg: PTPage = doc.getPage(1)
draw.export(pg, filename: output_filename, format: "PNG")
```

{% endcode %}
{% endtab %}
{% endtabs %}

[Convert PDF to image (JPG, PNG, BMP, TIFF)](/ios/get-started/samples.md#pdfdraw) Full code sample illustrates how to use the built-in rasterizer in order to render PDF images on the fly and how to save resulting images in PNG and JPEG format.

More image format options:

* **"RAW"** : RAW format.There are four possibilities:
  * `e_rgba` - if transparent and color page;
  * `e_gray_alpha` - if transparent and gray page;
  * `e_rgb` - if opaque and color page;
  * `e_gray` - if opaque and gray page. NOTE that if page is set to be transparent (SetPageTransparent), the output color channels are already multiplied by the alpha channel.
* **"BMP"** : Bitmap image format (BMP)
* **"JPEG"** : Joint Photographic Experts Group (JPEG) image format
* **"PNG"** : 24-bit W3C Portable Network Graphics (PNG) image format
* **"PNG8"** : 8-bit, palettized PNG format. The exported file size should be smaller than the one generated using "PNG", possibly at the expense of some image quality.
* **"TIFF"** : Tag Image File Format (TIFF) image format.
* **"TIFF8"** : Tag Image File Format (TIFF) image format (with 8-bit palete).


---

# 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.apryse.com/ios/generate/thumbnail.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.
