
In this article, we will explain how to create a PDF file using an auto-step related to Google Drive.
Google Docs, Sheets, and Slides stored in Google Drive can be exported in PDF format. We will show you how to use this function to output content written in Markdown as a PDF.
Just by writing Markdown, you can create a PDF file with simple decorations.
Overview
The mechanism introduced here is that the content entered in a Human Task is saved as a PDF file. When inputting text, the Markdown notation is used to specify the structure and decoration of the text. The input content is saved as a PDF file in a File-type data item according to the following procedure.
- A text file is created based on the content entered as Markdown text.
- The created file will be converted to a Google Doc and uploaded to Google Drive.
- The uploaded file is downloaded as a PDF file and saved in the data item.
The above actions are carried out by three automated steps.

About Each Auto Step
There are many built-in automated steps for Google Drive.
R2010: BPMN Icons Available in Each Edition
This time we will use three features: [Google Drive: Upload File], which has been recently updated, the newly added [Google Drive: Export Google Workspace File as PDF], and [Generate Text File], which converts text-type data into a file.
First, a brief explanation of each process.
Generate Text File

Reference: [Generate Text File]
Create any text file and store it in a File-type Data Item. When saving, you can select the character code type, such as UTF-8 or UTF-16BE (with BOM). You can also select the file type, such as text/html or text/markdown, when saving.
Google Drive: Upload File

Reference: [Google Drive: Upload File]
This is an automated step that was also introduced in Utilizing Google Drive from Workflow.
In addition to the features mentioned in the article above, you can now choose to convert your files to either Google Docs, Sheets, or Slides when uploading to Google Drive.
Please also refer to the above article for information on “Setting up Google Connectivity”.
Google Drive: Export Google Workspace File as PDF

Reference: [Google Drive: Export Google Workspace File as PDF]
Download the specified Google Workspace file (Google Docs, Sheets, Slides, etc.) in PDF format. Multiple downloads are possible at once.
Sample App
Here is a sample app created using these automated steps.

