-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pdf-engines): add conversion properties and options
- Loading branch information
Showing
3 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/main/java/dev/inaka/pdfengines/PDFEnginesConversionOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package dev.inaka.pdfengines; | ||
|
||
/** | ||
* The PDFEnginesConversionOptions class is used to configure LibreOffice conversion options. | ||
*/ | ||
public final class PDFEnginesConversionOptions extends PDFEnginesOptions { | ||
|
||
private PDFEnginesConversionOptions(Builder builder) { | ||
super(builder); | ||
} | ||
|
||
/** | ||
* The Builder class is used to construct instances of PDFEnginesConversionOptions with specific configuration options. | ||
*/ | ||
public static class Builder extends PDFEnginesOptions.Builder<PDFEnginesConversionOptions> { | ||
|
||
@Override | ||
public PDFEnginesConversionOptions build() { | ||
return new PDFEnginesConversionOptions(this); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/dev/inaka/pdfengines/PDFEnginesMergeOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package dev.inaka.pdfengines; | ||
|
||
import org.json.JSONObject; | ||
|
||
/** | ||
* The PDFEnginesMergeOptions class is used to configure LibreOffice conversion options. | ||
*/ | ||
public final class PDFEnginesMergeOptions extends PDFEnginesOptions { | ||
private final String metadata; | ||
|
||
private PDFEnginesMergeOptions(Builder builder) { | ||
super(builder); | ||
metadata = builder.metadata; | ||
} | ||
|
||
/** | ||
* The Builder class is used to construct instances of PDFEnginesMergeOptions with specific configuration options. | ||
*/ | ||
public static class Builder extends PDFEnginesOptions.Builder<PDFEnginesMergeOptions> { | ||
private String metadata = null; | ||
|
||
/** | ||
* Sets the metadata to be used by PDF Engines. | ||
* | ||
* @param metadata The metadata. | ||
* @return The Builder instance for method chaining. | ||
*/ | ||
public Builder addMetadata(JSONObject metadata) { | ||
this.metadata = String.valueOf(metadata); | ||
return this; | ||
} | ||
|
||
@Override | ||
public PDFEnginesMergeOptions build() { | ||
return new PDFEnginesMergeOptions(this); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package dev.inaka.pdfengines; | ||
|
||
import dev.inaka.common.PdfFormat; | ||
|
||
/** | ||
* The PDFEnginesOptions class is used to configure LibreOffice conversion options. | ||
*/ | ||
public abstract class PDFEnginesOptions { | ||
protected final String pdfa; | ||
protected final String pdfua; | ||
|
||
protected PDFEnginesOptions(Builder builder) { | ||
pdfa = builder.pdfa; | ||
pdfua = builder.pdfua; | ||
} | ||
|
||
/** | ||
* The Builder class is used to construct instances of PDFEnginesOptions with specific configuration options. | ||
*/ | ||
public static abstract class Builder<T extends PDFEnginesOptions> { | ||
protected String pdfa = null; | ||
protected String pdfua = "false"; | ||
|
||
/** | ||
* Sets the PDF/A format to be used by PDF Engines. | ||
* | ||
* @param pdfa The PDF/A format. | ||
* @return The Builder instance for method chaining. | ||
*/ | ||
public Builder<T> addPdfa(PdfFormat pdfa) { | ||
this.pdfa = String.valueOf(pdfa); | ||
return this; | ||
} | ||
|
||
/** | ||
* Sets whether to use PDF/UA. | ||
* | ||
* @param pdfua Whether to use PDF/UA. | ||
* @return The Builder instance for method chaining. | ||
*/ | ||
public Builder<T> addPdfua(String pdfua) { | ||
this.pdfua = pdfua; | ||
return this; | ||
} | ||
|
||
/** | ||
* Builds and returns an instance of PDFEnginesOptions with the configured options. | ||
* | ||
* @return An instance of PDFEnginesOptions with the configured options. | ||
*/ | ||
public abstract T build(); | ||
} | ||
} | ||
|