PDF Action
Provided by: "Apache Software Foundation"
Support Level for this Kamelet is: "Stable"
Turns the text of each message into a PDF document, with one font, font size and page size for the whole text.
Use it to produce a simple printable document, such as a receipt, a report or a log, that is then stored as a file or sent by email. To lay out the text first, put a template action before it, such as mustache-template-action.
Input: the body is the text to write, as text. Each line of the text starts a new line in the PDF, and a new page starts when a page is full.
Output: the body is the PDF document, as bytes. The headers are kept as they are; a Content-Type header set before is not changed to PDF.
Good to know: long lines are not wrapped; they run past the right edge of the page. Set font to one of the names its description lists, such as HELVETICA, the default. Headers that start with CamelPdf are removed from the message first, so they cannot change what the Kamelet does.
Configuration Options
The following table summarizes the configuration options available for the pdf-action Kamelet:
| Property | Name | Description | Type | Default | Example |
|---|---|---|---|---|---|
Font | Required The font of the whole text, one of the standard PDF fonts: | string | HELVETICA | HELVETICA | |
Font Size | Required The size of the text, in points, such as | string | 14 | ||
Page Size | Required The size of the pages: Enum values: * LETTER * LEGAL * A0 * A1 * A2 * A3 * A4 * A5 * A6 | string | A4 |
Dependencies
At runtime, the pdf-action Kamelet relies upon the presence of the following dependencies:
-
camel:pdf
-
camel:kamelet
Camel JBang usage
Prerequisites
-
You’ve installed JBang.
-
You have executed the following command:
jbang app install camel@apache/camel Supposing you have a file named route.yaml with this content:
- route:
from:
uri: "kamelet:timer-source"
parameters:
period: 10000
message: 'test'
steps:
- to:
uri: "kamelet:pdf-action"
parameters:
.
.
.
- to:
uri: "kamelet:log-sink" You can now run it directly through the following command
camel run route.yaml