formatting

This commit is contained in:
Anthony Stirling
2023-12-30 19:11:27 +00:00
parent 7b43fca6fc
commit 5f771b7851
155 changed files with 5539 additions and 4767 deletions

View File

@@ -3,6 +3,7 @@ package stirling.software.SPDF.model.api;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@@ -12,6 +13,6 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
public class GeneralFile {
@Schema(description = "The input file")
private MultipartFile fileInput;
@Schema(description = "The input file")
private MultipartFile fileInput;
}

View File

@@ -3,6 +3,7 @@ package stirling.software.SPDF.model.api;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

View File

@@ -3,6 +3,7 @@ package stirling.software.SPDF.model.api;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@@ -11,6 +12,6 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@EqualsAndHashCode
public class ImageFile {
@Schema(description = "The input image file")
@Schema(description = "The input image file")
private MultipartFile fileInput;
}

View File

@@ -3,13 +3,15 @@ package stirling.software.SPDF.model.api;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@EqualsAndHashCode
public class MultiplePDFFiles {
@Schema(description = "The input PDF files", type = "array", format = "binary")
@Schema(description = "The input PDF files", type = "array", format = "binary")
private MultipartFile[] fileInput;
}

View File

@@ -1,16 +1,18 @@
package stirling.software.SPDF.model.api;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class PDFComparison extends PDFFile {
@Schema(description = "The comparison type, accepts Greater, Equal, Less than", allowableValues = {
"Greater", "Equal", "Less" })
@Schema(
description = "The comparison type, accepts Greater, Equal, Less than",
allowableValues = {"Greater", "Equal", "Less"})
private String comparator;
}

View File

@@ -1,15 +1,15 @@
package stirling.software.SPDF.model.api;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class PDFComparisonAndCount extends PDFComparison {
@Schema(description = "Count")
@Schema(description = "Count")
private String pageCount;
}

View File

@@ -3,11 +3,13 @@ package stirling.software.SPDF.model.api;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode
public class PDFFile {
@Schema(description = "The input PDF file")
@Schema(description = "The input PDF file")
private MultipartFile fileInput;
}

View File

@@ -1,14 +1,16 @@
package stirling.software.SPDF.model.api;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class PDFWithImageFormatRequest extends PDFFile {
@Schema(description = "The output image format e.g., 'png', 'jpeg', or 'gif'",
allowableValues = { "png", "jpeg", "gif" })
@Schema(
description = "The output image format e.g., 'png', 'jpeg', or 'gif'",
allowableValues = {"png", "jpeg", "gif"})
private String format;
}

View File

