Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/camel-pdf/src/main/docs/pdf-component.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ with the following path and query parameters:
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
| *font* (producer) | Font | Helvetica | PDFont
| *font* (producer) | Font | Helvetica | String
| *fontSize* (producer) | Font size in pixels | 14 | float
| *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean
| *marginBottom* (producer) | Margin bottom in pixels | 20 | int
| *marginLeft* (producer) | Margin left in pixels | 20 | int
| *marginRight* (producer) | Margin right in pixels | 40 | int
| *marginTop* (producer) | Margin top in pixels | 20 | int
| *pageSize* (producer) | Page size | A4 | PDRectangle
| *pageSize* (producer) | Page size | A4 | String
| *textProcessingFactory* (producer) | Text processing to use. autoFormatting: Text is getting sliced by words, then max 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. 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. | lineTermination | TextProcessingFactory
| *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.camel.spi.UriPath;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.font.PDFont;
import org.apache.pdfbox.pdmodel.font.PDType1Font;

import static org.apache.camel.component.pdf.PdfPageSizeConstant.PAGE_SIZE_A0;
import static org.apache.camel.component.pdf.PdfPageSizeConstant.PAGE_SIZE_A1;
Expand Down Expand Up @@ -68,9 +67,12 @@ public class PdfConfiguration {
@UriParam(defaultValue = "14")
private float fontSize = 14;
@UriParam(defaultValue = "A4", enums = "LETTER,LEGAL,A0,A1,A2,A3,A4,A5,A6")
private PDRectangle pageSize = PDRectangle.A4;
@UriParam(defaultValue = "Helvetica")
private PDFont font = PDType1Font.HELVETICA;
private String pageSize = PAGE_SIZE_A4;
@UriParam(defaultValue = "Helvetica", enums = "Courier,Courier-Bold,Courier-Oblique,Courier-BoldOblique,"
+ "Helvetica,Helvetica-Bold,Helvetica-Oblique,Helvetica-BoldOblique,"
+ "Times-Roman,Times-Bold,Times-Italic,Times-BoldItalic,"
+ "Symbol,ZapfDingbats")
private String font = "Helvetica";
@UriParam(defaultValue = "lineTermination")
private TextProcessingFactory textProcessingFactory = TextProcessingFactory.lineTermination;

Expand Down Expand Up @@ -142,33 +144,25 @@ public void setFontSize(float fontSize) {
}

public PDRectangle getPageSize() {
return pageSize;
return PAGE_MAP.get(pageSize);
}

/**
* Page size
*/
public void setPageSize(PDRectangle pageSize) {
this.pageSize = pageSize;
}

public void setPageSize(String pageSize) {
setPageSize(PAGE_MAP.get(pageSize));
this.pageSize = pageSize;
}

public PDFont getFont() {
return font;
return Standard14Fonts.getByName(font);
}

/**
* Font
*/
public void setFont(PDFont font) {
this.font = font;
}

public void setFont(String font) {
setFont(Standard14Fonts.getByName(font));
this.font = font;
}

public TextProcessingFactory getTextProcessingFactory() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ protected RouteBuilder createRouteBuilder() throws Exception {
@Override
public void configure() throws Exception {
from("direct:start")
.to("pdf:create")
.to("pdf:create?font=Courier&pageSize=PAGE_SIZE_A1")
.to("mock:result");
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,7 @@ default AdvancedPdfEndpointBuilder advanced() {
/**
* Font.
*
* The option is a: <code>org.apache.pdfbox.pdmodel.font.PDFont</code>
* type.
*
* Default: Helvetica
* Group: producer
*/
default PdfEndpointBuilder font(Object font) {
doSetProperty("font", font);
return this;
}
/**
* Font.
*
* The option will be converted to a
* <code>org.apache.pdfbox.pdmodel.font.PDFont</code> type.
* The option is a: <code>java.lang.String</code> type.
*
* Default: Helvetica
* Group: producer
Expand Down Expand Up @@ -227,21 +213,7 @@ default PdfEndpointBuilder marginTop(String marginTop) {
/**
* Page size.
*
* The option is a:
* <code>org.apache.pdfbox.pdmodel.common.PDRectangle</code> type.
*
* Default: A4
* Group: producer
*/
default PdfEndpointBuilder pageSize(Object pageSize) {
doSetProperty("pageSize", pageSize);
return this;
}
/**
* Page size.
*
* The option will be converted to a
* <code>org.apache.pdfbox.pdmodel.common.PDRectangle</code> type.
* The option is a: <code>java.lang.String</code> type.
*
* Default: A4
* Group: producer
Expand Down
4 changes: 2 additions & 2 deletions docs/components/modules/ROOT/pages/pdf-component.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ with the following path and query parameters:
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
| *font* (producer) | Font | Helvetica | PDFont
| *font* (producer) | Font | Helvetica | String
| *fontSize* (producer) | Font size in pixels | 14 | float
| *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean
| *marginBottom* (producer) | Margin bottom in pixels | 20 | int
| *marginLeft* (producer) | Margin left in pixels | 20 | int
| *marginRight* (producer) | Margin right in pixels | 40 | int
| *marginTop* (producer) | Margin top in pixels | 20 | int
| *pageSize* (producer) | Page size | A4 | PDRectangle
| *pageSize* (producer) | Page size | A4 | String
| *textProcessingFactory* (producer) | Text processing to use. autoFormatting: Text is getting sliced by words, then max 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. 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. | lineTermination | TextProcessingFactory
| *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
Expand Down