Generate QR Code
Audience:
Low-code EngineersSkill Prerequisites:
Actions,Tokens
Creates a QR code image from any text, for example a URL, and saves it as a PNG file in a portal folder. You can choose the colors, the size of the image, how much damage the code can survive, and add a small icon, such as your logo, in the middle. The action can return the file's details, URLs and Base64 content as tokens.
This action is part of the PlantAnApp QR add-on. The add-on is installed separately and requires the PAAQR feature package to be licensed. If it isn't licensed, the action fails with a not-licensed error. Once installed, the action is available in all modules that run actions.
Typical Use Cases
- Create a QR code that opens a record, ticket or survey page on a phone
- Add a QR code to a PDF, badge or email, using the image's URL or Base64 content
- Create branded QR codes in your company colors with your logo in the middle
- Create a QR code for event check-in from a registration ID
Don't use it to
- Create barcodes for retail scanners, such as EAN-13 or Code 128. Use Generate Barcode instead.
- Read or scan QR codes. This action only creates images.
- Create JPEG or SVG images. The image is always a PNG.
QR code or barcode?
| Generate QR Code | Generate Barcode | |
|---|---|---|
| Shape | Square grid (2D) | Bars (1D) |
| Best for | URLs, longer text, anything scanned with a phone camera | Short codes read by barcode scanners: product numbers, order IDs, asset tags |
| Data | Any text | Depends on the type. Some types take digits only. |
| Image format | PNG | JPEG |
| Colors and logo | Custom colors and an optional icon in the middle | Black on white only |
Related Actions
| Action Name | Description |
|---|---|
| Generate Barcode | Creates a 1D barcode image instead of a QR code. |
| Get or Create Folder | Creates the output folder ahead of time. This action doesn't create folders. |
| Generate PDF | Creates a PDF, for example a ticket that includes the QR code. |
| Send Email | Sends the QR code by email. |
| Delete File | Deletes a QR code image you no longer need. |
Input Parameter Reference
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| Text | The text to encode, for example https://example.com/tickets/[TicketId]. | Yes | empty string | Yes |
| Error Correction Level | How much of the code can be damaged or covered and still be read: Lowest, Medium, Quality or Highest. See Error correction. | No | Quality | No |
| Pixels Per Module | The size in pixels of each small square (module) of the code. Bigger values make a bigger image. See Image size. | No | 20 | Yes |
| Dark Color | The color of the dark squares, as a hex color such as #000000 or a color name such as Navy. | Yes | #000000 | No |
| Light Color | The color of the background and light squares, in the same format. | Yes | #ffffff | No |
| Icon | An image to draw in the middle of the code, such as a logo. Pick a .jpg or .png file, or switch to an expression and give a file ID or path, for example [LogoFileId]. Leave it empty for no icon. | Yes | empty | No |
| Icon Size | How big the icon is: Small, Medium or Large (about 30%, 50% and 70% of the code's width). Only shown when Icon is set. | No | Small | No |
| Folder | The portal folder to save the image in. Pick a folder, or switch to an expression and give a folder path or folder ID. The folder must already exist. | Yes | empty | Yes |
| File Name | The image's file name, without the extension, for example ticket-[TicketId]. .png is always added. | Yes | empty string | Yes |
| Output Token Name | The name of the output token, for example QrCode. See Output Parameters Reference. | No | empty string | No |
File Name is required in the action editor. If it's still empty when the action runs, for example because a token returned nothing, a random name (a GUID) is used.
Output Parameters Reference
If Output Token Name is filled in, the action creates these tokens. If it's empty, no tokens are created. For example, with QrCode you'd use [QrCode:RelativeUrl].
| Token | Contains |
|---|---|
[<TokenName>:FileId] | The ID of the image file. |
[<TokenName>:FileName] | The file name without the extension. |
[<TokenName>:FileExtension] | The extension, without the dot: png. |
[<TokenName>:FileNameAndExtension] | The file name with the extension. |
[<TokenName>:FolderId] | The ID of the folder. |
[<TokenName>:FolderPath] | The folder path, for example QRCodes/. |
[<TokenName>:RelativeUrl] | The URL of the image, relative to the site. Use this in an <img> tag. |
[<TokenName>:AbsoluteUrl] | The full URL of the image. |
[<TokenName>:Base64] | The PNG image, Base64 encoded, without a data: prefix. |
[<TokenName>:MimeType] | The content type: image/png. |
[<TokenName>:FileSize] | The file size in a readable form. :FileSizeB, :FileSizeKB, :FileSizeMB and :FileSizeGB give the size in a specific unit. |
[<TokenName>:PortalPath] | The folder and file name inside the portal, for example /QRCodes/ticket-1001.png. Standard folders only. |
[<TokenName>:FilePath] | The physical path on the server. Standard folders only. |
[<TokenName>:Stream] | The file, for example to save it into a database. Standard folders only. |
[<TokenName>:LinkClick] | A LinkClick URL for the file. Obsolete, use RelativeUrl or AbsoluteUrl instead. |
[<TokenName>:State] | Always OK. |
In standard folders, RelativeUrl and AbsoluteUrl are direct links to the file. In secure and database folders, they're LinkClick URLs, which check the folder's permissions.
To show the Base64 image directly in HTML, add the prefix yourself: <img src="data:image/png;base64,[QrCode:Base64]" />.
Error correction
QR codes contain extra data so they can still be read when part of the code is dirty, damaged or covered. More error correction makes the code more reliable, but it has more squares, so it's denser.
| Error Correction Level | Can be recovered |
|---|---|
| Lowest | About 7% of the code |
| Medium | About 15% of the code |
| Quality | About 25% of the code |
| Highest | About 30% of the code |
An icon covers part of the code. When you use one, choose Highest and a small icon, and test the result with a few phones.
Image size
The image is always square. Its width is the number of modules across the code, plus a 4-module blank border on each side, times Pixels Per Module. The number of modules depends on how long the text is and on the error correction level. The smallest QR code is 21 modules across, so with the default of 20 pixels per module it's (21 + 8) × 20 = 580 pixels wide. Longer text makes a bigger image.
Considerations
- The folder isn't created. If Folder doesn't exist, the action fails. Use Get or Create Folder first if needed.
- The image is a PNG.
.pngis always added to File Name. Don't add an extension yourself, or the file ends up asname.png.png. - Existing files are replaced. If a file with the same name is already in the folder, it's overwritten. Include something unique in File Name, such as an ID.
- Keep enough contrast. Scanners expect a dark code on a light background. Very light dark colors, or reversed colors, may not scan.
- Colors must be valid. An unknown color name or a badly formed hex value makes the action fail.
- Keep Pixels Per Module filled in. It must be a whole number greater than zero.
- Very long text fails. A QR code can hold a limited amount of data, and less with a higher error correction level. Keep the text short, for example a link to a page instead of the full content.
- Errors are general. If anything goes wrong, for example a missing folder, an icon that can't be found, or an invalid color, the action fails with
Something went wrong during the generation of the QR Code.End users seeThere was an error with the form. Please contact the administrator or check logs for more info.The log has the details. - The output tokens need a web request. They're built from the current page request. Workflows and scheduled jobs run as Automation jobs without one, so with Output Token Name set the action fails there. The image is saved before the tokens are built, so leave Output Token Name empty in Automation jobs.
Examples
To understand how to use the below examples, please see Running Examples.
1. QR code for a ticket page
This action creates a black and white QR code that links to the ticket's page. It saves the image in the QRCodes folder as ticket-<TicketId>.png. The URL is then in [TicketQr:RelativeUrl].
{
"Title": "Generate QR Code",
"ActionType": "PlantAnApp.Qr.GenerateQrCode",
"Description": "Create a QR code for the ticket page",
"Parameters": {
"Text": "https://example.com/tickets?id=[TicketId]",
"ErrorCorrectionLevel": "Quality",
"PixelsPerModule": 10,
"DarkColor": "#000000",
"LightColor": "#ffffff",
"FolderPathOrId": "QRCodes/",
"FileName": "ticket-[TicketId]",
"OutputTokenName": "TicketQr"
}
}
2. Branded QR code with a logo
This action creates a dark blue QR code with the company logo in the middle. It uses the Highest error correction level so the code can still be read with the icon covering part of it. The image is returned as Base64 in [BrandedQr:Base64].
{
"Title": "Generate QR Code",
"ActionType": "PlantAnApp.Qr.GenerateQrCode",
"Description": "Create a branded QR code with the logo",
"Parameters": {
"Text": "[PageUrl]",
"ErrorCorrectionLevel": "Highest",
"PixelsPerModule": 12,
"DarkColor": "#1F3A93",
"LightColor": "#ffffff",
"IconFilePathOrId": "Images/logo.png",
"IconSize": "Small",
"FolderPathOrId": "QRCodes/Branded/",
"FileName": "qr-[ItemId]",
"OutputTokenName": "BrandedQr"
}
}
Revised 09/27/2026