We will introduce specific app settings below as an example.
Data Item Settings
Set the data items as follows:
| Data Item Name | Data Type | Field Name | Required | Markdown input step | PDF confirmation step | Explanation |
|---|---|---|---|---|---|---|
| Title | – | – | – | Editable | Display only | The process title. |
| Document Manuscript | String-type (Markdown) | q_document_source | ○ | Editable | Display only | Enter the Markdown text that will be the source of your PDF content. |
| File ID | String-type (multiple lines) | q_file_id | – | No display | Display only | Saves the ID of the file you uploaded to Google Drive. |
| Upload File | File-type | q_up_file | – | No display | Display only | Saves the file created in the [Generate Text File] Step. |
| Download File | File-type | q_down_file | – | No display | Display only | Saves the downloaded PDF file |
| Error | String-type (multiple lines) | q_error | – | No display | Display only | If an error occurs in the [Google Drive: Upload File] step, saves the error response |
[Generate Text File] Step Settings
First, in the “Input Manuscript” step, you input the Markdown text that will be the source of the PDF. In the next “Convert Manuscript File” step, a text file is created based on the Markdown text input.
The setting items for the “Convert Manuscript File” step are as follows:
| Item Name | Required | Explanation |
|---|---|---|
| C1: File type data item to save text file | ○ | Specify the File-type data item to save the created text file. In this example, specify “Upload File”. |
| C2: Delete other files when saving | – | Specify whether to replace the created file or save it to an existing file. In this example, set it to on. |
| C3: Saving file name | ○ | Specify the name of the file to be created. In this example, let’s use “markdown-#{processInstanceId}”. The “#{processInstanceId}” part contains the process ID, so the file will not overlap with other files created with this app. |
| C4: Contents of text file | ○ | The content entered in this field will become the file. In this example, specify the expression (#{#q_document_source) that references the String-type (Markdown) “Document Manuscript”. |
| C5: Character encoding when saving (UTF-8 if not selected) | – | Specify the character code for the file to be generated. In this example, specify “UTF-8”. |
| C6: File type when saving (text/plain if not selected) | – | Specify the MIME-type of the file to be generated. In this example, specify [text/markdown]. |
[Google Drive: Upload File] Step Settings
Next, in the “Upload File” step, the specified file is uploaded to the Google Drive folder.
The setting items for the “Upload File” Task are as follows:
| Item Name | Required | Explanation |
|---|---|---|
| User who connects to Google Drive | ○ | Specify the user who will upload the file to Google Drive. The specified user must be connected to Google Drive. |
| Data item whose attached files will be uploaded | ○ | Specify the data item that contains the file to be uploaded. In this example, specify “Upload File”. |
| Folder ID that files will be uploaded | – | Specify the folder ID to which the file will be uploaded in Google Drive. If left blank, the file will be uploaded to the root of My Drive. |
| Convert files | – | When uploading a file to Google Drive, you can choose to convert it to Google Docs, Sheets, or Slides, or upload it as is without converting it. In this example, select Google Docs. |
| Data item that will save uploaded file ids | – | Specify the data item in which to save the ID of the uploaded file. In this example, specify “File ID”. |
| Data item that will save web view urls of uploaded files | – | Specify the data item in which to save the display URL of the uploaded file. Not used this time. |
| Data item that will save download urls of uploaded files | – | Specify the data item to save the download URL of the uploaded file. Not used this time. |
| Data item to save error details | – | When an error occurs, specify the data item to which the error response will be saved. In this example, specify “Error”. |
[Google Drive: Export Google Workspace File as PDF] Step Settings
The “Export PDF” step downloads the file stored in Google Drive in PDF format.
The settings for the “Export PDF” step are as follows:
| Item Name | Required | Explanation |
|---|---|---|
| C1: Service Account Setting | ○ | Specify the name of the HTTP authentication configuration you created in the [OAuth2 JWT Bearer Flow]. |
| C2: File IDs to download | ○ | Specify the data item in which the file ID to be downloaded is saved. In this example, specify “File ID”. |
| C3: Data item to add the downloaded file | ○ | Specify the data item to save the downloaded file. In this example, select “Download File”. |
Once the file download is complete, you will check the PDF file in the “PDF Verification” step.
Operation Check
Once you have completed all the settings, check the operation by running the debug command.
Click [Start debug process] from the first Start Event. In the started process, enter Markdown text into the “Document Manuscript,” the String-type data item. You can check the appearance of the text you enter on the preview screen.
Please refer to the following documents for how to write Markdown text.

Once the input is complete, end the Task and wait for the automatic processing to complete. If the “PDF Verification” Task is assigned, check the attachment of the “Download File” data item.
If the automated processing fails, check the following
- [Generate Text File] Step/[Google Drive: Export Google Workspace File as PDF] Step
- In the administrator mode of the process details page, click [Process Log]
- [Google Drive: Upload File]
- Output to “Error” data item
Test Markdown text sample
Here is a test Markdown text sample. Please refer to the contents and generated PDF.
Sample Markdown (click to open)
# Product Catalog
## 1. Main Product Lineup
### :Rice_ball: Onigiri
- **Pickled plum rice ball**
A traditional taste. A classic dish made with carefully selected pickled plums.
*Price*: $00A5150
*Calories*: 180 kcal
- **Salmon rice balls**
Rice balls made with generous amounts of Hokkaido salmon.
*Price*: $00A5180
*Calories*: 200 kcal
- **Kombu rice balls**
A popular product packed with the deep flavor of boiled kelp.
*Price*: $00A5170
*Calories*: 190 kcal
---
## 2. Seasonal Menu
### :cherry_blossom: Spring only
- **Sakura shrimp and rape blossom rice balls**
A special dish that lets you feel the cherry blossom season.
*Price*: $00A5200
### :maple_leaf: Autumn only
- **Chestnut and mushroom rice balls**
A luxurious taste that allows you to enjoy the aroma of autumn.
*Price*: $00A5220
---
## 3. Side Menu
- **Miso soup**
Warm miso soup with plenty of ingredients.
*Price*: $00A5100
- **Tamagoyaki**
Homemade egg rolls with a slightly sweet finish.
*Price*: $00A5120
---
## 4. Great Value Set
- **Onigiri Set**
2 rice balls + miso soup
*Price*: $00A5400
- **Special Set**
2 rice balls + miso soup + tamagoyaki
*Price*: $00A5500
---
## 5. Store Information
- **Store name**: Onigiri Shop
- **Location**: 123-456, Shibuya-ku, Tokyo
- **Opening times**: 10:00 - 20:00
- **Closed**: Every Wednesday
[Official website here](https://onigiriya.example.com)
---
Downloaded PDF
The image below shows the PDF output of the sample markdown captured as a PNG file.


