Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.

PDF

Available as of Camel 2.16.0

The PDF: components provides the ability to create, modify or extract content from PDF documents. This component uses Apache PDFBox as underlying library to work with PDF documents.

In order to use the PDF component, Maven users will need to add the following dependency to their pom.xml:

pom.xml
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-pdf</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

URI format

The PDF component only supports producer endpoints.

pdf:operation[?options]

Where operation is the specific action to perform with PDF document.

Operations

OperationDescription
createCreates new PDF documents with the given text. With this operation message body type should be String. The output type of this operation is OutputStream.
appendAppends text to PDF document. Text will start on the new page. With this operation message body type should be String. Mandatory header with name "pdf-document" and  PDFBox document as value expected. The output type of this operation is OutputStream.
extractTextExtracts text from PDF document. The output type of this operation is String.

Options

NameDefault ValueDescription

marginTop

20

Sets the margin size in pixels between text and top edge of the page. 

marginBottom

20

Sets the margin size in pixels between text and bottom edge of the page.

marginLeft

20

Sets the margin size in pixels between text and left edge of the page.

marginRight

40

Sets the margin size in pixels between text and right edge of the page. This option is ignored when textProcessingFactory option is lineTermination.

fontSize

14

Sets the font size in pixels.

pageSize

PAGE_SIZE_A4

Sets the size of a page. Possible values

  • PAGE_SIZE_A0
  • PAGE_SIZE_A1
  • PAGE_SIZE_A2
  • PAGE_SIZE_A3
  • PAGE_SIZE_A4
  • PAGE_SIZE_A5
  • PAGE_SIZE_A6
  • PAGE_SIZE_LETTER

font

Helvetica

One of the base fonts in PDFBox.

textProcessingFactory

lineTermination

Sets the text processing factory.  lineTermination - builds set of classes for line-termination writing strategy. Text getting sliced by line termination symbol and then it will be written regardless it fits in the line or not. autoFormatting - Text is getting sliced by words, then maximum amount of words that fits in the line will be written into PDF document. With this strategy all words that doesn't fit in the line will be moved to the new line.

Headers

Header 

pdf-document

Mandatory header for append operation and ignored in all other operations. Expected type is PDDocument. Stores PDF document which will be used for append operation.

protection-policy

Expected type is ProtectionPolicy. If specified then PDF document will be encrypted with it.

decryption-material

Expected type is DecryptionMaterial. Mandatory header if PDF document is encrypted.

 
© 2004-2015 The Apache Software Foundation.
Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram