finishing forms

This commit is contained in:
Anthony Stirling
2023-09-10 01:10:24 +01:00
parent 145e8006f0
commit 1f4aae9249
22 changed files with 403 additions and 179 deletions

View File

@@ -0,0 +1,15 @@
package stirling.software.SPDF.model.api;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
@Data
public class HandleDataRequest {
@Schema(description = "The input files")
private MultipartFile[] fileInputs;
@Schema(description = "JSON String")
private String jsonString;
}

View File

@@ -0,0 +1,26 @@
package stirling.software.SPDF.model.api.misc;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import stirling.software.SPDF.model.api.PDFWithPageNums;
import org.springframework.web.multipart.MultipartFile;
@Data
public class AddPageNumbersRequest extends PDFWithPageNums {
@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")
private int position;
@Schema(description = "Starting number", minimum = "1")
private int startingNumber;
@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}\"")
private String customText;
}

View File

@@ -0,0 +1,23 @@
package stirling.software.SPDF.model.api.misc;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import stirling.software.SPDF.model.api.PDFFile;
import org.springframework.web.multipart.MultipartFile;
@Data
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")
private float x;
@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")
private boolean everyPage;
}

View File

@@ -0,0 +1,36 @@
package stirling.software.SPDF.model.api.misc;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import stirling.software.SPDF.model.api.PDFFile;
import java.util.List;
@Data
public class ProcessPdfWithOcrRequest extends PDFFile {
@Schema(description = "List of languages to use in OCR processing")
private List<String> selectedLanguages;
@Schema(description = "Include OCR text in a sidecar text file if set to true")
private Boolean sidecar;
@Schema(description = "Deskew the input file if set to true")
private Boolean deskew;
@Schema(description = "Clean the input file if set to true")
private Boolean clean;
@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"})
private String ocrType;
@Schema(description = "Specify the OCR render type, either 'hocr' or 'sandwich'", allowableValues = {"hocr", "sandwich"}, defaultValue = "hocr")
private String ocrRenderType;
@Schema(description = "Remove images from the output PDF if set to true")
private Boolean removeImagesAfter;
}

View File

@@ -0,0 +1,43 @@
package stirling.software.SPDF.model.api.security;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import stirling.software.SPDF.model.api.PDFFile;
@Data
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 = "")
private String ownerPassword;
@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")
private int keyLength;
@Schema(description = "Whether the document assembly is allowed", example = "false")
private boolean canAssembleDocument;
@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")
private boolean canExtractForAccessibility;
@Schema(description = "Whether form filling is allowed", example = "false")
private boolean canFillInForm;
@Schema(description = "Whether the document modification is allowed", example = "false")
private boolean canModify;
@Schema(description = "Whether modification of annotations is allowed", example = "false")
private boolean canModifyAnnotations;
@Schema(description = "Whether printing of the document is allowed", example = "false")
private boolean canPrint;
@Schema(description = "Whether faithful printing is allowed", example = "false")
private boolean canPrintFaithful;
}

View File

@@ -0,0 +1,39 @@
package stirling.software.SPDF.model.api.security;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import stirling.software.SPDF.model.api.PDFFile;
@Data
public class AddWatermarkRequest extends PDFFile {
@Schema(description = "The watermark type (text or image)", required = true)
private String watermarkType;
@Schema(description = "The watermark text")
private String watermarkText;
@Schema(description = "The watermark image")
private MultipartFile watermarkImage;
@Schema(description = "The selected alphabet",
allowableValues = {"roman", "arabic", "japanese", "korean", "chinese"},
defaultValue = "roman")
private String alphabet;
@Schema(description = "The font size of the watermark text", example = "30")
private float fontSize;
@Schema(description = "The rotation of the watermark in degrees", example = "0")
private float rotation;
@Schema(description = "The opacity of the watermark (0.0 - 1.0)", example = "0.5")
private float opacity;
@Schema(description = "The width spacer between watermark elements", example = "50")
private int widthSpacer;
@Schema(description = "The height spacer between watermark elements", example = "50")
private int heightSpacer;
}

View File

@@ -0,0 +1,13 @@
package stirling.software.SPDF.model.api.security;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import stirling.software.SPDF.model.api.PDFFile;
@Data
public class PDFPasswordRequest extends PDFFile {
@Schema(description = "The password of the PDF file", required = true)
private String password;
}

View File

@@ -0,0 +1,28 @@
package stirling.software.SPDF.model.api.security;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import stirling.software.SPDF.model.api.PDFFile;
@Data
public class RedactPdfRequest extends PDFFile {
@Schema(description = "List of text to redact from the PDF", type = "string", required = true)
private String listOfText;
@Schema(description = "Whether to use regex for the listOfText", defaultValue = "false")
private boolean useRegex;
@Schema(description = "Whether to use whole word search", defaultValue = "false")
private boolean wholeWordSearch;
@Schema(description = "The color for redaction", defaultValue = "#000000")
private String redactColor;
@Schema(description = "Custom padding for redaction", type = "number")
private float customPadding;
@Schema(description = "Convert the redacted PDF to an image", defaultValue = "false")
private boolean convertPDFToImage;
}

View File

@@ -0,0 +1,25 @@
package stirling.software.SPDF.model.api.security;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import stirling.software.SPDF.model.api.PDFFile;
@Data
public class SanitizePdfRequest extends PDFFile {
@Schema(description = "Remove JavaScript actions from the PDF", defaultValue = "false")
private Boolean removeJavaScript;
@Schema(description = "Remove embedded files from the PDF", defaultValue = "false")
private Boolean removeEmbeddedFiles;
@Schema(description = "Remove metadata from the PDF", defaultValue = "false")
private Boolean removeMetadata;
@Schema(description = "Remove links from the PDF", defaultValue = "false")
private Boolean removeLinks;
@Schema(description = "Remove fonts from the PDF", defaultValue = "false")
private Boolean removeFonts;
}

View File

@@ -0,0 +1,40 @@
package stirling.software.SPDF.model.api.security;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import stirling.software.SPDF.model.api.PDFFile;
@Data
public class SignPDFWithCertRequest extends PDFFile {
@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)")
private MultipartFile privateKeyFile;
@Schema(description = "The digital certificate (required for PEM type certificates)")
private MultipartFile certFile;
@Schema(description = "The PKCS12 keystore file (required for PKCS12 type certificates)")
private MultipartFile p12File;
@Schema(description = "The password for the keystore or the private key")
private String password;
@Schema(description = "Whether to visually show the signature in the PDF file")
private Boolean showSignature;
@Schema(description = "The reason for signing the PDF")
private String reason;
@Schema(description = "The location where the PDF is signed")
private String location;
@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")
private Integer pageNumber;
}