@@ -7,36 +7,38 @@ import org.apache.pdfbox.pdmodel.PDDocument;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import stirling.software.SPDF.utils.GeneralUtils;
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class PDFWithPageNums extends PDFFile {
@Schema(description = "The pages to select, Supports ranges (e.g., '1,3,5-9'), or 'all' or functions in the format 'an+b' where 'a' is the multiplier of the page number 'n', and 'b' is a constant (e.g., '2n+1', '3n', '6n-5')\"")
@Schema(
description =
"The pages to select, Supports ranges (e.g., '1,3,5-9'), or 'all' or functions in the format 'an+b' where 'a' is the multiplier of the page number 'n', and 'b' is a constant (e.g., '2n+1', '3n', '6n-5')\"")
private String pageNumbers;
@Hidden
public List<Integer> getPageNumbersList(){
int pageCount = 0;
try {
pageCount = PDDocument.load(getFileInput().getInputStream()).getNumberOfPages();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return GeneralUtils.parsePageString(pageNumbers, pageCount);
}
@Hidden
public List<Integer> getPageNumbersList(PDDocument doc){
int pageCount = 0;
pageCount = doc.getNumberOfPages();
return GeneralUtils.parsePageString(pageNumbers, pageCount);
}
@Hidden
public List<Integer> getPageNumbersList() {
int pageCount = 0;
try {
pageCount = PDDocument.load(getFileInput().getInputStream()).getNumberOfPages();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return GeneralUtils.parsePageString(pageNumbers, pageCount);
}
@Hidden
public List<Integer> getPageNumbersList(PDDocument doc) {
int pageCount = 0;
pageCount = doc.getNumberOfPages();
return GeneralUtils.parsePageString(pageNumbers, pageCount);
}
}

View File

@@ -1,16 +1,17 @@
package stirling.software.SPDF.model.api;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class PDFWithPageSize extends PDFFile {
@Schema(description = "The scale of pages in the output PDF. Acceptable values are A0-A6, LETTER, LEGAL.",
allowableValues = {
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "LETTER", "LEGAL"
})
private String pageSize;
@Schema(
description =
"The scale of pages in the output PDF. Acceptable values are A0-A6, LETTER, LEGAL.",
allowableValues = {"A0", "A1", "A2", "A3", "A4", "A5", "A6", "LETTER", "LEGAL"})
private String pageSize;
}

View File

@@ -1,14 +1,16 @@
package stirling.software.SPDF.model.api;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class SplitPdfBySectionsRequest extends PDFFile {
@Schema(description = "Number of horizontal divisions for each PDF page", example = "2")
@Schema(description = "Number of horizontal divisions for each PDF page", example = "2")
private int horizontalDivisions;
@Schema(description = "Number of vertical divisions for each PDF page", example = "2")

View File

@@ -1,21 +1,29 @@
package stirling.software.SPDF.model.api.converters;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class ConvertToImageRequest extends PDFFile {
@Schema(description = "The output image format", allowableValues = {"png", "jpeg", "jpg", "gif"})
@Schema(
description = "The output image format",
allowableValues = {"png", "jpeg", "jpg", "gif"})
private String imageFormat;
@Schema(description = "Choose between a single image containing all pages or separate images for each page", allowableValues = {"single", "multiple"})
@Schema(
description =
"Choose between a single image containing all pages or separate images for each page",
allowableValues = {"single", "multiple"})
private String singleOrMultiple;
@Schema(description = "The color type of the output image(s)", allowableValues = {"color", "greyscale", "blackwhite"})
@Schema(
description = "The color type of the output image(s)",
allowableValues = {"color", "greyscale", "blackwhite"})
private String colorType;
@Schema(description = "The DPI (dots per inch) for the output image(s)")

View File

@@ -3,6 +3,7 @@ package stirling.software.SPDF.model.api.converters;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -13,15 +14,18 @@ public class ConvertToPdfRequest {
@Schema(description = "The input images to be converted to a PDF file")
private MultipartFile[] fileInput;
@Schema(description = "Option to determine how the image will fit onto the page",
allowableValues = { "fillPage", "fitDocumentToImage", "maintainAspectRatio" })
@Schema(
description = "Option to determine how the image will fit onto the page",
allowableValues = {"fillPage", "fitDocumentToImage", "maintainAspectRatio"})
private String fitOption;
@Schema(description = "The color type of the output image(s)", allowableValues = {"color", "greyscale", "blackwhite"})
@Schema(
description = "The color type of the output image(s)",
allowableValues = {"color", "greyscale", "blackwhite"})
private String colorType;
@Schema(description = "Whether to automatically rotate the images to better fit the PDF page", example = "true")
@Schema(
description = "Whether to automatically rotate the images to better fit the PDF page",
example = "true")
private boolean autoRotate;
}

View File

@@ -1,14 +1,17 @@
package stirling.software.SPDF.model.api.converters;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class PdfToPresentationRequest extends PDFFile {
@Schema(description = "The output Presentation format", allowableValues = {"ppt", "pptx", "odp"})
@Schema(
description = "The output Presentation format",
allowableValues = {"ppt", "pptx", "odp"})
private String outputFormat;
}

View File

@@ -1,14 +1,17 @@
package stirling.software.SPDF.model.api.converters;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class PdfToTextOrRTFRequest extends PDFFile {
@Schema(description = "The output Text or RTF format", allowableValues = {"rtf", "txt:Text"})
@Schema(
description = "The output Text or RTF format",
allowableValues = {"rtf", "txt:Text"})
private String outputFormat;
}

View File

@@ -1,14 +1,17 @@
package stirling.software.SPDF.model.api.converters;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class PdfToWordRequest extends PDFFile {
@Schema(description = "The output Word document format", allowableValues = {"doc", "docx", "odt"})
@Schema(
description = "The output Word document format",
allowableValues = {"doc", "docx", "odt"})
private String outputFormat;
}

View File

@@ -1,6 +1,7 @@
package stirling.software.SPDF.model.api.converters;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

View File

@@ -1,18 +1,15 @@
package stirling.software.SPDF.model.api.extract;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class PDFFilePage extends PDFFile {
@Schema(description = "Number of chosen page", type = "number")
private int pageId;
}

View File

@@ -1,12 +1,13 @@
package stirling.software.SPDF.model.api.filter;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFWithPageNums;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class ContainsTextRequest extends PDFWithPageNums {
@Schema(description = "The text to check for", required = true)

View File

@@ -1,16 +1,15 @@
package stirling.software.SPDF.model.api.filter;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFComparison;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class FileSizeRequest extends PDFComparison {
@Schema(description = "File Size", required = true)
private String fileSize;
}

View File

@@ -1,15 +1,15 @@
package stirling.software.SPDF.model.api.filter;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFComparison;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class PageRotationRequest extends PDFComparison {
@Schema(description = "Rotation in degrees", required = true)
private int rotation;
}

View File

@@ -1,16 +1,15 @@
package stirling.software.SPDF.model.api.filter;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFComparison;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class PageSizeRequest extends PDFComparison {
@Schema(description = "Standard Page Size", required = true)
private String standardPageSize;
}

View File

@@ -1,18 +1,23 @@
package stirling.software.SPDF.model.api.general;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class CropPdfForm extends PDFFile {
@Schema(description = "The x-coordinate of the top-left corner of the crop area", type = "number")
@Schema(
description = "The x-coordinate of the top-left corner of the crop area",
type = "number")
private float x;
@Schema(description = "The y-coordinate of the top-left corner of the crop area", type = "number")
@Schema(
description = "The y-coordinate of the top-left corner of the crop area",
type = "number")
private float y;
@Schema(description = "The width of the crop area", type = "number")
@@ -21,4 +26,3 @@ public class CropPdfForm extends PDFFile {
@Schema(description = "The height of the crop area", type = "number")
private float height;
}

View File

@@ -1,18 +1,21 @@
package stirling.software.SPDF.model.api.general;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class MergeMultiplePagesRequest extends PDFFile {
@Schema(description = "The number of pages to fit onto a single sheet in the output PDF.",
type = "integer", allowableValues = {"2", "3", "4", "9", "16"})
@Schema(
description = "The number of pages to fit onto a single sheet in the output PDF.",
type = "integer",
allowableValues = {"2", "3", "4", "9", "16"})
private int pagesPerSheet;
@Schema(description = "Boolean for if you wish to add border around the pages")
private boolean addBorder;
}

View File

@@ -1,22 +1,24 @@
package stirling.software.SPDF.model.api.general;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.MultiplePDFFiles;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class MergePdfsRequest extends MultiplePDFFiles {
@Schema(description = "The type of sorting to be applied on the input files before merging.",
@Schema(
description = "The type of sorting to be applied on the input files before merging.",
allowableValues = {
"orderProvided",
"byFileName",
"byDateModified",
"byDateCreated",
"orderProvided",
"byFileName",
"byDateModified",
"byDateCreated",
"byPDFTitle"
},
},
defaultValue = "orderProvided")
private String sortType = "orderProvided";
}

View File

@@ -1,24 +1,34 @@
package stirling.software.SPDF.model.api.general;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper = true)
public class OverlayPdfsRequest extends PDFFile {
public class OverlayPdfsRequest extends PDFFile {
@Schema(description = "An array of PDF files to be used as overlays on the base PDF. The order in these files is applied based on the selected mode.")
@Schema(
description =
"An array of PDF files to be used as overlays on the base PDF. The order in these files is applied based on the selected mode.")
private MultipartFile[] overlayFiles;
@Schema(description = "The mode of overlaying: 'SequentialOverlay' for sequential application, 'InterleavedOverlay' for round-robin application, 'FixedRepeatOverlay' for fixed repetition based on provided counts", required = true)
@Schema(
description =
"The mode of overlaying: 'SequentialOverlay' for sequential application, 'InterleavedOverlay' for round-robin application, 'FixedRepeatOverlay' for fixed repetition based on provided counts",
required = true)
private String overlayMode;
@Schema(description = "An array of integers specifying the number of times each corresponding overlay file should be applied in the 'FixedRepeatOverlay' mode. This should match the length of the overlayFiles array.", required = false)
@Schema(
description =
"An array of integers specifying the number of times each corresponding overlay file should be applied in the 'FixedRepeatOverlay' mode. This should match the length of the overlayFiles array.",
required = false)
private int[] counts;
@Schema(description = "Overlay position 0 is Foregound, 1 is Background")
private int overlayPosition;
}

View File

@@ -1,23 +1,26 @@
package stirling.software.SPDF.model.api.general;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.SortTypes;
import stirling.software.SPDF.model.api.PDFWithPageNums;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class RearrangePagesRequest extends PDFWithPageNums {
@Schema(implementation = SortTypes.class, description = "The custom mode for page rearrangement. Valid values are:\n"
+ "REVERSE_ORDER: Reverses the order of all pages.\n"
+ "DUPLEX_SORT: Sorts pages as if all fronts were scanned then all backs in reverse (1, n, 2, n-1, ...). "
+ "BOOKLET_SORT: Arranges pages for booklet printing (last, first, second, second last, ...).\n"
+ "ODD_EVEN_SPLIT: Splits and arranges pages into odd and even numbered pages.\n"
+ "REMOVE_FIRST: Removes the first page.\n" + "REMOVE_LAST: Removes the last page.\n"
+ "REMOVE_FIRST_AND_LAST: Removes both the first and the last pages.\n")
@Schema(
implementation = SortTypes.class,
description =
"The custom mode for page rearrangement. Valid values are:\n"
+ "REVERSE_ORDER: Reverses the order of all pages.\n"
+ "DUPLEX_SORT: Sorts pages as if all fronts were scanned then all backs in reverse (1, n, 2, n-1, ...). "
+ "BOOKLET_SORT: Arranges pages for booklet printing (last, first, second, second last, ...).\n"
+ "ODD_EVEN_SPLIT: Splits and arranges pages into odd and even numbered pages.\n"
+ "REMOVE_FIRST: Removes the first page.\n"
+ "REMOVE_LAST: Removes the last page.\n"
+ "REMOVE_FIRST_AND_LAST: Removes both the first and the last pages.\n")
private String customMode;
}

View File

@@ -1,14 +1,18 @@
package stirling.software.SPDF.model.api.general;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class RotatePDFRequest extends PDFFile {
@Schema(description = "The angle by which to rotate the PDF file. This should be a multiple of 90.", example = "90")
@Schema(
description =
"The angle by which to rotate the PDF file. This should be a multiple of 90.",
example = "90")
private Integer angle;
}

View File

@@ -1,14 +1,17 @@
package stirling.software.SPDF.model.api.general;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFWithPageSize;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class ScalePagesRequest extends PDFWithPageSize {
@Schema(description = "The scale of the content on the pages of the output PDF. Acceptable values are floats.")
@Schema(
description =
"The scale of the content on the pages of the output PDF. Acceptable values are floats.")
private float scaleFactor;
}

View File

@@ -1,18 +1,26 @@
package stirling.software.SPDF.model.api.general;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class SplitPdfBySizeOrCountRequest extends PDFFile {
@Schema(description = "Determines the type of split: 0 for size, 1 for page count, 2 for document count", required = false, defaultValue = "0")
private int splitType;
@Schema(
description =
"Determines the type of split: 0 for size, 1 for page count, 2 for document count",
required = false,
defaultValue = "0")
private int splitType;
@Schema(description = "Value for split: size in MB (e.g., '10MB') or number of pages (e.g., '5')", required = false, defaultValue = "10MB")
@Schema(
description =
"Value for split: size in MB (e.g., '10MB') or number of pages (e.g., '5')",
required = false,
defaultValue = "10MB")
private String splitValue;
}

View File

@@ -1,15 +1,18 @@
package stirling.software.SPDF.model.api.misc;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFWithPageNums;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class AddPageNumbersRequest extends PDFWithPageNums {
@Schema(description = "Custom margin: small/medium/large", allowableValues = {"small", "medium", "large"})
@Schema(
description = "Custom margin: small/medium/large",
allowableValues = {"small", "medium", "large"})
private String customMargin;
@Schema(description = "Position: 1 of 9 positions", minimum = "1", maximum = "9")
@@ -21,6 +24,8 @@ public class AddPageNumbersRequest extends PDFWithPageNums {
@Schema(description = "Which pages to number, default all")
private String pagesToNumber;
@Schema(description = "Custom text: defaults to just number but can have things like \"Page {n} of {p}\"")
@Schema(
description =
"Custom text: defaults to just number but can have things like \"Page {n} of {p}\"")
private String customText;
}

View File

@@ -1,14 +1,19 @@
package stirling.software.SPDF.model.api.misc;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class AutoSplitPdfRequest extends PDFFile {
@Schema(description = "Flag indicating if the duplex mode is active, where the page after the divider also gets removed.", required = false, defaultValue = "false")
@Schema(
description =
"Flag indicating if the duplex mode is active, where the page after the divider also gets removed.",
required = false,
defaultValue = "false")
private boolean duplexMode;
}

View File

@@ -1,14 +1,19 @@
package stirling.software.SPDF.model.api.misc;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class ExtractHeaderRequest extends PDFFile {
@Schema(description = "Flag indicating whether to use the first text as a fallback if no suitable title is found. Defaults to false.", required = false, defaultValue = "false")
@Schema(
description =
"Flag indicating whether to use the first text as a fallback if no suitable title is found. Defaults to false.",
required = false,
defaultValue = "false")
private boolean useFirstTextAsFallback;
}

View File

@@ -3,6 +3,7 @@ package stirling.software.SPDF.model.api.misc;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -12,18 +13,33 @@ public class ExtractImageScansRequest {
@Schema(description = "The input file containing image scans", required = true)
private MultipartFile fileInput;
@Schema(description = "The angle threshold for the image scan extraction", defaultValue = "5", example = "5")
@Schema(
description = "The angle threshold for the image scan extraction",
defaultValue = "5",
example = "5")
private int angleThreshold = 5;
@Schema(description = "The tolerance for the image scan extraction", defaultValue = "20", example = "20")
@Schema(
description = "The tolerance for the image scan extraction",
defaultValue = "20",
example = "20")
private int tolerance = 20;
@Schema(description = "The minimum area for the image scan extraction", defaultValue = "8000", example = "8000")
@Schema(
description = "The minimum area for the image scan extraction",
defaultValue = "8000",
example = "8000")
private int minArea = 8000;
@Schema(description = "The minimum contour area for the image scan extraction", defaultValue = "500", example = "500")
@Schema(
description = "The minimum contour area for the image scan extraction",
defaultValue = "500",
example = "500")
private int minContourArea = 500;
@Schema(description = "The border size for the image scan extraction", defaultValue = "1", example = "1")
private int borderSize =1;
@Schema(
description = "The border size for the image scan extraction",
defaultValue = "1",
example = "1")
private int borderSize = 1;
}

View File

@@ -3,12 +3,13 @@ package stirling.software.SPDF.model.api.misc;
import java.util.Map;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class MetadataRequest extends PDFFile {
@Schema(description = "Delete all metadata if set to true")
@@ -41,6 +42,8 @@ public class MetadataRequest extends PDFFile {
@Schema(description = "The trapped status of the document")
private String trapped;
@Schema(description = "Map list of key and value of custom parameters. Note these must start with customKey and customValue if they are non-standard")
@Schema(
description =
"Map list of key and value of custom parameters. Note these must start with customKey and customValue if they are non-standard")
private Map<String, String> allRequestParams;
}

View File

@@ -1,16 +1,19 @@
package stirling.software.SPDF.model.api.misc;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class OptimizePdfRequest extends PDFFile {
@Schema(description = "The level of optimization to apply to the PDF file. Higher values indicate greater compression but may reduce quality.",
allowableValues = { "1", "2", "3", "4", "5" })
@Schema(
description =
"The level of optimization to apply to the PDF file. Higher values indicate greater compression but may reduce quality.",
allowableValues = {"1", "2", "3", "4", "5"})
private Integer optimizeLevel;
@Schema(description = "The expected output size, e.g. '100MB', '25KB', etc.")

View File

@@ -3,23 +3,30 @@ package stirling.software.SPDF.model.api.misc;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class OverlayImageRequest extends PDFFile {
@Schema(description = "The image file to be overlaid onto the PDF.")
private MultipartFile imageFile;
@Schema(description = "The x-coordinate at which to place the top-left corner of the image.", example = "0")
@Schema(
description = "The x-coordinate at which to place the top-left corner of the image.",
example = "0")
private float x;
@Schema(description = "The y-coordinate at which to place the top-left corner of the image.", example = "0")
@Schema(
description = "The y-coordinate at which to place the top-left corner of the image.",
example = "0")
private float y;
@Schema(description = "Whether to overlay the image onto every page of the PDF.", example = "false")
@Schema(
description = "Whether to overlay the image onto every page of the PDF.",
example = "false")
private boolean everyPage;
}

View File

@@ -3,12 +3,13 @@ package stirling.software.SPDF.model.api.misc;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class ProcessPdfWithOcrRequest extends PDFFile {
@Schema(description = "List of languages to use in OCR processing")
@@ -26,10 +27,15 @@ public class ProcessPdfWithOcrRequest extends PDFFile {
@Schema(description = "Clean the final output if set to true")
private boolean cleanFinal;
@Schema(description = "Specify the OCR type, e.g., 'skip-text', 'force-ocr', or 'Normal'", allowableValues = {"skip-text", "force-ocr", "Normal"})
@Schema(
description = "Specify the OCR type, e.g., 'skip-text', 'force-ocr', or 'Normal'",
allowableValues = {"skip-text", "force-ocr", "Normal"})
private String ocrType;
@Schema(description = "Specify the OCR render type, either 'hocr' or 'sandwich'", allowableValues = {"hocr", "sandwich"}, defaultValue = "hocr")
@Schema(
description = "Specify the OCR render type, either 'hocr' or 'sandwich'",
allowableValues = {"hocr", "sandwich"},
defaultValue = "hocr")
private String ocrRenderType = "hocr";
@Schema(description = "Remove images from the output PDF if set to true")

View File

@@ -1,17 +1,24 @@
package stirling.software.SPDF.model.api.misc;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class RemoveBlankPagesRequest extends PDFFile {
@Schema(description = "The threshold value to determine blank pages", example = "10", defaultValue = "10")
@Schema(
description = "The threshold value to determine blank pages",
example = "10",
defaultValue = "10")
private int threshold = 10;
@Schema(description = "The percentage of white color on a page to consider it as blank", example = "99.9", defaultValue = "99.9")
@Schema(
description = "The percentage of white color on a page to consider it as blank",
example = "99.9",
defaultValue = "99.9")
private float whitePercent = 99.9f;
}

View File

@@ -1,30 +1,44 @@
package stirling.software.SPDF.model.api.security;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class AddPasswordRequest extends PDFFile {
@Schema(description = "The owner password to be added to the PDF file (Restricts what can be done with the document once it is opened)", defaultValue = "")
@Schema(
description =
"The owner password to be added to the PDF file (Restricts what can be done with the document once it is opened)",
defaultValue = "")
private String ownerPassword;
@Schema(description = "The password to be added to the PDF file (Restricts the opening of the document itself.)", defaultValue = "")
@Schema(
description =
"The password to be added to the PDF file (Restricts the opening of the document itself.)",
defaultValue = "")
private String password;
@Schema(description = "The length of the encryption key", allowableValues = {"40", "128", "256"}, defaultValue = "256")
@Schema(
description = "The length of the encryption key",
allowableValues = {"40", "128", "256"},
defaultValue = "256")
private int keyLength = 256;
@Schema(description = "Whether the document assembly is allowed", example = "false")
private boolean canAssembleDocument;
@Schema(description = "Whether content extraction for accessibility is allowed", example = "false")
@Schema(
description = "Whether content extraction for accessibility is allowed",
example = "false")
private boolean canExtractContent;
@Schema(description = "Whether content extraction for accessibility is allowed", example = "false")
@Schema(
description = "Whether content extraction for accessibility is allowed",
example = "false")
private boolean canExtractForAccessibility;
@Schema(description = "Whether form filling is allowed", example = "false")

View File

@@ -3,17 +3,19 @@ package stirling.software.SPDF.model.api.security;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class AddWatermarkRequest extends PDFFile {
@Schema(description = "The watermark type (text or image)",
allowableValues = {"text", "image"},
required = true)
@Schema(
description = "The watermark type (text or image)",
allowableValues = {"text", "image"},
required = true)
private String watermarkType;
@Schema(description = "The watermark text")
@@ -22,8 +24,9 @@ public class AddWatermarkRequest extends PDFFile {
@Schema(description = "The watermark image")
private MultipartFile watermarkImage;
@Schema(description = "The selected alphabet",
allowableValues = {"roman", "arabic", "japanese", "korean", "chinese"},
@Schema(
description = "The selected alphabet",
allowableValues = {"roman", "arabic", "japanese", "korean", "chinese"},
defaultValue = "roman")
private String alphabet = "roman";

View File

@@ -1,12 +1,13 @@
package stirling.software.SPDF.model.api.security;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class PDFPasswordRequest extends PDFFile {
@Schema(description = "The password of the PDF file", required = true)

View File

@@ -1,12 +1,13 @@
package stirling.software.SPDF.model.api.security;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class RedactPdfRequest extends PDFFile {
@Schema(description = "List of text to redact from the PDF", type = "string", required = true)

View File

@@ -1,12 +1,13 @@
package stirling.software.SPDF.model.api.security;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class SanitizePdfRequest extends PDFFile {
@Schema(description = "Remove JavaScript actions from the PDF", defaultValue = "false")

View File

@@ -3,18 +3,23 @@ package stirling.software.SPDF.model.api.security;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import stirling.software.SPDF.model.api.PDFFile;
@Data
@EqualsAndHashCode(callSuper=true)
@EqualsAndHashCode(callSuper = true)
public class SignPDFWithCertRequest extends PDFFile {
@Schema(description = "The type of the digital certificate", allowableValues = { "PKCS12", "PEM" })
@Schema(
description = "The type of the digital certificate",
allowableValues = {"PKCS12", "PEM"})
private String certType;
@Schema(description = "The private key for the digital certificate (required for PEM type certificates)")
@Schema(
description =
"The private key for the digital certificate (required for PEM type certificates)")
private MultipartFile privateKeyFile;
@Schema(description = "The digital certificate (required for PEM type certificates)")
@@ -38,6 +43,8 @@ public class SignPDFWithCertRequest extends PDFFile {
@Schema(description = "The name of the signer")
private String name;
@Schema(description = "The page number where the signature should be visible. This is required if showSignature is set to true")
@Schema(
description =
"The page number where the signature should be visible. This is required if showSignature is set to true")
private Integer pageNumber;
}