This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new fc70dacc14d CAMEL-21094 - Merge multiple PDF files (#15216)
fc70dacc14d is described below
commit fc70dacc14d4280fdf86d24650da061884ad0c13
Author: Alexandre Davi Zanelatto <[email protected]>
AuthorDate: Tue Aug 20 06:54:09 2024 -0300
CAMEL-21094 - Merge multiple PDF files (#15216)
* CAMEL-21094 - Merge multiple PDF files
* CAMEL-21094 - Auto generated files
* CAMEL-21094 - Code review improvements
* CAMEL-21094 - Code review improvements
* Revert "CAMEL-21094 - Code review improvements"
This reverts commit 27f2826c0135e98ab622e9b12605b1303fd3169a.
* Revert "CAMEL-21094 - Auto generated files"
This reverts commit ad2186c7dbc2026a96e19700a5e44a3fa7b76f0b.
* Regen
---------
Co-authored-by: Alexandre Zanelatto <[email protected]>
Co-authored-by: Claus Ibsen <[email protected]>
---
.../org/apache/camel/catalog/components/pdf.json | 5 +-
.../org/apache/camel/component/pdf/pdf.json | 5 +-
.../camel/component/pdf/PdfHeaderConstants.java | 8 ++
.../apache/camel/component/pdf/PdfOperation.java | 3 +-
.../apache/camel/component/pdf/PdfProducer.java | 28 ++++++-
.../apache/camel/component/pdf/PdfMergeTest.java | 92 ++++++++++++++++++++++
.../builder/endpoint/StaticEndpointBuilders.java | 8 +-
.../endpoint/dsl/PdfEndpointBuilderFactory.java | 21 ++++-
8 files changed, 154 insertions(+), 16 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pdf.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pdf.json
index 885e95f3209..735326ae50b 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pdf.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pdf.json
@@ -29,10 +29,11 @@
"headers": {
"protection-policy": { "index": 0, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType":
"org.apache.pdfbox.pdmodel.encryption.ProtectionPolicy", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "description":
"Expected type is
https:\/\/pdfbox.apache.org\/docs\/2.0.13\/javadocs\/org\/apache\/pdfbox\/pdmodel\/encryption\/ProtectionPolicy.htmlProtectionPolicy.
If specified then PDF document will be encrypt [...]
"pdf-document": { "index": 1, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType":
"org.apache.pdfbox.pdmodel.PDDocument", "deprecated": false, "deprecationNote":
"", "autowired": false, "secret": false, "description": "Mandatory header for
append operation and ignored in all other operations. Expected type is
https:\/\/pdfbox.apache.org\/docs\/2.0.13\/javadocs\/org\/apache\/pdfbox\/pdmodel\/PDDocument.htmlPDDocument.
Stores PDF docume [...]
- "decryption-material": { "index": 2, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType":
"org.apache.pdfbox.pdmodel.encryption.DecryptionMaterial", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "description":
"Expected type is
https:\/\/pdfbox.apache.org\/docs\/2.0.13\/javadocs\/org\/apache\/pdfbox\/pdmodel\/encryption\/DecryptionMaterial.htmlDecryptionMaterial.
Mandatory header if PDF document is en [...]
+ "decryption-material": { "index": 2, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType":
"org.apache.pdfbox.pdmodel.encryption.DecryptionMaterial", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "description":
"Expected type is
https:\/\/pdfbox.apache.org\/docs\/2.0.13\/javadocs\/org\/apache\/pdfbox\/pdmodel\/encryption\/DecryptionMaterial.htmlDecryptionMaterial.
Mandatory header if PDF document is en [...]
+ "files-to-merge": { "index": 3, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType":
"java.util.List<java.io.File>", "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "description": "Mandatory header for merge
operation and ignored in all other operations. The array of pdf files that will
be merged.", "constantName":
"org.apache.camel.component.pdf.PdfHeaderConstants#FILES_TO_MERGE_HEADER_NAME" }
},
"properties": {
- "operation": { "index": 0, "kind": "path", "displayName": "Operation",
"group": "producer", "label": "", "required": true, "type": "object",
"javaType": "org.apache.camel.component.pdf.PdfOperation", "enum": [ "create",
"append", "extractText" ], "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.pdf.PdfConfiguration", "configurationField":
"pdfConfiguration", "description": "Operation type" },
+ "operation": { "index": 0, "kind": "path", "displayName": "Operation",
"group": "producer", "label": "", "required": true, "type": "object",
"javaType": "org.apache.camel.component.pdf.PdfOperation", "enum": [ "create",
"append", "extractText", "merge" ], "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.pdf.PdfConfiguration", "configurationField":
"pdfConfiguration", "description": "Operation type" },
"font": { "index": 1, "kind": "parameter", "displayName": "Font", "group":
"producer", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "enum": [ "COURIER", "COURIER_BOLD", "COURIER_OBLIQUE",
"COURIER_BOLD_OBLIQUE", "HELVETICA", "HELVETICA_BOLD", "HELVETICA_OBLIQUE",
"HELVETICA_BOLD_OBLIQUE", "TIMES_ROMAN", "TIMES_BOLD", "TIMES_ITALIC",
"TIMES_BOLD_ITALIC", "SYMBOL", "ZAPF_DINGBATS" ], "deprecated": false,
"autowired": false, "secret": false, "default [...]
"fontSize": { "index": 2, "kind": "parameter", "displayName": "Font Size",
"group": "producer", "label": "", "required": false, "type": "number",
"javaType": "float", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 14.0, "configurationClass":
"org.apache.camel.component.pdf.PdfConfiguration", "configurationField":
"pdfConfiguration", "description": "Font size in pixels" },
"marginBottom": { "index": 3, "kind": "parameter", "displayName": "Margin
Bottom", "group": "producer", "label": "", "required": false, "type":
"integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 20, "configurationClass":
"org.apache.camel.component.pdf.PdfConfiguration", "configurationField":
"pdfConfiguration", "description": "Margin bottom in pixels" },
diff --git
a/components/camel-pdf/src/generated/resources/META-INF/org/apache/camel/component/pdf/pdf.json
b/components/camel-pdf/src/generated/resources/META-INF/org/apache/camel/component/pdf/pdf.json
index 885e95f3209..735326ae50b 100644
---
a/components/camel-pdf/src/generated/resources/META-INF/org/apache/camel/component/pdf/pdf.json
+++
b/components/camel-pdf/src/generated/resources/META-INF/org/apache/camel/component/pdf/pdf.json
@@ -29,10 +29,11 @@
"headers": {
"protection-policy": { "index": 0, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType":
"org.apache.pdfbox.pdmodel.encryption.ProtectionPolicy", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "description":
"Expected type is
https:\/\/pdfbox.apache.org\/docs\/2.0.13\/javadocs\/org\/apache\/pdfbox\/pdmodel\/encryption\/ProtectionPolicy.htmlProtectionPolicy.
If specified then PDF document will be encrypt [...]
"pdf-document": { "index": 1, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType":
"org.apache.pdfbox.pdmodel.PDDocument", "deprecated": false, "deprecationNote":
"", "autowired": false, "secret": false, "description": "Mandatory header for
append operation and ignored in all other operations. Expected type is
https:\/\/pdfbox.apache.org\/docs\/2.0.13\/javadocs\/org\/apache\/pdfbox\/pdmodel\/PDDocument.htmlPDDocument.
Stores PDF docume [...]
- "decryption-material": { "index": 2, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType":
"org.apache.pdfbox.pdmodel.encryption.DecryptionMaterial", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "description":
"Expected type is
https:\/\/pdfbox.apache.org\/docs\/2.0.13\/javadocs\/org\/apache\/pdfbox\/pdmodel\/encryption\/DecryptionMaterial.htmlDecryptionMaterial.
Mandatory header if PDF document is en [...]
+ "decryption-material": { "index": 2, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType":
"org.apache.pdfbox.pdmodel.encryption.DecryptionMaterial", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "description":
"Expected type is
https:\/\/pdfbox.apache.org\/docs\/2.0.13\/javadocs\/org\/apache\/pdfbox\/pdmodel\/encryption\/DecryptionMaterial.htmlDecryptionMaterial.
Mandatory header if PDF document is en [...]
+ "files-to-merge": { "index": 3, "kind": "header", "displayName": "",
"group": "producer", "label": "", "required": false, "javaType":
"java.util.List<java.io.File>", "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "description": "Mandatory header for merge
operation and ignored in all other operations. The array of pdf files that will
be merged.", "constantName":
"org.apache.camel.component.pdf.PdfHeaderConstants#FILES_TO_MERGE_HEADER_NAME" }
},
"properties": {
- "operation": { "index": 0, "kind": "path", "displayName": "Operation",
"group": "producer", "label": "", "required": true, "type": "object",
"javaType": "org.apache.camel.component.pdf.PdfOperation", "enum": [ "create",
"append", "extractText" ], "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.pdf.PdfConfiguration", "configurationField":
"pdfConfiguration", "description": "Operation type" },
+ "operation": { "index": 0, "kind": "path", "displayName": "Operation",
"group": "producer", "label": "", "required": true, "type": "object",
"javaType": "org.apache.camel.component.pdf.PdfOperation", "enum": [ "create",
"append", "extractText", "merge" ], "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.pdf.PdfConfiguration", "configurationField":
"pdfConfiguration", "description": "Operation type" },
"font": { "index": 1, "kind": "parameter", "displayName": "Font", "group":
"producer", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "enum": [ "COURIER", "COURIER_BOLD", "COURIER_OBLIQUE",
"COURIER_BOLD_OBLIQUE", "HELVETICA", "HELVETICA_BOLD", "HELVETICA_OBLIQUE",
"HELVETICA_BOLD_OBLIQUE", "TIMES_ROMAN", "TIMES_BOLD", "TIMES_ITALIC",
"TIMES_BOLD_ITALIC", "SYMBOL", "ZAPF_DINGBATS" ], "deprecated": false,
"autowired": false, "secret": false, "default [...]
"fontSize": { "index": 2, "kind": "parameter", "displayName": "Font Size",
"group": "producer", "label": "", "required": false, "type": "number",
"javaType": "float", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 14.0, "configurationClass":
"org.apache.camel.component.pdf.PdfConfiguration", "configurationField":
"pdfConfiguration", "description": "Font size in pixels" },
"marginBottom": { "index": 3, "kind": "parameter", "displayName": "Margin
Bottom", "group": "producer", "label": "", "required": false, "type":
"integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 20, "configurationClass":
"org.apache.camel.component.pdf.PdfConfiguration", "configurationField":
"pdfConfiguration", "description": "Margin bottom in pixels" },
diff --git
a/components/camel-pdf/src/main/java/org/apache/camel/component/pdf/PdfHeaderConstants.java
b/components/camel-pdf/src/main/java/org/apache/camel/component/pdf/PdfHeaderConstants.java
index 25dfc3dbb53..037644939fa 100644
---
a/components/camel-pdf/src/main/java/org/apache/camel/component/pdf/PdfHeaderConstants.java
+++
b/components/camel-pdf/src/main/java/org/apache/camel/component/pdf/PdfHeaderConstants.java
@@ -39,6 +39,14 @@ public final class PdfHeaderConstants {
javaType =
"org.apache.pdfbox.pdmodel.encryption.DecryptionMaterial")
public static final String DECRYPTION_MATERIAL_HEADER_NAME =
"decryption-material";
+ @Metadata(description = """
+ *Mandatory* header for `merge` operation and ignored in all other
+ operations.
+ The array of pdf files that will be merged.
+ """,
+ javaType = "java.util.List<java.io.File>")
+ public static final String FILES_TO_MERGE_HEADER_NAME = "files-to-merge";
+
private PdfHeaderConstants() {
}
diff --git
a/components/camel-pdf/src/main/java/org/apache/camel/component/pdf/PdfOperation.java
b/components/camel-pdf/src/main/java/org/apache/camel/component/pdf/PdfOperation.java
index a6ca6a4f8da..6bf427d731b 100644
---
a/components/camel-pdf/src/main/java/org/apache/camel/component/pdf/PdfOperation.java
+++
b/components/camel-pdf/src/main/java/org/apache/camel/component/pdf/PdfOperation.java
@@ -19,5 +19,6 @@ package org.apache.camel.component.pdf;
public enum PdfOperation {
create,
append,
- extractText
+ extractText,
+ merge
}
diff --git
a/components/camel-pdf/src/main/java/org/apache/camel/component/pdf/PdfProducer.java
b/components/camel-pdf/src/main/java/org/apache/camel/component/pdf/PdfProducer.java
index 280dc396fa2..3b8efe38110 100644
---
a/components/camel-pdf/src/main/java/org/apache/camel/component/pdf/PdfProducer.java
+++
b/components/camel-pdf/src/main/java/org/apache/camel/component/pdf/PdfProducer.java
@@ -16,12 +16,12 @@
*/
package org.apache.camel.component.pdf;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
+import java.io.*;
import java.util.Collection;
+import java.util.List;
import org.apache.camel.Exchange;
+import org.apache.camel.NoSuchHeaderException;
import org.apache.camel.component.pdf.text.AutoFormattedWriterAbstractFactory;
import org.apache.camel.component.pdf.text.LineBuilderStrategy;
import
org.apache.camel.component.pdf.text.LineTerminationWriterAbstractFactory;
@@ -29,6 +29,9 @@ import org.apache.camel.component.pdf.text.SplitStrategy;
import org.apache.camel.component.pdf.text.TextProcessingAbstractFactory;
import org.apache.camel.component.pdf.text.WriteStrategy;
import org.apache.camel.support.DefaultProducer;
+import org.apache.camel.support.ExchangeHelper;
+import org.apache.pdfbox.io.RandomAccessStreamCacheImpl;
+import org.apache.pdfbox.multipdf.PDFMergerUtility;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.encryption.ProtectionPolicy;
import org.apache.pdfbox.pdmodel.encryption.StandardProtectionPolicy;
@@ -69,6 +72,9 @@ public class PdfProducer extends DefaultProducer {
case extractText:
result = doExtractText(exchange);
break;
+ case merge:
+ result = doMerge(exchange);
+ break;
default:
throw new IllegalArgumentException(String.format("Unknown
operation %s", pdfConfiguration.getOperation()));
}
@@ -78,6 +84,22 @@ public class PdfProducer extends DefaultProducer {
exchange.getMessage().setBody(result);
}
+ private OutputStream doMerge(Exchange exchange) throws IOException,
NoSuchHeaderException {
+ LOG.debug("Got {} operation, going to merge multiple files into a
single pdf document.",
+ pdfConfiguration.getOperation());
+ PDFMergerUtility mergerUtility = new PDFMergerUtility();
+ List<File> files = ExchangeHelper.getMandatoryHeader(exchange,
FILES_TO_MERGE_HEADER_NAME, List.class);
+ if (files.size() < 2) {
+ throw new IllegalArgumentException("Must provide at least 2 files
to merge");
+ }
+ for (File file : files) {
+ mergerUtility.addSource(file);
+ }
+ mergerUtility.setDestinationStream(new ByteArrayOutputStream());
+ mergerUtility.mergeDocuments(RandomAccessStreamCacheImpl::new);
+ return mergerUtility.getDestinationStream();
+ }
+
private Object doAppend(Exchange exchange) throws IOException {
LOG.debug("Got {} operation, going to append text to provided pdf.",
pdfConfiguration.getOperation());
String body = exchange.getIn().getBody(String.class);
diff --git
a/components/camel-pdf/src/test/java/org/apache/camel/component/pdf/PdfMergeTest.java
b/components/camel-pdf/src/test/java/org/apache/camel/component/pdf/PdfMergeTest.java
new file mode 100644
index 00000000000..8a19985fba8
--- /dev/null
+++
b/components/camel-pdf/src/test/java/org/apache/camel/component/pdf/PdfMergeTest.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pdf;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.pdfbox.Loader;
+import org.apache.pdfbox.io.RandomAccessReadBuffer;
+import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.text.PDFTextStripper;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class PdfMergeTest extends CamelTestSupport {
+
+ @EndpointInject("mock:result")
+ protected MockEndpoint resultEndpoint;
+
+ @Test
+ public void testMerge() throws Exception {
+ final String pdf1 = "PDF 1 text";
+ PDDocument document1 = PDFUtil.textToPDF(pdf1);
+ File pdfFile1 = File.createTempFile("pdf1", "pdf");
+ document1.save(pdfFile1);
+ final String pdf2 = "PDF 2 text";
+ PDDocument document2 = PDFUtil.textToPDF(pdf2);
+ File pdfFile2 = File.createTempFile("pdf2", "pdf");
+ document2.save(pdfFile2);
+
+ template.sendBodyAndHeader("direct:start", "",
PdfHeaderConstants.FILES_TO_MERGE_HEADER_NAME,
+ List.of(pdfFile1, pdfFile2));
+
+ resultEndpoint.setExpectedMessageCount(1);
+ resultEndpoint.expectedMessagesMatches(exchange -> {
+ Object body = exchange.getIn().getBody();
+ assertThat(body, instanceOf(ByteArrayOutputStream.class));
+ try {
+ PDDocument doc = Loader.loadPDF(
+ new RandomAccessReadBuffer(new
ByteArrayInputStream(((ByteArrayOutputStream) body).toByteArray())));
+ PDFTextStripper pdfTextStripper = new PDFTextStripper();
+ String text = pdfTextStripper.getText(doc);
+ assertEquals(2, doc.getNumberOfPages());
+ assertThat(text, containsString("PDF 1 text"));
+ assertThat(text, containsString("PDF 2 text"));
+ } catch (IOException e) {
+ throw new RuntimeCamelException(e);
+ }
+ return true;
+ });
+ resultEndpoint.assertIsSatisfied();
+
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:start")
+ .to("pdf:merge")
+ .to("mock:result");
+ }
+ };
+ }
+}
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
index 616849c475f..7fba274e5ed 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
@@ -11338,8 +11338,8 @@ public class StaticEndpointBuilders {
*
* Path parameter: operation (required)
* Operation type
- * There are 3 enums and the value can be one of: create, append,
- * extractText
+ * There are 4 enums and the value can be one of: create, append,
+ * extractText, merge
*
* @param path operation
* @return the dsl builder
@@ -11359,8 +11359,8 @@ public class StaticEndpointBuilders {
*
* Path parameter: operation (required)
* Operation type
- * There are 3 enums and the value can be one of: create, append,
- * extractText
+ * There are 4 enums and the value can be one of: create, append,
+ * extractText, merge
*
* @param componentName to use a custom component name for the endpoint
* instead of the default name
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PdfEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PdfEndpointBuilderFactory.java
index 5caba7e56ca..b65fa5b46fc 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PdfEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PdfEndpointBuilderFactory.java
@@ -356,8 +356,8 @@ public interface PdfEndpointBuilderFactory {
*
* Path parameter: operation (required)
* Operation type
- * There are 3 enums and the value can be one of: create, append,
- * extractText
+ * There are 4 enums and the value can be one of: create, append,
+ * extractText, merge
*
* @param path operation
* @return the dsl builder
@@ -377,8 +377,8 @@ public interface PdfEndpointBuilderFactory {
*
* Path parameter: operation (required)
* Operation type
- * There are 3 enums and the value can be one of: create, append,
- * extractText
+ * There are 4 enums and the value can be one of: create, append,
+ * extractText, merge
*
* @param componentName to use a custom component name for the endpoint
* instead of the default name
@@ -442,6 +442,19 @@ public interface PdfEndpointBuilderFactory {
public String decryptionMaterial() {
return "decryption-material";
}
+ /**
+ * Mandatory header for merge operation and ignored in all other
+ * operations. The array of pdf files that will be merged.
+ *
+ * The option is a: {@code java.util.List<java.io.File>} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code files-to-merge}.
+ */
+ public String filesToMerge() {
+ return "files-to-merge";
+ }
}
static PdfEndpointBuilder endpointBuilder(String componentName, String
path) {
class PdfEndpointBuilderImpl extends AbstractEndpointBuilder
implements PdfEndpointBuilder, AdvancedPdfEndpointBuilder {