# PDF

The PDF piece in ZBrain Flow enables you to work with PDF files directly within your workflows. It supports multiple actions such as extracting text from PDF files or URLs, converting PDFs to images, creating PDFs from text, and generating PDFs from images. These capabilities help automate document handling tasks like content extraction, format conversion, and file generation without manual effort.

This piece is useful when you want to process documents, create PDFs dynamically, or use extracted content for further steps in the automation.

### **How to use PDF in ZBrain Flow** <a href="#how-to-use-pdf-in-zbrain-flow" id="how-to-use-pdf-in-zbrain-flow"></a>

**Select the PDF piece**

* Click on the '+' button in the Flow and search for 'PDF'. Select the PDF piece.
* Decide which action you need. The PDF piece offers the following options:
  * ‘Extract text’ – Extracts text from a PDF file or a public URL to a PDF.
  * ‘Convert to image’ – Converts a PDF file or a URL to image format.
  * ‘Text to PDF’ – Converts plain text into a downloadable PDF file.
  * ‘Image to PDF’ – Converts an image or list of images into a PDF.

#### **How to extract text from a PDF**  <a href="#how-to-extract-text-from-a-pdf" id="how-to-extract-text-from-a-pdf"></a>

**Configuration steps:**

In the ‘PDF File or URL’ field, provide either an uploaded PDF file or a public URL pointing to a PDF. The flow will extract all readable text content from the file for use in subsequent steps.

#### **How to convert a PDF to an image in ZBrain Flow** <a href="#how-to-convert-a-pdf-to-an-image-in-zbrain-flow" id="how-to-convert-a-pdf-to-an-image-in-zbrain-flow"></a>

**Configuration steps:**

* In the ‘PDF File or URL’ field, upload a PDF file or provide a public URL pointing to a PDF.
* In the ‘Output Image Type’ field, choose whether you want a ‘single combined image’ for the entire PDF or ‘separate image for each page’. The selected option determines how the PDF pages will be converted to image format.

#### **How to convert text to PDF** <a href="#how-to-convert-text-to-pdf" id="how-to-convert-text-to-pdf"></a>

**Configuration steps:**

In the ‘text’ field, enter the text you want to convert to PDF.

#### **How to convert an image to PDF** <a href="#how-to-convert-an-image-to-pdf" id="how-to-convert-an-image-to-pdf"></a>

**Configuration steps:**

In the ‘image’ field, upload the image you want to convert to PDF. The image must be in PNG, JPEG, or JPG format. If the image is larger than an A4 page, it will be automatically scaled down to fit the page.


---

# 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.zbrain.ai/zbrain-documentation/zbrain-builder/flows/flow-components/pdf.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.
