Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

Correct tool operation docs to match what each operation does (#8465)

Anthony Stirlingafe431e6c8a1
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/RotationController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/RotationController.java
index 31719bad75..f6583e1c98 100644
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/RotationController.java
+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/RotationController.java
@@ -42,10 +42,11 @@ public class RotationController {
@StandardPdfResponse
@ToolIO(produces = ToolFormat.PDF)
@Operation(
- summary = "Rotate a PDF file",
+ summary = "Rotate all pages clockwise by 0, 90, 180 or 270 degrees",
description =
- "This endpoint rotates a given PDF file by a specified angle. The angle must be"
- + " a multiple of 90.")
+ "Adds the angle (a multiple of 90) to every page's rotation. For"
+ + " per-page rotation in automated workflows, use auto-rotate-pdf with"
+ + " pageRotations.")
public ResponseEntity<Resource> rotatePDF(@ModelAttribute RotatePDFRequest request)
throws IOException {
MultipartFile pdfFile = request.getFileInput();
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertOfficeController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertOfficeController.java
index 5d37957fca..0dd78bf85b 100644
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertOfficeController.java
+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/converters/ConvertOfficeController.java
@@ -316,10 +316,12 @@ public class ConvertOfficeController {
resourceWeight = ResourceWeight.LARGE_WEIGHT)
@ToolIO(accepts = ToolFormat.ANY, produces = ToolFormat.PDF)
@Operation(
- summary = "Convert a file to a PDF",
+ summary = "Convert office documents (Word, Excel, PowerPoint, OpenDocument) to PDF",
description =
- "This endpoint converts a given file to a PDF using Stirling Office Convert or"
- + " LibreOffice")
+ "Converts Word, Excel, PowerPoint, OpenDocument, RTF, CSV and text"
+ + " files with LibreOffice, or Stirling Office Convert when"
+ + " useStirlingOfficeConvert=true or the admin setting is on. For web"
+ + " pages use html-to-pdf.")
public ResponseEntity<Resource> processFileToPDF(
@ModelAttribute GeneralFile generalFile,
@RequestParam(value = "useStirlingOfficeConvert", required = false)
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/converters/PdfVectorExportController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/converters/PdfVectorExportController.java
index 6b6a6a0bf0..c719e45a0a 100644
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/converters/PdfVectorExportController.java
+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/converters/PdfVectorExportController.java
@@ -57,9 +57,10 @@ public class PdfVectorExportController {
resourceWeight = ResourceWeight.MEDIUM_WEIGHT)
@ToolIO(accepts = ToolFormat.POSTSCRIPT, produces = ToolFormat.PDF)
@Operation(
- summary = "Convert PostScript formats to PDF",
+ summary = "Convert PostScript (PS, EPS) to PDF",
description =
- "Converts PostScript vector inputs (PS, EPS, EPSF) to PDF using Ghostscript.")
+ "Converts PS, EPS and EPSF with Ghostscript; outputFormat is ignored."
+ + " XPS and PCL are not supported.")
public ResponseEntity<Resource> convertGhostscriptInputsToPdf(
@Valid @ModelAttribute PdfVectorExportRequest request) throws Exception {
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/AutoRenameController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/AutoRenameController.java
index 34c3da0739..6e7997cef4 100644
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/AutoRenameController.java
+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/AutoRenameController.java
@@ -48,10 +48,10 @@ public class AutoRenameController {
resourceWeight = ResourceWeight.SMALL_WEIGHT)
@ToolIO(produces = ToolFormat.PDF)
@Operation(
- summary = "Extract header from PDF file",
+ summary = "Rename a PDF after its largest heading text",
description =
- "This endpoint accepts a PDF file and attempts to extract its title or header"
- + " based on heuristics.")
+ "Uses the largest text near the start as the file name; the pages are"
+ + " unchanged. Keeps the original name if no text is found.")
public ResponseEntity<Resource> extractHeader(@ModelAttribute ExtractHeaderRequest request)
throws Exception {
MultipartFile file = request.getFileInput();
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java
index 7a35de3ec4..ecf1aa2960 100644
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java
+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/AutoSplitPdfController.java
@@ -277,11 +277,13 @@ public class AutoSplitPdfController {
@MultiFileResponse
@ToolIO(produces = ToolFormat.PDF, arity = ToolArity.SIMO)
@Operation(
- summary = "Auto split PDF pages into separate documents",
+ summary = "Split a PDF at Stirling QR-code divider pages",
description =
- "This endpoint accepts a PDF file, scans each page for a specific QR code, and"
- + " splits the document at the QR code boundaries. The output is a zip file"
- + " containing each separate PDF document.")
+ "Splits at each divider page and returns a zip of the parts. Divider"
+ + " pages are dropped except a divider on page 1, which is retained."
+ + " duplexMode=true also drops each divider's back page, including"
+ + " when the divider is retained. With no dividers you get one file; use split-pages or"
+ + " split-by-size-or-count instead.")
public ResponseEntity<Resource> autoSplitPdf(@ModelAttribute AutoSplitPdfRequest request)
throws IOException {
MultipartFile file = request.getFileInput();
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImageScansController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImageScansController.java
index 36293b3851..d1ccd19282 100644
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImageScansController.java
+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/ExtractImageScansController.java
@@ -77,11 +77,10 @@ public class ExtractImageScansController {
produces = ToolFormat.IMAGE,
arity = ToolArity.SIMO)
@Operation(
- summary = "Extract image scans from an input file",
+ summary = "Extract photos scanned together on one page into separate images",
description =
- "This endpoint extracts image scans from a given file based on certain"
- + " parameters. Users can specify angle threshold, tolerance, minimum area,"
- + " minimum contour area, and border size.")
+ "Finds, crops and straightens each photo on every page or image."
+ + " Returns one PNG, or a zip when several are found.")
public ResponseEntity<Resource> extractImageScans(
@ModelAttribute ExtractImageScansRequest request)
throws IOException, InterruptedException {
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/FlattenController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/FlattenController.java
index 9dd805311f..225f3392b9 100644
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/FlattenController.java
+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/FlattenController.java
@@ -56,10 +56,11 @@ public class FlattenController {
@StandardPdfResponse
@ToolIO(produces = ToolFormat.PDF)
@Operation(
- summary = "Flatten PDF form fields or full page",
+ summary = "Flatten a PDF to images, or flatten only its form fields",
description =
- "Flattening just PDF form fields or converting each page to images to make text"
- + " unselectable.")
+ "By default every page becomes an image, so text can no longer be"
+ + " selected. flattenOnlyForms=true only merges form fields into the"
+ + " page.")
public ResponseEntity<Resource> flatten(@ModelAttribute FlattenRequest request)
throws Exception {
MultipartFile file = request.getFileInput();
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java
index b51bfdc3fb..200052fa99 100644
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java
+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/MetadataController.java
@@ -66,10 +66,11 @@ public class MetadataController {
@StandardPdfResponse
@ToolIO(produces = ToolFormat.PDF)
@Operation(
- summary = "Update metadata of a PDF file",
+ summary = "Update a PDF's metadata",
description =
- "This endpoint allows you to update the metadata of a given PDF file. You can"
- + " add, modify, or delete standard and custom metadata fields.")
+ "Standard fields left out are cleared, so send the current values of"
+ + " the others too (see get-info-on-pdf). Dates use yyyy/MM/dd HH:mm:ss."
+ + " deleteAll=true removes all metadata.")
public ResponseEntity<Resource> metadata(@ModelAttribute MetadataRequest request)
throws IOException {
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/OverlayImageController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/OverlayImageController.java
index 4f7c335a23..112e795125 100644
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/OverlayImageController.java
+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/OverlayImageController.java
@@ -47,12 +47,12 @@ public class OverlayImageController {
resourceWeight = ResourceWeight.MEDIUM_WEIGHT)
@ToolIO(produces = ToolFormat.PDF)
@Operation(
- summary = "Overlay image onto a PDF file",
+ summary = "Overlay an image at x,y on the first or every page",
description =
- "This endpoint overlays an image onto a PDF file at the specified coordinates."
- + " Supports both raster formats (PNG, JPEG, etc.) and vector format (SVG). SVG"
- + " files are rendered as vector graphics for crisp output at any resolution. The"
- + " image can be overlaid on every page of the PDF if specified.")
+ "Draws a raster or SVG image at native size (1 px = 1 pt), with its"
+ + " lower-left corner at PDF user-space coordinates (x, y), in points."
+ + " The page's lower-left coordinates may be nonzero. To set size,"
+ + " grid position or pages, use add-stamp with stampType=image.")
public ResponseEntity<Resource> overlayImage(@ModelAttribute OverlayImageRequest request) {
MultipartFile pdfFile = request.getFileInput();
MultipartFile imageFile = request.getImageFile();
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java
index 7436bbb824..2a850779d5 100644
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java
+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java
@@ -231,10 +231,18 @@ public class PasswordController {
produces = ToolFormat.PDF,
arity = ToolArity.SISO))
@Operation(
- summary = "Add password to a PDF file",
+ summary = "Add a password and permission restrictions to a PDF",
description =
- "This endpoint adds password protection to a PDF file. Users can specify a set"
- + " of permissions that should be applied to the file. sourcePassword authenticates an existing protected source; preserveExisting changes permissions while retaining existing credentials. Omitting these options preserves the existing add-password behaviour.")
+ "password sets an optional opening password; omit or leave it empty for"
+ + " owner-only protection with ownerPassword. For new protection, prevent*"
+ + " restrictions require a nonempty ownerPassword different from password."
+ + " sourcePassword opens an already protected file. With preserveExisting=true"
+ + " on an encrypted file, omitting or leaving ownerPassword empty retains"
+ + " the existing passwords and changes permissions; supplying ownerPassword"
+ + " replaces the permissions password while retaining the opening password."
+ + " Replacement requires the existing opening password in password or"
+ + " sourcePassword. When sourcePassword is a distinct permissions password,"
+ + " password must contain the source's existing opening password.")
public ResponseEntity<Resource> addPassword(@ModelAttribute AddPasswordRequest request)
throws IOException {
boolean explicitProtection =
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java
index 0e3e8d6102..f2b27eb556 100644
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java
+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/security/RedactController.java
@@ -97,11 +97,12 @@ public class RedactController {
@ToolIO(produces = ToolFormat.PDF)
@Operation(
operationId = "redactPdfManual",
- summary = "Redacts areas and pages in a PDF document",
+ summary = "Remove content under selected areas or wipe whole pages",
description =
- "This endpoint redacts content from a PDF file based on manually specified"
- + " areas. Users can specify areas to redact and optionally convert the PDF to an"
- + " image.")
+ "Removes covered page content from selected areas and wipes selected whole"
+ + " pages. An affected page may be rasterized if native region removal"
+ + " cannot safely clear it. convertPDFToImage=true rasterizes every"
+ + " output page.")
public ResponseEntity<Resource> redactPDF(@ModelAttribute ManualRedactPdfRequest request)
throws IOException {
@@ -143,12 +144,13 @@ public class RedactController {
@StandardPdfResponse
@ToolIO(produces = ToolFormat.PDF)
@Operation(
- summary = "Redact PDF automatically",
+ summary = "Redact text matching words or regex patterns",
operationId = "redactPdfAuto",
description =
- "This endpoint automatically redacts text from a PDF file based on specified"
- + " patterns. Users can provide text patterns to redact, with options for regex"
- + " and whole word matching.")
+ "Removes matched page text and covers its location. Verification failures"
+ + " in native word/regex removal reject the request. Other native failures"
+ + " fall back to region content removal or rasterization."
+ + " convertPDFToImage=true rasterizes every output page.")
public ResponseEntity<Resource> redactPdf(@ModelAttribute RedactPdfRequest request)
throws ToolFailedException {
if (request.getFileInput() == null || request.getFileInput().isEmpty()) {
@@ -317,8 +319,12 @@ public class RedactController {
operationId = "redactExecute",
summary = "Execute a unified redaction plan on a PDF",
description =
- "Unified redaction endpoint that accepts exact strings, regex patterns, and"
- + " page numbers in a single request. Supports execution strategy hints.")
+ "Redacts exact text, regex matches, anchored ranges, image regions and whole"
+ + " pages. AUTO removes covered page content, with per-page rasterization"
+ + " when needed. OVERLAY_ONLY skips removal for text/range/image boxes;"
+ + " whole-page wipes still remove page content. style.convertToImage=true"
+ + " or IMAGE_FINALIZE rasterizes every output page. Verification failures"
+ + " in native word/regex removal reject the request.")
public ResponseEntity<Resource> executeRedaction(@ModelAttribute RedactExecuteRequest request)
throws IOException {
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/EditTableOfContentsRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/EditTableOfContentsRequest.java
index 312557b5e6..f8c6993a40 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/EditTableOfContentsRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/EditTableOfContentsRequest.java
@@ -12,14 +12,16 @@ import stirling.software.common.model.api.PDFFile;
public class EditTableOfContentsRequest extends PDFFile {
@Schema(
- description = "Bookmark structure in JSON format",
+ description = "The full new outline as a JSON array of {title, pageNumber, children[]}",
type = "string",
example =
"[{\\\"title\\\":\\\"Chapter 1\\\",\\\"pageNumber\\\":1,\\\"children\\\":[{\\\"title\\\":\\\"Section 1.1\\\",\\\"pageNumber\\\":2}]}]")
private String bookmarkData;
@Schema(
- description = "Whether to replace existing bookmarks or append to them",
+ description =
+ "Ignored: existing bookmarks are always replaced. To add to them, read"
+ + " them with extract-bookmarks and send the full list.",
example = "true")
private Boolean replaceExisting;
}
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/SplitPdfBySectionsRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/SplitPdfBySectionsRequest.java
index 9a89c81305..9c37513794 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/SplitPdfBySectionsRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/SplitPdfBySectionsRequest.java
@@ -26,12 +26,10 @@ public class SplitPdfBySectionsRequest extends PDFFile {
@Schema(
implementation = SplitTypes.class,
description =
- "Modes for page split. Valid values are:\n"
- + "SPLIT_ALL_EXCEPT_FIRST_AND_LAST: Splits all except the first and the last pages.\n"
- + "SPLIT_ALL_EXCEPT_FIRST: Splits all except the first page.\n"
- + "SPLIT_ALL_EXCEPT_LAST: Splits all except the last page.\n"
- + "SPLIT_ALL: Splits all pages.\n"
- + "CUSTOM: Custom split.\n")
+ "Which pages to split (default SPLIT_ALL). SPLIT_ALL splits every page;"
+ + " SPLIT_ALL_EXCEPT_FIRST, SPLIT_ALL_EXCEPT_LAST and"
+ + " SPLIT_ALL_EXCEPT_FIRST_AND_LAST keep those pages whole; CUSTOM"
+ + " splits only pageNumbers.")
private String splitMode;
@Schema(
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/converters/PdfToPdfARequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/converters/PdfToPdfARequest.java
index 3baad6351f..61028cc1f3 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/converters/PdfToPdfARequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/converters/PdfToPdfARequest.java
@@ -15,7 +15,11 @@ public class PdfToPdfARequest extends PDFFile {
private Boolean useStirlingOfficeConvert;
@Schema(
- description = "The output format type (PDF/A or PDF/X)",
+ description =
+ "pdfa, pdfa-2, pdfa-2b = PDF/A-2b (usual choice); pdfa-1 = PDF/A-1b;"
+ + " pdfa-3, pdfa-3b = PDF/A-3b (allows attachments, e.g. e-invoice XML);"
+ + " pdfa-1a/2a/3a also tag, else fall back to level B (strict=true errors"
+ + " instead); pdfx = PDF/X.",
requiredMode = Schema.RequiredMode.REQUIRED,
allowableValues = {
"pdfa", "pdfa-1", "pdfa-2", "pdfa-2b", "pdfa-3", "pdfa-3b", "pdfa-1a", "pdfa-2a",
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/general/OverlayPdfsRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/general/OverlayPdfsRequest.java
index f89ba320f0..1d85a027e3 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/general/OverlayPdfsRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/general/OverlayPdfsRequest.java
@@ -14,31 +14,29 @@ import stirling.software.common.model.api.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.",
+ description = "PDFs drawn onto the base PDF's pages, in the order set by overlayMode",
requiredMode = Schema.RequiredMode.REQUIRED)
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",
+ "SequentialOverlay uses each overlay file's pages in order and repeats as"
+ + " needed. With multiple files it starts with the second file, proceeds"
+ + " through the remaining files, then wraps to the first (e.g. B, A for"
+ + " files [A, B]). A single file repeats from its first page."
+ + " InterleavedOverlay takes each overlay file"
+ + " in turn. FixedRepeatOverlay uses counts.",
allowableValues = {"SequentialOverlay", "InterleavedOverlay", "FixedRepeatOverlay"},
requiredMode = Schema.RequiredMode.REQUIRED)
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.",
+ description = "FixedRepeatOverlay only: one repeat count per overlay file",
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
private int[] counts;
@Schema(
- description = "Overlay position 0 is Foregound, 1 is Background",
+ description = "0 = foreground (over the content), 1 = background (behind it)",
allowableValues = {"0", "1"},
requiredMode = Schema.RequiredMode.REQUIRED,
type = "number")
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/general/RearrangePagesRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/general/RearrangePagesRequest.java
index d3f79ce56b..a24bfc9bff 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/general/RearrangePagesRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/general/RearrangePagesRequest.java
@@ -15,15 +15,9 @@ public class RearrangePagesRequest extends PDFWithPageNums {
@Schema(
implementation = SortTypes.class,
description =
- "The custom mode for page rearrangement. Valid values are:\n"
- + "CUSTOM: Uses order defined in PageNums "
- + "DUPLICATE: Duplicate pages n times (if Page order defined as 4, then duplicates each page 4 times)"
- + "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")
+ "Omit or CUSTOM to use pageNumbers. Presets: REVERSE_ORDER, DUPLEX_SORT"
+ + " (fronts then backs reversed), BOOKLET_SORT, SIDE_STITCH_BOOKLET_SORT,"
+ + " ODD_EVEN_SPLIT (odd then even), REMOVE_FIRST, REMOVE_LAST,"
+ + " REMOVE_FIRST_AND_LAST, DUPLICATE (copies = pageNumbers, default 2).")
private String customMode;
}
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/general/SplitPdfBySizeOrCountRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/general/SplitPdfBySizeOrCountRequest.java
index 459b27dbae..91dad4dd97 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/general/SplitPdfBySizeOrCountRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/general/SplitPdfBySizeOrCountRequest.java
@@ -12,15 +12,16 @@ import stirling.software.common.model.api.PDFFile;
public class SplitPdfBySizeOrCountRequest extends PDFFile {
@Schema(
- description =
- "Determines the type of split: 0 for size, 1 for page count, 2 for document count",
+ description = "0 = by file size, 1 = by pages per file, 2 = by number of files",
requiredMode = Schema.RequiredMode.NOT_REQUIRED,
- defaultValue = "0")
+ defaultValue = "0",
+ allowableValues = {"0", "1", "2"})
private int splitType;
@Schema(
description =
- "Value for split: size in MB (e.g., '10MB') or number of pages (e.g., '5')",
+ "For splitType 0 a size like '500KB' or '10MB' (a bare number means"
+ + " MB); for 1 and 2 a whole number",
requiredMode = Schema.RequiredMode.NOT_REQUIRED,
defaultValue = "10MB")
private String splitValue = "10MB";
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/misc/AddAttachmentRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/misc/AddAttachmentRequest.java
index 48a749098f..5629503c8c 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/misc/AddAttachmentRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/misc/AddAttachmentRequest.java
@@ -16,7 +16,7 @@ import stirling.software.common.model.api.PDFFile;
public class AddAttachmentRequest extends PDFFile {
@Schema(
- description = "The image file to be overlaid onto the PDF.",
+ description = "Files to attach to the PDF (up to 50 MB each, 200 MB in total)",
requiredMode = Schema.RequiredMode.REQUIRED,
format = "binary")
private List<MultipartFile> attachments;
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/misc/AddPageNumbersRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/misc/AddPageNumbersRequest.java
index 88a7c27959..b7900ef3f3 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/misc/AddPageNumbersRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/misc/AddPageNumbersRequest.java
@@ -12,20 +12,6 @@ import stirling.software.SPDF.model.api.PDFWithPageNums;
@EqualsAndHashCode(callSuper = true)
public class AddPageNumbersRequest extends PDFWithPageNums {
- @Schema(
- description = "Custom margin: small/medium/large/x-large",
- allowableValues = {"small", "medium", "large", "x-large"},
- defaultValue = "medium",
- requiredMode = RequiredMode.NOT_REQUIRED)
- private String customMargin = "medium";
-
- @Schema(
- description = "Font size for page numbers",
- minimum = "1",
- defaultValue = "12",
- requiredMode = RequiredMode.NOT_REQUIRED)
- private float fontSize = 12;
-
@Schema(
description = "Font type for page numbers",
allowableValues = {"helvetica", "courier", "times"},
@@ -33,29 +19,31 @@ public class AddPageNumbersRequest extends PDFWithPageNums {
private String fontType;
@Schema(
- description = "Hex colour for page numbers (e.g. #FF0000)",
- example = "#000000",
- defaultValue = "#000000",
- requiredMode = RequiredMode.NOT_REQUIRED)
- private String fontColor = "#000000";
+ description =
+ "Where to place the number on a 3x3 grid: 1=top-left, 2=top-center,"
+ + " 3=top-right, 4=middle-left, 5=center, 6=middle-right,"
+ + " 7=bottom-left, 8=bottom-center, 9=bottom-right",
+ type = "integer",
+ allowableValues = {"1", "2", "3", "4", "5", "6", "7", "8", "9"},
+ defaultValue = "8",
+ requiredMode = RequiredMode.REQUIRED)
+ private int position = 8;
@Schema(
description =
- "Zero-padding width for page numbers (Bates Stamping). Set to 0 to disable padding",
- minimum = "0",
- defaultValue = "0",
+ "Text for each number, e.g. 'Page {n} of {total}'. Placeholders: {n}"
+ + " (counts numbered pages only, from startingNumber), {total} (all pages"
+ + " in the file), {filename}.",
+ example = "Page {n} of {total}",
+ defaultValue = "{n}",
requiredMode = RequiredMode.NOT_REQUIRED)
- private int zeroPad = 0;
+ private String customText = "{n}";
@Schema(
- description =
- "Position: 1-9 representing positions on the page (1=top-left, 2=top-center,"
- + " 3=top-right, 4=middle-left, 5=middle-center, 6=middle-right,"
- + " 7=bottom-left, 8=bottom-center, 9=bottom-right)",
- type = "integer",
- allowableValues = {"1", "2", "3", "4", "5", "6", "7", "8", "9"},
- requiredMode = RequiredMode.REQUIRED)
- private int position = 8;
+ description = "Which pages to number (e.g. '1,3-5,7' or 'all')",
+ defaultValue = "all",
+ requiredMode = RequiredMode.NOT_REQUIRED)
+ private String pagesToNumber = "all";
@Schema(
description = "Starting number for page numbering",
@@ -65,17 +53,31 @@ public class AddPageNumbersRequest extends PDFWithPageNums {
private int startingNumber = 1;
@Schema(
- description = "Which pages to number (e.g. '1,3-5,7' or 'all')",
- defaultValue = "all",
+ description = "Font size for page numbers",
+ minimum = "1",
+ defaultValue = "12",
requiredMode = RequiredMode.NOT_REQUIRED)
- private String pagesToNumber = "all";
+ private float fontSize = 12;
+
+ @Schema(
+ description = "Hex colour for page numbers (e.g. #FF0000)",
+ example = "#000000",
+ defaultValue = "#000000",
+ requiredMode = RequiredMode.NOT_REQUIRED)
+ private String fontColor = "#000000";
+
+ @Schema(
+ description = "Custom margin: small/medium/large/x-large",
+ allowableValues = {"small", "medium", "large", "x-large"},
+ defaultValue = "medium",
+ requiredMode = RequiredMode.NOT_REQUIRED)
+ private String customMargin = "medium";
@Schema(
description =
- "Custom text pattern. Available variables: {n}=current page number,"
- + " {total}=total pages, {filename}=original filename",
- example = "Page {n} of {total}",
- defaultValue = "{n}",
+ "Zero-padding width for page numbers (Bates Stamping). Set to 0 to disable padding",
+ minimum = "0",
+ defaultValue = "0",
requiredMode = RequiredMode.NOT_REQUIRED)
- private String customText = "{n}";
+ private int zeroPad = 0;
}
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/misc/AddStampRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/misc/AddStampRequest.java
index bc0029f3db..ec352758d8 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/misc/AddStampRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/misc/AddStampRequest.java
@@ -24,58 +24,65 @@ public class AddStampRequest extends PDFWithPageNums {
@Schema(
description =
"The stamp text, or the QR code content when stampType is qr; required when"
- + " stampType is text or qr")
+ + " stampType is text or qr. For text stamps only, \\n starts a new"
+ + " line; QR content keeps the literal sequence. Both support @page,"
+ + " @total_pages, @date, @date{dd/MM/yyyy}, @time,"
+ + " @filename, @title, @author and @uuid (@@ for a literal @).")
private String stampText;
@Schema(description = "The stamp image, required when stampType is image")
private MultipartFile stampImage;
@Schema(
- description = "The selected alphabet of the stamp text",
- allowableValues = {"roman", "arabic", "japanese", "korean", "chinese", "thai"},
- defaultValue = "roman")
- private String alphabet = "roman";
+ description =
+ "Where to place the stamp on a 3x3 grid: 1=top-left, 2=top-center,"
+ + " 3=top-right, 4=middle-left, 5=center, 6=middle-right,"
+ + " 7=bottom-left, 8=bottom-center, 9=bottom-right",
+ allowableValues = {"1", "2", "3", "4", "5", "6", "7", "8", "9"},
+ defaultValue = "5")
+ private int position = 5;
@Schema(
- description = "The font size of the stamp text and image in points.",
+ description =
+ "Text size in points; for an image stamp, the image height (width keeps"
+ + " its aspect ratio)",
defaultValue = "40")
private float fontSize = 40f;
- @Schema(description = "The rotation of the stamp in degrees", defaultValue = "0")
- private float rotation = 0f;
-
@Schema(description = "The opacity of the stamp (0.0 - 1.0)", defaultValue = "0.5")
private float opacity = 0.5f;
+ @Schema(description = "Hex colour of the stamp text, e.g. #FF0000", defaultValue = "#d3d3d3")
+ private String customColor = "#d3d3d3";
+
+ @Schema(description = "The rotation of the stamp in degrees", defaultValue = "0")
+ private float rotation = 0f;
+
@Schema(
- description =
- "Position for stamp placement based on a 1-9 grid (1: bottom-left, 2: bottom-center,"
- + " 3: bottom-right, 4: middle-left, 5: middle-center, 6: middle-right,"
- + " 7: top-left, 8: top-center, 9: top-right)",
- allowableValues = {"1", "2", "3", "4", "5", "6", "7", "8", "9"},
- defaultValue = "5")
- private int position = 5;
+ description = "Font script matching stampText; roman for Latin text",
+ allowableValues = {"roman", "arabic", "japanese", "korean", "chinese", "thai"},
+ defaultValue = "roman")
+ private String alphabet = "roman";
@Schema(
description =
- "Override X coordinate for stamp placement. If set, it will override the"
- + " position-based calculation. Negative value means no override.",
+ "X in PDF user-space points. When both overrides are nonnegative, replaces"
+ + " position. Image and QR positions are clamped to the media box using"
+ + " the unrotated stamp size; text positions are not clamped. -1 = not set.",
defaultValue = "-1")
private float overrideX = -1f;
@Schema(
description =
- "Override Y coordinate for stamp placement. If set, it will override the"
- + " position-based calculation. Negative value means no override.",
+ "Y in PDF user-space points. When both overrides are nonnegative, replaces"
+ + " position. Image and QR positions are clamped to the media box using"
+ + " the unrotated stamp size; text positions are not clamped. -1 = not set.",
defaultValue = "-1")
private float overrideY = -1f;
@Schema(
- description = "Specifies the margin size for the stamp.",
+ description = "Margin between the stamp and the page edge when placed by position",
allowableValues = {"small", "medium", "large", "x-large"},
defaultValue = "medium")
private String customMargin = "medium";
-
- @Schema(description = "The color of the stamp text", defaultValue = "#d3d3d3")
- private String customColor = "#d3d3d3";
}
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/misc/FlattenRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/misc/FlattenRequest.java
index 3be83ad657..6f0a025fd2 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/misc/FlattenRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/misc/FlattenRequest.java
@@ -12,15 +12,13 @@ import stirling.software.common.model.api.PDFFile;
public class FlattenRequest extends PDFFile {
@Schema(
- description =
- "True to flatten only the forms, false to flatten full PDF (Convert page to"
- + " image)",
+ description = "True flattens only form fields; false turns every page into an image",
requiredMode = Schema.RequiredMode.REQUIRED,
defaultValue = "false")
private Boolean flattenOnlyForms = false;
@Schema(
- description = "Optional DPI for page rendering when flattening the full document.",
+ description = "DPI for the page images when flattening full pages (default 300)",
requiredMode = Schema.RequiredMode.NOT_REQUIRED,
minimum = "72")
private Integer renderDpi;
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/misc/MetadataRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/misc/MetadataRequest.java
index 2bc6e85e07..3a150bc1cc 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/misc/MetadataRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/misc/MetadataRequest.java
@@ -14,7 +14,7 @@ import stirling.software.common.model.api.PDFFile;
public class MetadataRequest extends PDFFile {
@Schema(
- description = "Delete all metadata if set to true",
+ description = "True removes all metadata, including XMP, and ignores the other fields",
defaultValue = "false",
requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean deleteAll = false;
@@ -83,7 +83,8 @@ public class MetadataRequest extends PDFFile {
@Schema(
description =
- "Map list of key and value of custom parameters. Note these must start with"
- + " customKey and customValue if they are non-standard")
+ "Custom metadata to add or update, e.g. {\"Department\":\"Finance\"}."
+ + " Existing custom keys are kept. customKeyN/customValueN pairs also"
+ + " work.")
private Map<String, String> allRequestParams;
}
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/misc/OptimizePdfRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/misc/OptimizePdfRequest.java
index fdfda25510..f9e0b74f26 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/misc/OptimizePdfRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/misc/OptimizePdfRequest.java
@@ -13,10 +13,11 @@ 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.",
+ "Compression level from 1 (lightest) to 9 (strongest). Or set"
+ + " expectedOutputSize to pick one automatically.",
type = "integer",
requiredMode = Schema.RequiredMode.REQUIRED,
+ defaultValue = "5",
allowableValues = {"1", "2", "3", "4", "5", "6", "7", "8", "9"})
private Integer optimizeLevel = 5;
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/misc/OverlayImageRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/misc/OverlayImageRequest.java
index 007ebb1ff7..73e5165158 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/misc/OverlayImageRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/misc/OverlayImageRequest.java
@@ -14,28 +14,25 @@ import stirling.software.common.model.api.PDFFile;
public class OverlayImageRequest extends PDFFile {
@Schema(
- description =
- "The image file to be overlaid onto the PDF. "
- + "Supports raster formats (PNG, JPEG, etc.) and vector format (SVG). "
- + "SVG files are rendered as vector graphics for crisp output at any resolution.",
+ description = "The image to draw (raster or SVG), at native size",
requiredMode = Schema.RequiredMode.REQUIRED,
format = "binary")
private MultipartFile imageFile;
@Schema(
- description = "The x-coordinate at which to place the top-left corner of the image.",
+ description = "X of the image's lower-left corner in PDF user-space points",
requiredMode = Schema.RequiredMode.REQUIRED,
defaultValue = "0")
private float x;
@Schema(
- description = "The y-coordinate at which to place the top-left corner of the image.",
+ description = "Y of the image's lower-left corner in PDF user-space points",
requiredMode = Schema.RequiredMode.REQUIRED,
defaultValue = "0")
private float y;
@Schema(
- description = "Whether to overlay the image onto every page of the PDF.",
+ description = "Draw the image on every page; when false, only on page 1.",
requiredMode = Schema.RequiredMode.REQUIRED,
defaultValue = "false")
private Boolean everyPage = false;
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/misc/ScannerEffectRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/misc/ScannerEffectRequest.java
index 3b2eebfccf..a58e888cef 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/misc/ScannerEffectRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/misc/ScannerEffectRequest.java
@@ -38,7 +38,9 @@ public class ScannerEffectRequest {
@NotNull(message = "File input is required")
private MultipartFile fileInput;
- @Schema(description = "Scan quality preset", example = "high")
+ @Schema(
+ description = "Scan quality preset, used unless advancedEnabled is true",
+ example = "high")
@NotNull(message = "Quality is required")
private Quality quality = Quality.high;
@@ -49,35 +51,51 @@ public class ScannerEffectRequest {
@Schema(description = "Colorspace for output image", example = "grayscale")
private Colorspace colorspace = Colorspace.grayscale;
- @Schema(description = "Border thickness in pixels", example = "20")
- private int border = 20;
-
- @Schema(description = "Base rotation in degrees", example = "0")
- private int rotate = 0;
-
- @Schema(description = "Random rotation variance in degrees", example = "2")
- private int rotateVariance = 2;
+ @Schema(
+ description =
+ "Use brightness, contrast, blur, noise and resolution instead of the"
+ + " quality preset. Border, rotation, colorspace and yellowish always"
+ + " apply.",
+ example = "false")
+ private boolean advancedEnabled = false;
- @Schema(description = "Brightness multiplier (1.0 = no change)", example = "1.0")
+ @Schema(
+ description = "Brightness multiplier (1.0 = no change). Needs advancedEnabled=true.",
+ example = "1.0")
private float brightness = 1.0f;
- @Schema(description = "Contrast multiplier (1.0 = no change)", example = "1.0")
+ @Schema(
+ description = "Contrast multiplier (1.0 = no change). Needs advancedEnabled=true.",
+ example = "1.0")
private float contrast = 1.0f;
- @Schema(description = "Blur amount (0 = none, higher = more blur)", example = "1.0")
+ @Schema(
+ description = "Blur amount (0 = none, higher = more blur). Needs advancedEnabled=true.",
+ example = "1.0")
private float blur = 1.0f;
- @Schema(description = "Noise amount (0 = none, higher = more noise)", example = "8.0")
+ @Schema(
+ description =
+ "Noise amount (0 = none, higher = more noise). Needs advancedEnabled=true.",
+ example = "8.0")
private float noise = 8.0f;
- @Schema(description = "Simulate yellowed paper", example = "false")
- private boolean yellowish = false;
-
- @Schema(description = "Rendering resolution in DPI", example = "300")
+ @Schema(
+ description = "Rendering resolution in DPI. Needs advancedEnabled=true.",
+ example = "300")
private int resolution = 300;
- @Schema(description = "Whether advanced settings are enabled", example = "false")
- private boolean advancedEnabled = false;
+ @Schema(description = "Border thickness in pixels", example = "20")
+ private int border = 20;
+
+ @Schema(description = "Base rotation in degrees", example = "0")
+ private int rotate = 0;
+
+ @Schema(description = "Random rotation variance in degrees", example = "2")
+ private int rotateVariance = 2;
+
+ @Schema(description = "Simulate yellowed paper", example = "false")
+ private boolean yellowish = false;
public int getRotationValue() {
return switch (rotation) {
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/security/AddPasswordRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/security/AddPasswordRequest.java
index 39008d1de2..a98c4ae146 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/security/AddPasswordRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/security/AddPasswordRequest.java
@@ -14,16 +14,14 @@ 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)",
+ "Password needed to change the prevent* restrictions. Must differ from"
+ + " password for them to hold.",
format = "password")
@ToString.Exclude
private String ownerPassword;
@Schema(
- description =
- "The password to be added to the PDF file (Restricts the opening of the"
- + " document itself.)",
+ description = "Password needed to open the PDF. Leave empty to only add restrictions.",
format = "password")
@ToString.Exclude
private String password;
@@ -37,7 +35,9 @@ public class AddPasswordRequest extends PDFFile {
@Schema(
description =
- "Change permissions while retaining existing passwords and encryption. A supplied ownerPassword replaces the permissions password.",
+ "Change permissions on an encrypted source. Omitting or leaving ownerPassword"
+ + " empty retains its passwords and encryption; supplying ownerPassword replaces"
+ + " the permissions password while keeping the opening password and encryption key length.",
defaultValue = "false")
private boolean preserveExisting;
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/security/AddWatermarkRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/security/AddWatermarkRequest.java
index 30cb2fa31a..d7a4b8c761 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/security/AddWatermarkRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/security/AddWatermarkRequest.java
@@ -31,12 +31,14 @@ public class AddWatermarkRequest extends PDFFile {
private MultipartFile watermarkImage;
@Schema(
- description = "The selected alphabet",
+ description = "Font script matching watermarkText; roman for Latin text",
allowableValues = {"roman", "arabic", "japanese", "korean", "chinese", "thai"},
defaultValue = "roman")
private String alphabet = "roman";
- @Schema(description = "The font size of the watermark text", defaultValue = "12")
+ @Schema(
+ description = "Text size in points; for an image watermark, the image height",
+ defaultValue = "12")
@DecimalMin(value = "1.0", message = "Font size must be at least 1.0")
private float fontSize = 12f;
@@ -46,6 +48,18 @@ public class AddWatermarkRequest extends PDFFile {
@Schema(description = "The opacity of the watermark (0.0 - 1.0)", defaultValue = "0.5")
private float opacity = 0.5f;
+ @Schema(
+ description = "Hex colour of the watermark text, e.g. #FF0000",
+ defaultValue = "#d3d3d3")
+ private String customColor = "#d3d3d3";
+
+ @Schema(
+ description =
+ "Turn pages into images so the watermark is hard to remove; text"
+ + " becomes unselectable",
+ defaultValue = "false")
+ private Boolean convertPDFToImage = false;
+
@Schema(description = "The width spacer between watermark elements", defaultValue = "50")
@Min(value = 0, message = "Width spacer must be non-negative")
private int widthSpacer = 50;
@@ -53,10 +67,4 @@ public class AddWatermarkRequest extends PDFFile {
@Schema(description = "The height spacer between watermark elements", defaultValue = "50")
@Min(value = 0, message = "Height spacer must be non-negative")
private int heightSpacer = 50;
-
- @Schema(description = "The color for watermark", defaultValue = "#d3d3d3")
- private String customColor = "#d3d3d3";
-
- @Schema(description = "Convert the redacted PDF to an image", defaultValue = "false")
- private Boolean convertPDFToImage = false;
}
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/security/ManualRedactPdfRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/security/ManualRedactPdfRequest.java
index 85962bce03..55711b59cf 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/security/ManualRedactPdfRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/security/ManualRedactPdfRequest.java
@@ -16,17 +16,22 @@ public class ManualRedactPdfRequest extends PDFWithPageNums {
// Shadows the shared "all" default: here these pages are blacked out entirely.
@Schema(
description =
- "Pages to black out completely, e.g. '1,3-5'. Omit to redact only the listed"
+ "Pages to wipe completely, e.g. '1,3-5'. Omit to redact only the listed"
+ " areas.")
private String pageNumbers;
@Schema(
- description = "A list of areas that should be redacted",
+ description =
+ "Areas whose covered page content is removed: page (from 1), x and y"
+ + " of the top-left corner from the page's top-left, width and height,"
+ + " in points",
requiredMode = Schema.RequiredMode.REQUIRED)
private List<RedactionArea> redactions;
@Schema(
- description = "Convert the redacted PDF to an image",
+ description =
+ "Rasterize every output page, making page text unselectable."
+ + " Redaction areas already remove covered page content by default.",
defaultValue = "false",
requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean convertPDFToImage = false;
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/security/RedactExecuteRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/security/RedactExecuteRequest.java
index ffa2af9dff..a465fbe152 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/security/RedactExecuteRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/security/RedactExecuteRequest.java
@@ -36,20 +36,23 @@ public class RedactExecuteRequest extends PDFFile {
@Schema(
description =
- "Text ranges to redact by specifying a start and end anchor phrase. All"
- + " content between the two phrases (inclusive) is redacted. Anchors"
- + " work best when short and unique. They must appear"
- + " verbatim in the document.")
+ "Text located using start and end anchor phrases (inclusive). AUTO removes"
+ + " selected page content or rasterizes affected pages; OVERLAY_ONLY"
+ + " paints boxes without a content-removal step.")
private List<TextRange> ranges = new ArrayList<>();
@Schema(
description =
- "Rectangular areas to black out, each defined by a page number and bounding box coordinates.")
+ "Rectangular areas identified by page and bounding box. AUTO removes"
+ + " covered page content or rasterizes affected pages; OVERLAY_ONLY"
+ + " paints boxes without a content-removal step.")
private List<ImageBox> imageBoxes = new ArrayList<>();
@Schema(
description =
- "1-indexed page numbers to redact all detected images from. Pass an empty list to redact images from every page. Omit or pass null to skip image redaction entirely.")
+ "1-indexed pages whose detected image regions are redacted; an empty list"
+ + " means every page, null skips it. AUTO removes covered page content"
+ + " or rasterizes affected pages; OVERLAY_ONLY paints boxes.")
private List<Integer> redactImagePages;
@Schema(description = "Redaction style options")
@@ -121,11 +124,18 @@ public class RedactExecuteRequest extends PDFFile {
defaultValue = "0")
private float padding = 0f;
- @Schema(description = "Rasterize output to prevent text extraction", defaultValue = "false")
+ @Schema(
+ description = "Rasterize every output page, making page text unselectable",
+ defaultValue = "false")
private boolean convertToImage = false;
@Schema(
- description = "Execution strategy hint for the redaction pipeline",
+ description =
+ "AUTO removes covered page content and may rasterize affected pages."
+ + " OVERLAY_ONLY draws text/range/image boxes without removal."
+ + " IMAGE_FINALIZE rasterizes every output page. Whole-page wipes"
+ + " remove page content in every strategy; convertToImage also"
+ + " controls final rasterization independently.",
defaultValue = "AUTO")
private RedactionStrategy strategy = RedactionStrategy.AUTO;
}
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/security/RedactPdfRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/security/RedactPdfRequest.java
index 2fe83f026f..cea09c9a20 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/security/RedactPdfRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/security/RedactPdfRequest.java
@@ -12,7 +12,9 @@ import stirling.software.common.model.api.PDFFile;
public class RedactPdfRequest extends PDFFile {
@Schema(
- description = "Newline-separated list of text to redact from the PDF",
+ description =
+ "Text to redact, one term per line (not comma-separated); each line is"
+ + " a regex when useRegex=true",
example = "text\ntext2",
requiredMode = Schema.RequiredMode.REQUIRED)
private String listOfText;
@@ -42,13 +44,14 @@ public class RedactPdfRequest extends PDFFile {
private String redactColor = "#000000";
@Schema(
- description = "Custom padding for redaction",
+ description = "Extra space around each redaction box, in points",
type = "number",
+ defaultValue = "0",
requiredMode = Schema.RequiredMode.REQUIRED)
- private float customPadding;
+ private float customPadding = 0f;
@Schema(
- description = "Convert the redacted PDF to an image",
+ description = "Rasterize every output page, making page text unselectable",
defaultValue = "false",
requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean convertPDFToImage = Boolean.FALSE;
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/security/SignatureValidationRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/security/SignatureValidationRequest.java
index dd301e0e18..d0988bf118 100644
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/security/SignatureValidationRequest.java
+++ b/app/core/src/main/java/stirling/software/SPDF/model/api/security/SignatureValidationRequest.java
@@ -14,7 +14,9 @@ import stirling.software.common.model.api.PDFFile;
public class SignatureValidationRequest extends PDFFile {
@Schema(
- description = "(Optional) file to compare PDF cert signatures against x.509 format",
+ description =
+ "Optional X.509 certificate (PEM or DER). If given, only signatures"
+ + " chaining to it are trusted.",
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
private MultipartFile certFile;
}
diff --git a/app/core/src/test/java/stirling/software/SPDF/controller/api/security/PasswordControllerTest.java b/app/core/src/test/java/stirling/software/SPDF/controller/api/security/PasswordControllerTest.java
index 58d28ad35a..1d29e3b3a9 100644
--- a/app/core/src/test/java/stirling/software/SPDF/controller/api/security/PasswordControllerTest.java
+++ b/app/core/src/test/java/stirling/software/SPDF/controller/api/security/PasswordControllerTest.java
@@ -609,6 +609,8 @@ class PasswordControllerTest {
request.setOwnerPassword("owner123");
request.setPassword("");
request.setKeyLength(256);
+ request.setPreventPrinting(true);
+ request.setPreventModify(true);
when(pdfDocumentFactory.load(any(MultipartFile.class), eq(""), eq(true)))
.thenAnswer(inv -> Loader.loadPDF(simplePdfBytes));
@@ -616,6 +618,17 @@ class PasswordControllerTest {
ResponseEntity<Resource> response = passwordController.addPassword(request);
assertNotNull(response.getBody());
+ byte[] protectedBytes = drainBody(response);
+ try (PDDocument reader = Loader.loadPDF(protectedBytes);
+ PDDocument owner = Loader.loadPDF(protectedBytes, "owner123")) {
+ assertTrue(reader.isEncrypted());
+ assertFalse(reader.getCurrentAccessPermission().isOwnerPermission());
+ assertFalse(reader.getCurrentAccessPermission().canPrint());
+ assertFalse(reader.getCurrentAccessPermission().canModify());
+ assertTrue(owner.getCurrentAccessPermission().isOwnerPermission());
+ assertTrue(owner.getCurrentAccessPermission().canPrint());
+ assertTrue(owner.getCurrentAccessPermission().canModify());
+ }
}
@Test
diff --git a/app/proprietary/src/main/java/stirling/software/proprietary/controller/api/converters/ConvertPdfToPdfUa.java b/app/proprietary/src/main/java/stirling/software/proprietary/controller/api/converters/ConvertPdfToPdfUa.java
index c28ce3fd07..3fb4424a2b 100644
--- a/app/proprietary/src/main/java/stirling/software/proprietary/controller/api/converters/ConvertPdfToPdfUa.java
+++ b/app/proprietary/src/main/java/stirling/software/proprietary/controller/api/converters/ConvertPdfToPdfUa.java
@@ -56,12 +56,12 @@ public class ConvertPdfToPdfUa {
resourceWeight = ResourceWeight.LARGE_WEIGHT)
@ToolIO(produces = ToolFormat.PDF)
@Operation(
- summary = "Convert a PDF to PDF/UA-1 or PDF/UA-2",
+ summary = "Make a PDF accessible for screen readers (tagged PDF/UA-1 or PDF/UA-2)",
description =
- "Tags the document, marks decorative content as artifacts, embeds fonts and"
- + " applies the document-level requirements of PDF/UA, then validates"
- + " the result. A conformance declaration is written only if validation"
- + " passes, so the returned file never claims more than it delivers.")
+ "Tags the document, marks decorative content as artifacts and embeds"
+ + " fonts, then validates. PDF/UA is declared only if validation passes"
+ + " (see the X-Stirling-UA-Declared header). Figures without alt text"
+ + " block it unless altText is given or figurePolicy=mark-decorative.")
public ResponseEntity<Resource> pdfToPdfUa(@ModelAttribute PdfToPdfUaRequest request)
throws IOException {
diff --git a/app/proprietary/src/main/java/stirling/software/proprietary/model/api/converters/PdfToPdfUaRequest.java b/app/proprietary/src/main/java/stirling/software/proprietary/model/api/converters/PdfToPdfUaRequest.java
index eeede01d0c..062245616b 100644
--- a/app/proprietary/src/main/java/stirling/software/proprietary/model/api/converters/PdfToPdfUaRequest.java
+++ b/app/proprietary/src/main/java/stirling/software/proprietary/model/api/converters/PdfToPdfUaRequest.java
@@ -64,10 +64,8 @@ public class PdfToPdfUaRequest extends PDFFile {
@Schema(
description =
- "Alternative descriptions for figures, as key=text pairs separated by newlines."
- + " Keys come from the accessibility-report endpoint's"
- + " figuresNeedingDescription list, for example \"0:12=Bar chart of"
- + " quarterly revenue\". Descriptions are never invented, so without"
- + " these an illustrated document cannot claim conformance.")
+ "Alt text for figures, one key=description per line, e.g. \"0:12=Bar"
+ + " chart of revenue\". Keys come from accessibility-report's"
+ + " figuresNeedingDescription.")
private String altText;
}
diff --git a/engine/src/stirling/models/tool_models.py b/engine/src/stirling/models/tool_models.py
index a36c6969f7..7039b2870d 100644
--- a/engine/src/stirling/models/tool_models.py
+++ b/engine/src/stirling/models/tool_models.py
@@ -65,7 +65,7 @@ class FontType(StrEnum):
class Position(IntEnum):
"""
- Position: 1-9 representing positions on the page (1=top-left, 2=top-center, 3=top-right, 4=middle-left, 5=middle-center, 6=middle-right, 7=bottom-left, 8=bottom-center, 9=bottom-right)
+ Where to place the number on a 3x3 grid: 1=top-left, 2=top-center, 3=top-right, 4=middle-left, 5=center, 6=middle-right, 7=bottom-left, 8=bottom-center, 9=bottom-right
"""
integer_1 = 1
@@ -87,7 +87,7 @@ class AddPageNumbersParams(ApiModel):
custom_margin: CustomMargin = Field(CustomMargin.medium, description="Custom margin: small/medium/large/x-large")
custom_text: str = Field(
"{n}",
- description="Custom text pattern. Available variables: {n}=current page number, {total}=total pages, {filename}=original filename",
+ description="Text for each number, e.g. 'Page {n} of {total}'. Placeholders: {n} (counts numbered pages only, from startingNumber), {total} (all pages in the file), {filename}.",
examples=["Page {n} of {total}"],
)
font_color: str = Field("#000000", description="Hex colour for page numbers (e.g. #FF0000)", examples=["#000000"])
@@ -99,8 +99,8 @@ class AddPageNumbersParams(ApiModel):
)
pages_to_number: str = Field("all", description="Which pages to number (e.g. '1,3-5,7' or 'all')")
position: Position = Field(
- ...,
- description="Position: 1-9 representing positions on the page (1=top-left, 2=top-center, 3=top-right, 4=middle-left, 5=middle-center, 6=middle-right, 7=bottom-left, 8=bottom-center, 9=bottom-right)",
+ Position.integer_8,
+ description="Where to place the number on a 3x3 grid: 1=top-left, 2=top-center, 3=top-right, 4=middle-left, 5=center, 6=middle-right, 7=bottom-left, 8=bottom-center, 9=bottom-right",
)
starting_number: int = Field(1, description="Starting number for page numbering", ge=1)
zero_pad: int = Field(
@@ -120,20 +120,20 @@ class KeyLength(IntEnum):
class AddPasswordParams(ApiModel):
"""
- This endpoint adds password protection to a PDF file. Users can specify a set of permissions that should be applied to the file. sourcePassword authenticates an existing protected source; preserveExisting changes permissions while retaining existing credentials. Omitting these options preserves the existing add-password behaviour. Input:PDF/PDF_ENCRYPTED Output:PDF_ENCRYPTED Type:SISO
+ password sets an optional opening password; omit or leave it empty for owner-only protection with ownerPassword. For new protection, prevent* restrictions require a nonempty ownerPassword different from password. sourcePassword opens an already protected file. With preserveExisting=true on an encrypted file, omitting or leaving ownerPassword empty retains the existing passwords and changes permissions; supplying ownerPassword replaces the permissions password while retaining the opening password. Replacement requires the existing opening password in password or sourcePassword. When sourcePassword is a distinct permissions password, password must contain the source's existing opening password. Input:PDF/PDF_ENCRYPTED Output:PDF_ENCRYPTED Type:SISO
"""
key_length: KeyLength = Field(KeyLength.integer_256, description="The length of the encryption key")
owner_password: SecretStr | None = Field(
None,
- description="The owner password to be added to the PDF file (Restricts what can be done with the document once it is opened)",
+ description="Password needed to change the prevent* restrictions. Must differ from password for them to hold.",
)
password: SecretStr | None = Field(
- None, description="The password to be added to the PDF file (Restricts the opening of the document itself.)"
+ None, description="Password needed to open the PDF. Leave empty to only add restrictions."
)
preserve_existing: bool = Field(
False,
- description="Change permissions while retaining existing passwords and encryption. A supplied ownerPassword replaces the permissions password.",
+ description="Change permissions on an encrypted source. Omitting or leaving ownerPassword empty retains its passwords and encryption; supplying ownerPassword replaces the permissions password while keeping the opening password and encryption key length.",
)
prevent_assembly: bool = Field(False, description="Whether document assembly is prevented")
prevent_extract_content: bool = Field(False, description="Whether content extraction is prevented")
@@ -153,7 +153,7 @@ class AddPasswordParams(ApiModel):
class Alphabet(StrEnum):
"""
- The selected alphabet of the stamp text
+ Font script matching stampText; roman for Latin text
"""
roman = "roman"
@@ -166,7 +166,7 @@ class Alphabet(StrEnum):
class CustomMargin1(StrEnum):
"""
- Specifies the margin size for the stamp.
+ Margin between the stamp and the page edge when placed by position
"""
small = "small"
@@ -177,7 +177,7 @@ class CustomMargin1(StrEnum):
class Position1(IntEnum):
"""
- Position for stamp placement based on a 1-9 grid (1: bottom-left, 2: bottom-center, 3: bottom-right, 4: middle-left, 5: middle-center, 6: middle-right, 7: top-left, 8: top-center, 9: top-right)
+ Where to place the stamp on a 3x3 grid: 1=top-left, 2=top-center, 3=top-right, 4=middle-left, 5=center, 6=middle-right, 7=bottom-left, 8=bottom-center, 9=bottom-right
"""
integer_1 = 1
@@ -206,18 +206,22 @@ class AddStampParams(ApiModel):
This endpoint adds a stamp to a given PDF file. Users can specify the stamp type (text, image or qr), rotation, opacity, width spacer, and height spacer. Input:PDF Output:PDF Type:SISO
"""
- alphabet: Alphabet = Field(Alphabet.roman, description="The selected alphabet of the stamp text")
- custom_color: str = Field("#d3d3d3", description="The color of the stamp text")
- custom_margin: CustomMargin1 = Field(CustomMargin1.medium, description="Specifies the margin size for the stamp.")
- font_size: float = Field(40, description="The font size of the stamp text and image in points.")
+ alphabet: Alphabet = Field(Alphabet.roman, description="Font script matching stampText; roman for Latin text")
+ custom_color: str = Field("#d3d3d3", description="Hex colour of the stamp text, e.g. #FF0000")
+ custom_margin: CustomMargin1 = Field(
+ CustomMargin1.medium, description="Margin between the stamp and the page edge when placed by position"
+ )
+ font_size: float = Field(
+ 40, description="Text size in points; for an image stamp, the image height (width keeps its aspect ratio)"
+ )
opacity: float = Field(0.5, description="The opacity of the stamp (0.0 - 1.0)")
override_x: float = Field(
-1,
- description="Override X coordinate for stamp placement. If set, it will override the position-based calculation. Negative value means no override.",
+ description="X in PDF user-space points. When both overrides are nonnegative, replaces position. Image and QR positions are clamped to the media box using the unrotated stamp size; text positions are not clamped. -1 = not set.",
)
override_y: float = Field(
-1,
- description="Override Y coordinate for stamp placement. If set, it will override the position-based calculation. Negative value means no override.",
+ description="Y in PDF user-space points. When both overrides are nonnegative, replaces position. Image and QR positions are clamped to the media box using the unrotated stamp size; text positions are not clamped. -1 = not set.",
)
page_numbers: str = Field(
"all",
@@ -225,12 +229,12 @@ class AddStampParams(ApiModel):
)
position: Position1 = Field(
Position1.integer_5,
- description="Position for stamp placement based on a 1-9 grid (1: bottom-left, 2: bottom-center, 3: bottom-right, 4: middle-left, 5: middle-center, 6: middle-right, 7: top-left, 8: top-center, 9: top-right)",
+ description="Where to place the stamp on a 3x3 grid: 1=top-left, 2=top-center, 3=top-right, 4=middle-left, 5=center, 6=middle-right, 7=bottom-left, 8=bottom-center, 9=bottom-right",
)
rotation: float = Field(0, description="The rotation of the stamp in degrees")
stamp_text: str | None = Field(
None,
- description="The stamp text, or the QR code content when stampType is qr; required when stampType is text or qr",
+ description="The stamp text, or the QR code content when stampType is qr; required when stampType is text or qr. For text stamps only, \\n starts a new line; QR content keeps the literal sequence. Both support @page, @total_pages, @date, @date{dd/MM/yyyy}, @time, @filename, @title, @author and @uuid (@@ for a literal @).",
)
stamp_type: StampType | None = Field(
None,
@@ -240,7 +244,7 @@ class AddStampParams(ApiModel):
class Alphabet1(StrEnum):
"""
- The selected alphabet
+ Font script matching watermarkText; roman for Latin text
"""
roman = "roman"
@@ -265,10 +269,12 @@ class AddWatermarkParams(ApiModel):
This endpoint adds a watermark to a given PDF file. Users can specify the watermark type (text or image), rotation, opacity, width spacer, and height spacer. Input:PDF Output:PDF Type:SISO
"""
- alphabet: Alphabet1 = Field(Alphabet1.roman, description="The selected alphabet")
- convert_pdf_to_image: bool = Field(False, description="Convert the redacted PDF to an image")
- custom_color: str = Field("#d3d3d3", description="The color for watermark")
- font_size: float = Field(12, description="The font size of the watermark text", ge=1.0)
+ alphabet: Alphabet1 = Field(Alphabet1.roman, description="Font script matching watermarkText; roman for Latin text")
+ convert_pdf_to_image: bool = Field(
+ False, description="Turn pages into images so the watermark is hard to remove; text becomes unselectable"
+ )
+ custom_color: str = Field("#d3d3d3", description="Hex colour of the watermark text, e.g. #FF0000")
+ font_size: float = Field(12, description="Text size in points; for an image watermark, the image height", ge=1.0)
height_spacer: int = Field(50, description="The height spacer between watermark elements", ge=0)
opacity: float = Field(0.5, description="The opacity of the watermark (0.0 - 1.0)")
rotation: float = Field(0, description="The rotation of the watermark in degrees")
@@ -282,16 +288,18 @@ class AddWatermarkParams(ApiModel):
class AutoRedactParams(ApiModel):
"""
- This endpoint automatically redacts text from a PDF file based on specified patterns. Users can provide text patterns to redact, with options for regex and whole word matching. Input:PDF Output:PDF Type:SISO
+ Removes matched page text and covers its location. Verification failures in native word/regex removal reject the request. Other native failures fall back to region content removal or rasterization. convertPDFToImage=true rasterizes every output page. Input:PDF Output:PDF Type:SISO
"""
case_sensitive: bool = Field(
False, description="Whether matching is case-sensitive, for plain text and regex alike"
)
- convert_pdf_to_image: bool = Field(False, description="Convert the redacted PDF to an image")
- custom_padding: float = Field(..., description="Custom padding for redaction")
+ convert_pdf_to_image: bool = Field(False, description="Rasterize every output page, making page text unselectable")
+ custom_padding: float = Field(0, description="Extra space around each redaction box, in points")
list_of_text: str = Field(
- ..., description="Newline-separated list of text to redact from the PDF", examples=["text\ntext2"]
+ ...,
+ description="Text to redact, one term per line (not comma-separated); each line is a regex when useRegex=true",
+ examples=["text\ntext2"],
)
redact_color: str = Field("#000000", description="The color for redaction")
use_regex: bool = Field(False, description="Whether to use regex for the listOfText")
@@ -300,7 +308,7 @@ class AutoRedactParams(ApiModel):
class AutoRenameParams(ApiModel):
"""
- This endpoint accepts a PDF file and attempts to extract its title or header based on heuristics. Input:PDF Output:PDF Type:SISO
+ Uses the largest text near the start as the file name; the pages are unchanged. Keeps the original name if no text is found. Input:PDF Output:PDF Type:SISO
"""
use_first_text_as_fallback: bool = Field(
@@ -321,7 +329,7 @@ class DetectionMode(StrEnum):
class AutoSplitPdfParams(ApiModel):
"""
- This endpoint accepts a PDF file, scans each page for a specific QR code, and splits the document at the QR code boundaries. The output is a zip file containing each separate PDF document. Input:PDF Output:PDF Type:SIMO
+ Splits at each divider page and returns a zip of the parts. Divider pages are dropped except a divider on page 1, which is retained. duplexMode=true also drops each divider's back page, including when the divider is retained. With no dividers you get one file; use split-pages or split-by-size-or-count instead. Input:PDF Output:PDF Type:SIMO
"""
duplex_mode: bool = Field(
@@ -415,7 +423,7 @@ class LineArtEdgeLevel(IntEnum):
class OptimizeLevel(IntEnum):
"""
- The level of optimization to apply to the PDF file. Higher values indicate greater compression but may reduce quality.
+ Compression level from 1 (lightest) to 9 (strongest). Or set expectedOutputSize to pick one automatically.
"""
integer_1 = 1
@@ -453,8 +461,8 @@ class CompressPdfParams(ApiModel):
False, description="Whether to normalize the PDF content for better compatibility. Default is false."
)
optimize_level: OptimizeLevel = Field(
- ...,
- description="The level of optimization to apply to the PDF file. Higher values indicate greater compression but may reduce quality.",
+ OptimizeLevel.integer_5,
+ description="Compression level from 1 (lightest) to 9 (strongest). Or set expectedOutputSize to pick one automatically.",
)
@@ -559,13 +567,15 @@ class EditTableOfContentsParams(ApiModel):
bookmark_data: str | None = Field(
None,
- description="Bookmark structure in JSON format",
+ description="The full new outline as a JSON array of {title, pageNumber, children[]}",
examples=[
'[{\\"title\\":\\"Chapter 1\\",\\"pageNumber\\":1,\\"children\\":[{\\"title\\":\\"Section 1.1\\",\\"pageNumber\\":2}]}]'
],
)
replace_existing: bool | None = Field(
- None, description="Whether to replace existing bookmarks or append to them", examples=[True]
+ None,
+ description="Ignored: existing bookmarks are always replaced. To add to them, read them with extract-bookmarks and send the full list.",
+ examples=[True],
)
@@ -603,7 +613,7 @@ class ExtractAttachmentsParams(ApiModel):
class ExtractImageScansParams(ApiModel):
"""
- This endpoint extracts image scans from a given file based on certain parameters. Users can specify angle threshold, tolerance, minimum area, minimum contour area, and border size. Input:PDF/IMAGE Output:IMAGE Type:SIMO
+ Finds, crops and straightens each photo on every page or image. Returns one PNG, or a zip when several are found. Input:PDF/IMAGE Output:IMAGE Type:SIMO
"""
angle_threshold: int = Field(10, description="The angle threshold for the image scan extraction")
@@ -641,7 +651,7 @@ class ExtractSingleAttachmentParams(ApiModel):
class FileToPdfParams(ApiModel):
"""
- This endpoint converts a given file to a PDF using Stirling Office Convert or LibreOffice Input:ANY Output:PDF Type:SISO
+ Converts Word, Excel, PowerPoint, OpenDocument, RTF, CSV and text files with LibreOffice, or Stirling Office Convert when useStirlingOfficeConvert=true or the admin setting is on. For web pages use html-to-pdf. Input:ANY Output:PDF Type:SISO
"""
use_stirling_office_convert: bool | None = None
@@ -649,14 +659,14 @@ class FileToPdfParams(ApiModel):
class FlattenParams(ApiModel):
"""
- Flattening just PDF form fields or converting each page to images to make text unselectable. Input:PDF Output:PDF Type:SISO
+ By default every page becomes an image, so text can no longer be selected. flattenOnlyForms=true only merges form fields into the page. Input:PDF Output:PDF Type:SISO
"""
flatten_only_forms: bool = Field(
- False, description="True to flatten only the forms, false to flatten full PDF (Convert page to image)"
+ False, description="True flattens only form fields; false turns every page into an image"
)
render_dpi: int | None = Field(
- None, description="Optional DPI for page rendering when flattening the full document.", ge=72
+ None, description="DPI for the page images when flattening full pages (default 300)", ge=72
)
@@ -679,7 +689,7 @@ class HtmlToPdfParams(ApiModel):
class ImageBox(ApiModel):
"""
- Rectangular areas to black out, each defined by a page number and bounding box coordinates.
+ Rectangular areas identified by page and bounding box. AUTO removes covered page content or rasterizes affected pages; OVERLAY_ONLY paints boxes without a content-removal step.
"""
page_index: int = Field(..., description="0-indexed page number (first page = 0).")
@@ -1044,7 +1054,7 @@ class PdfToMarkdownParams(ApiModel):
class OutputFormat1(StrEnum):
"""
- The output format type (PDF/A or PDF/X)
+ pdfa, pdfa-2, pdfa-2b = PDF/A-2b (usual choice); pdfa-1 = PDF/A-1b; pdfa-3, pdfa-3b = PDF/A-3b (allows attachments, e.g. e-invoice XML); pdfa-1a/2a/3a also tag, else fall back to level B (strict=true errors instead); pdfx = PDF/X.
"""
pdfa = "pdfa"
@@ -1064,7 +1074,10 @@ class PdfToPdfaParams(ApiModel):
This endpoint converts a PDF file to PDF/A using Stirling Office Convert, or to a PDF/A or PDF/X file using Ghostscript (preferred) or PDFBox/LibreOffice (fallback). PDF/A is a format designed for long-term archiving, while PDF/X is optimized for print production. Input:PDF Output:PDF Type:SISO
"""
- output_format: OutputFormat1 = Field(..., description="The output format type (PDF/A or PDF/X)")
+ output_format: OutputFormat1 = Field(
+ ...,
+ description="pdfa, pdfa-2, pdfa-2b = PDF/A-2b (usual choice); pdfa-1 = PDF/A-1b; pdfa-3, pdfa-3b = PDF/A-3b (allows attachments, e.g. e-invoice XML); pdfa-1a/2a/3a also tag, else fall back to level B (strict=true errors instead); pdfx = PDF/X.",
+ )
pdf_ua: bool = Field(
False,
description="Also declare PDF/UA accessibility alongside PDF/A. Only applies to the level A formats, and the claim is written only if it validates.",
@@ -1150,12 +1163,12 @@ class Profile1(StrEnum):
class PdfToUaParams(ApiModel):
"""
- Tags the document, marks decorative content as artifacts, embeds fonts and applies the document-level requirements of PDF/UA, then validates the result. A conformance declaration is written only if validation passes, so the returned file never claims more than it delivers. Input:PDF Output:PDF Type:SISO
+ Tags the document, marks decorative content as artifacts and embeds fonts, then validates. PDF/UA is declared only if validation passes (see the X-Stirling-UA-Declared header). Figures without alt text block it unless altText is given or figurePolicy=mark-decorative. Input:PDF Output:PDF Type:SISO
"""
alt_text: str | None = Field(
None,
- description='Alternative descriptions for figures, as key=text pairs separated by newlines. Keys come from the accessibility-report endpoint\'s figuresNeedingDescription list, for example "0:12=Bar chart of quarterly revenue". Descriptions are never invented, so without these an illustrated document cannot claim conformance.',
+ description='Alt text for figures, one key=description per line, e.g. "0:12=Bar chart of revenue". Keys come from accessibility-report\'s figuresNeedingDescription.',
)
embed_fonts: bool = Field(
True,
@@ -1253,14 +1266,7 @@ class PdfToXmlParams(ApiModel):
class CustomMode(StrEnum):
"""
- The custom mode for page rearrangement. Valid values are:
- CUSTOM: Uses order defined in PageNums DUPLICATE: Duplicate pages n times (if Page order defined as 4, then duplicates each page 4 times)REVERSE_ORDER: Reverses the order of all pages.
- 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, ...).
- ODD_EVEN_SPLIT: Splits and arranges pages into odd and even numbered pages.
- REMOVE_FIRST: Removes the first page.
- REMOVE_LAST: Removes the last page.
- REMOVE_FIRST_AND_LAST: Removes both the first and the last pages.
-
+ Omit or CUSTOM to use pageNumbers. Presets: REVERSE_ORDER, DUPLEX_SORT (fronts then backs reversed), BOOKLET_SORT, SIDE_STITCH_BOOKLET_SORT, ODD_EVEN_SPLIT (odd then even), REMOVE_FIRST, REMOVE_LAST, REMOVE_FIRST_AND_LAST, DUPLICATE (copies = pageNumbers, default 2).
"""
custom = "CUSTOM"
@@ -1282,7 +1288,7 @@ class RearrangePagesParams(ApiModel):
custom_mode: CustomMode | None = Field(
None,
- description="The custom mode for page rearrangement. Valid values are:\nCUSTOM: Uses order defined in PageNums DUPLICATE: Duplicate pages n times (if Page order defined as 4, then duplicates each page 4 times)REVERSE_ORDER: Reverses the order of all pages.\nDUPLEX_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, ...).\nODD_EVEN_SPLIT: Splits and arranges pages into odd and even numbered pages.\nREMOVE_FIRST: Removes the first page.\nREMOVE_LAST: Removes the last page.\nREMOVE_FIRST_AND_LAST: Removes both the first and the last pages.\n",
+ description="Omit or CUSTOM to use pageNumbers. Presets: REVERSE_ORDER, DUPLEX_SORT (fronts then backs reversed), BOOKLET_SORT, SIDE_STITCH_BOOKLET_SORT, ODD_EVEN_SPLIT (odd then even), REMOVE_FIRST, REMOVE_LAST, REMOVE_FIRST_AND_LAST, DUPLICATE (copies = pageNumbers, default 2).",
)
page_numbers: str = Field(
"all",
@@ -1292,7 +1298,7 @@ class RearrangePagesParams(ApiModel):
class Strategy(StrEnum):
"""
- Execution strategy hint for the redaction pipeline
+ AUTO removes covered page content and may rasterize affected pages. OVERLAY_ONLY draws text/range/image boxes without removal. IMAGE_FINALIZE rasterizes every output page. Whole-page wipes remove page content in every strategy; convertToImage also controls final rasterization independently.
"""
auto = "AUTO"
@@ -1306,14 +1312,17 @@ class Style(ApiModel):
"""
color: str = Field("#000000", description="Hex redaction box color")
- convert_to_image: bool = Field(False, description="Rasterize output to prevent text extraction")
+ convert_to_image: bool = Field(False, description="Rasterize every output page, making page text unselectable")
padding: float = Field(0, description="Extra padding around each box in points")
- strategy: Strategy = Field(Strategy.auto, description="Execution strategy hint for the redaction pipeline")
+ strategy: Strategy = Field(
+ Strategy.auto,
+ description="AUTO removes covered page content and may rasterize affected pages. OVERLAY_ONLY draws text/range/image boxes without removal. IMAGE_FINALIZE rasterizes every output page. Whole-page wipes remove page content in every strategy; convertToImage also controls final rasterization independently.",
+ )
class RedactionArea(ApiModel):
"""
- A list of areas that should be redacted
+ Areas whose covered page content is removed: page (from 1), x and y of the top-left corner from the page's top-left, width and height, in points
"""
color: str | None = Field(None, description="The color used to redact the specified area.")
@@ -1462,7 +1471,7 @@ class Angle(IntEnum):
class RotatePdfParams(ApiModel):
"""
- This endpoint rotates a given PDF file by a specified angle. The angle must be a multiple of 90. Input:PDF Output:PDF Type:SISO
+ Adds the angle (a multiple of 90) to every page's rotation. For per-page rotation in automated workflows, use auto-rotate-pdf with pageRotations. Input:PDF Output:PDF Type:SISO
"""
angle: Angle = Field(
@@ -1538,7 +1547,7 @@ class Colorspace(StrEnum):
class Quality(StrEnum):
"""
- Scan quality preset
+ Scan quality preset, used unless advancedEnabled is true
"""
low = "low"
@@ -1562,15 +1571,31 @@ class ScannerEffectParams(ApiModel):
Applies various effects to simulate a scanned document, including rotation, noise, and edge softening. Input:PDF Output:PDF Type:SISO
"""
- advanced_enabled: bool | None = Field(None, description="Whether advanced settings are enabled", examples=[False])
- blur: float | None = Field(None, description="Blur amount (0 = none, higher = more blur)", examples=[1.0])
+ advanced_enabled: bool | None = Field(
+ None,
+ description="Use brightness, contrast, blur, noise and resolution instead of the quality preset. Border, rotation, colorspace and yellowish always apply.",
+ examples=[False],
+ )
+ blur: float | None = Field(
+ None, description="Blur amount (0 = none, higher = more blur). Needs advancedEnabled=true.", examples=[1.0]
+ )
border: int | None = Field(None, description="Border thickness in pixels", examples=[20])
- brightness: float | None = Field(None, description="Brightness multiplier (1.0 = no change)", examples=[1.0])
+ brightness: float | None = Field(
+ None, description="Brightness multiplier (1.0 = no change). Needs advancedEnabled=true.", examples=[1.0]
+ )
colorspace: Colorspace | None = Field(None, description="Colorspace for output image", examples=["grayscale"])
- contrast: float | None = Field(None, description="Contrast multiplier (1.0 = no change)", examples=[1.0])
- noise: float | None = Field(None, description="Noise amount (0 = none, higher = more noise)", examples=[8.0])
- quality: Quality = Field(..., description="Scan quality preset", examples=["high"])
- resolution: int | None = Field(None, description="Rendering resolution in DPI", examples=[300])
+ contrast: float | None = Field(
+ None, description="Contrast multiplier (1.0 = no change). Needs advancedEnabled=true.", examples=[1.0]
+ )
+ noise: float | None = Field(
+ None, description="Noise amount (0 = none, higher = more noise). Needs advancedEnabled=true.", examples=[8.0]
+ )
+ quality: Quality = Field(
+ ..., description="Scan quality preset, used unless advancedEnabled is true", examples=["high"]
+ )
+ resolution: int | None = Field(
+ None, description="Rendering resolution in DPI. Needs advancedEnabled=true.", examples=[300]
+ )
rotate: int | None = Field(None, description="Base rotation in degrees", examples=[0])
rotate_variance: int | None = Field(None, description="Random rotation variance in degrees", examples=[2])
rotation: Rotation = Field(..., description="Rotation preset", examples=["none"])
@@ -1578,16 +1603,27 @@ class ScannerEffectParams(ApiModel):
yellowish: bool | None = Field(None, description="Simulate yellowed paper", examples=[False])
+class SplitType(IntEnum):
+ """
+ 0 = by file size, 1 = by pages per file, 2 = by number of files
+ """
+
+ integer_0 = 0
+ integer_1 = 1
+ integer_2 = 2
+
+
class SplitBySizeOrCountParams(ApiModel):
"""
split PDF into multiple paged documents based on size/count, ie if 20 pages and split into 5, it does 5 documents each 4 pages if 10MB and each page is 1MB and you enter 2MB then 5 docs each 2MB (rounded so that it accepts 1.9MB but not 2.1MB) Input:PDF Output:PDF Type:SIMO
"""
- split_type: int = Field(
- 0, description="Determines the type of split: 0 for size, 1 for page count, 2 for document count"
+ split_type: SplitType = Field(
+ SplitType.integer_0, description="0 = by file size, 1 = by pages per file, 2 = by number of files"
)
split_value: str = Field(
- "10MB", description="Value for split: size in MB (e.g., '10MB') or number of pages (e.g., '5')"
+ "10MB",
+ description="For splitType 0 a size like '500KB' or '10MB' (a bare number means MB); for 1 and 2 a whole number",
)
@@ -1642,13 +1678,7 @@ class SplitPdfByChaptersParams(ApiModel):
class SplitMode(StrEnum):
"""
- Modes for page split. Valid values are:
- SPLIT_ALL_EXCEPT_FIRST_AND_LAST: Splits all except the first and the last pages.
- SPLIT_ALL_EXCEPT_FIRST: Splits all except the first page.
- SPLIT_ALL_EXCEPT_LAST: Splits all except the last page.
- SPLIT_ALL: Splits all pages.
- CUSTOM: Custom split.
-
+ Which pages to split (default SPLIT_ALL). SPLIT_ALL splits every page; SPLIT_ALL_EXCEPT_FIRST, SPLIT_ALL_EXCEPT_LAST and SPLIT_ALL_EXCEPT_FIRST_AND_LAST keep those pages whole; CUSTOM splits only pageNumbers.
"""
custom = "CUSTOM"
@@ -1672,7 +1702,7 @@ class SplitPdfBySectionsParams(ApiModel):
)
split_mode: SplitMode | None = Field(
None,
- description="Modes for page split. Valid values are:\nSPLIT_ALL_EXCEPT_FIRST_AND_LAST: Splits all except the first and the last pages.\nSPLIT_ALL_EXCEPT_FIRST: Splits all except the first page.\nSPLIT_ALL_EXCEPT_LAST: Splits all except the last page.\nSPLIT_ALL: Splits all pages.\nCUSTOM: Custom split.\n",
+ description="Which pages to split (default SPLIT_ALL). SPLIT_ALL splits every page; SPLIT_ALL_EXCEPT_FIRST, SPLIT_ALL_EXCEPT_LAST and SPLIT_ALL_EXCEPT_FIRST_AND_LAST keep those pages whole; CUSTOM splits only pageNumbers.",
)
vertical_divisions: int = Field(1, description="Number of vertical divisions for each PDF page", ge=0, le=50)
@@ -1690,7 +1720,7 @@ class SvgToPdfParams(ApiModel):
class TextRange(ApiModel):
"""
- Text ranges to redact by specifying a start and end anchor phrase. All content between the two phrases (inclusive) is redacted. Anchors work best when short and unique. They must appear verbatim in the document.
+ Text located using start and end anchor phrases (inclusive). AUTO removes selected page content or rasterizes affected pages; OVERLAY_ONLY paints boxes without a content-removal step.
"""
end_string: str = Field(
@@ -1735,12 +1765,12 @@ class Trapped(StrEnum):
class UpdateMetadataParams(ApiModel):
"""
- This endpoint allows you to update the metadata of a given PDF file. You can add, modify, or delete standard and custom metadata fields. Input:PDF Output:PDF Type:SISO
+ Standard fields left out are cleared, so send the current values of the others too (see get-info-on-pdf). Dates use yyyy/MM/dd HH:mm:ss. deleteAll=true removes all metadata. Input:PDF Output:PDF Type:SISO
"""
all_request_params: dict[str, str] | None = Field(
None,
- description="Map list of key and value of custom parameters. Note these must start with customKey and customValue if they are non-standard",
+ description='Custom metadata to add or update, e.g. {"Department":"Finance"}. Existing custom keys are kept. customKeyN/customValueN pairs also work.',
)
author: str | None = Field(None, description="The author of the document. Omit to remove it.", examples=["author"])
creation_date: str | None = Field(
@@ -1752,7 +1782,9 @@ class UpdateMetadataParams(ApiModel):
creator: str | None = Field(
None, description="The creator of the document. Omit to remove it.", examples=["creator"]
)
- delete_all: bool = Field(False, description="Delete all metadata if set to true")
+ delete_all: bool = Field(
+ False, description="True removes all metadata, including XMP, and ignores the other fields"
+ )
keywords: str | None = Field(
None, description="The keywords for the document. Omit to remove it.", examples=["keywords"]
)
@@ -1795,7 +1827,7 @@ class OutputFormat6(StrEnum):
class VectorToPdfParams(ApiModel):
"""
- Converts PostScript vector inputs (PS, EPS, EPSF) to PDF using Ghostscript. Input:POSTSCRIPT Output:PDF Type:SISO
+ Converts PS, EPS and EPSF with Ghostscript; outputFormat is ignored. XPS and PCL are not supported. Input:POSTSCRIPT Output:PDF Type:SISO
"""
output_format: OutputFormat6 = Field(OutputFormat6.eps, description="Target vector format extension")
@@ -1832,19 +1864,20 @@ class AutoRotatePdfParams(ApiModel):
class RedactExecuteParams(ApiModel):
"""
- Unified redaction endpoint that accepts exact strings, regex patterns, and page numbers in a single request. Supports execution strategy hints. Input:PDF Output:PDF Type:SISO
+ Redacts exact text, regex matches, anchored ranges, image regions and whole pages. AUTO removes covered page content, with per-page rasterization when needed. OVERLAY_ONLY skips removal for text/range/image boxes; whole-page wipes still remove page content. style.convertToImage=true or IMAGE_FINALIZE rasterizes every output page. Verification failures in native word/regex removal reject the request. Input:PDF Output:PDF Type:SISO
"""
image_boxes: list[ImageBox] | None = Field(
- None, description="Rectangular areas to black out, each defined by a page number and bounding box coordinates."
+ None,
+ description="Rectangular areas identified by page and bounding box. AUTO removes covered page content or rasterizes affected pages; OVERLAY_ONLY paints boxes without a content-removal step.",
)
ranges: list[TextRange] | None = Field(
None,
- description="Text ranges to redact by specifying a start and end anchor phrase. All content between the two phrases (inclusive) is redacted. Anchors work best when short and unique. They must appear verbatim in the document.",
+ description="Text located using start and end anchor phrases (inclusive). AUTO removes selected page content or rasterizes affected pages; OVERLAY_ONLY paints boxes without a content-removal step.",
)
redact_image_pages: list[int] | None = Field(
None,
- description="1-indexed page numbers to redact all detected images from. Pass an empty list to redact images from every page. Omit or pass null to skip image redaction entirely.",
+ description="1-indexed pages whose detected image regions are redacted; an empty list means every page, null skips it. AUTO removes covered page content or rasterizes affected pages; OVERLAY_ONLY paints boxes.",
)
regex_patterns: list[str] | None = Field(
None,
@@ -1862,15 +1895,21 @@ class RedactExecuteParams(ApiModel):
class RedactParams(ApiModel):
"""
- This endpoint redacts content from a PDF file based on manually specified areas. Users can specify areas to redact and optionally convert the PDF to an image. Input:PDF Output:PDF Type:SISO
+ Removes covered page content from selected areas and wipes selected whole pages. An affected page may be rasterized if native region removal cannot safely clear it. convertPDFToImage=true rasterizes every output page. Input:PDF Output:PDF Type:SISO
"""
- convert_pdf_to_image: bool = Field(False, description="Convert the redacted PDF to an image")
+ convert_pdf_to_image: bool = Field(
+ False,
+ description="Rasterize every output page, making page text unselectable. Redaction areas already remove covered page content by default.",
+ )
page_numbers: str | None = Field(
- None, description="Pages to black out completely, e.g. '1,3-5'. Omit to redact only the listed areas."
+ None, description="Pages to wipe completely, e.g. '1,3-5'. Omit to redact only the listed areas."
)
page_redaction_color: str = Field("#000000", description="The color used to fully redact certain pages")
- redactions: list[RedactionArea] = Field(..., description="A list of areas that should be redacted")
+ redactions: list[RedactionArea] = Field(
+ ...,
+ description="Areas whose covered page content is removed: page (from 1), x and y of the top-left corner from the page's top-left, width and height, in points",
+ )
class Model(
diff --git a/frontend/src/editor/core/components/startup/StartupPrompts.test.tsx b/frontend/src/editor/core/components/startup/StartupPrompts.test.tsx
index 9a7c572a75..1935929710 100644
--- a/frontend/src/editor/core/components/startup/StartupPrompts.test.tsx
+++ b/frontend/src/editor/core/components/startup/StartupPrompts.test.tsx
@@ -272,7 +272,9 @@ describe("startup prompts", () => {
"false",
);
fireEvent.click(screen.getByText("Finish MFA"));
- expect(await screen.findByText("Company agreement")).toBeVisible();
+ expect(
+ await screen.findByText("Company agreement", {}, { timeout: 5000 }),
+ ).toBeVisible();
expect(h.tracking).not.toHaveBeenCalled();
fireEvent.click(
screen.getByRole("button", { name: "loginAgreementAccept" }),
diff --git a/frontend/src/editor/core/types/toolApiTypes.ts b/frontend/src/editor/core/types/toolApiTypes.ts
index 2ca9920058..1877a195d7 100644
--- a/frontend/src/editor/core/types/toolApiTypes.ts
+++ b/frontend/src/editor/core/types/toolApiTypes.ts
@@ -11,7 +11,7 @@ export interface AccessibilityReportRequest {
}
export interface AddAttachmentRequest {
/**
- * The image file to be overlaid onto the PDF.
+ * Files to attach to the PDF (up to 50 MB each, 200 MB in total)
*/
attachments: File[];
/**
@@ -31,7 +31,7 @@ export interface AddPageNumbersRequest {
*/
customMargin?: "small" | "medium" | "large" | "x-large";
/**
- * Custom text pattern. Available variables: {n}=current page number, {total}=total pages, {filename}=original filename
+ * Text for each number, e.g. 'Page {n} of {total}'. Placeholders: {n} (counts numbered pages only, from startingNumber), {total} (all pages in the file), {filename}.
*/
customText?: string;
/**
@@ -55,9 +55,9 @@ export interface AddPageNumbersRequest {
*/
pagesToNumber?: string;
/**
- * Position: 1-9 representing positions on the page (1=top-left, 2=top-center, 3=top-right, 4=middle-left, 5=middle-center, 6=middle-right, 7=bottom-left, 8=bottom-center, 9=bottom-right)
+ * Where to place the number on a 3x3 grid: 1=top-left, 2=top-center, 3=top-right, 4=middle-left, 5=center, 6=middle-right, 7=bottom-left, 8=bottom-center, 9=bottom-right
*/
- position: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
+ position?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
/**
* Starting number for page numbering
*/
@@ -73,15 +73,15 @@ export interface AddPasswordRequest {
*/
keyLength?: 40 | 128 | 256;
/**
- * The owner password to be added to the PDF file (Restricts what can be done with the document once it is opened)
+ * Password needed to change the prevent* restrictions. Must differ from password for them to hold.
*/
ownerPassword?: string;
/**
- * The password to be added to the PDF file (Restricts the opening of the document itself.)
+ * Password needed to open the PDF. Leave empty to only add restrictions.
*/
password?: string;
/**
- * Change permissions while retaining existing passwords and encryption. A supplied ownerPassword replaces the permissions password.
+ * Change permissions on an encrypted source. Omitting or leaving ownerPassword empty retains its passwords and encryption; supplying ownerPassword replaces the permissions password while keeping the opening password and encryption key length.
*/
preserveExisting?: boolean;
/**
@@ -123,19 +123,19 @@ export interface AddPasswordRequest {
}
export interface AddStampRequest {
/**
- * The selected alphabet of the stamp text
+ * Font script matching stampText; roman for Latin text
*/
alphabet?: "roman" | "arabic" | "japanese" | "korean" | "chinese" | "thai";
/**
- * The color of the stamp text
+ * Hex colour of the stamp text, e.g. #FF0000
*/
customColor?: string;
/**
- * Specifies the margin size for the stamp.
+ * Margin between the stamp and the page edge when placed by position
*/
customMargin?: "small" | "medium" | "large" | "x-large";
/**
- * The font size of the stamp text and image in points.
+ * Text size in points; for an image stamp, the image height (width keeps its aspect ratio)
*/
fontSize?: number;
/**
@@ -143,11 +143,11 @@ export interface AddStampRequest {
*/
opacity?: number;
/**
- * Override X coordinate for stamp placement. If set, it will override the position-based calculation. Negative value means no override.
+ * X in PDF user-space points. When both overrides are nonnegative, replaces position. Image and QR positions are clamped to the media box using the unrotated stamp size; text positions are not clamped. -1 = not set.
*/
overrideX?: number;
/**
- * Override Y coordinate for stamp placement. If set, it will override the position-based calculation. Negative value means no override.
+ * Y in PDF user-space points. When both overrides are nonnegative, replaces position. Image and QR positions are clamped to the media box using the unrotated stamp size; text positions are not clamped. -1 = not set.
*/
overrideY?: number;
/**
@@ -155,7 +155,7 @@ export interface AddStampRequest {
*/
pageNumbers?: string;
/**
- * Position for stamp placement based on a 1-9 grid (1: bottom-left, 2: bottom-center, 3: bottom-right, 4: middle-left, 5: middle-center, 6: middle-right, 7: top-left, 8: top-center, 9: top-right)
+ * Where to place the stamp on a 3x3 grid: 1=top-left, 2=top-center, 3=top-right, 4=middle-left, 5=center, 6=middle-right, 7=bottom-left, 8=bottom-center, 9=bottom-right
*/
position?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
/**
@@ -164,7 +164,7 @@ export interface AddStampRequest {
rotation?: number;
stampImage?: File;
/**
- * The stamp text, or the QR code content when stampType is qr; required when stampType is text or qr
+ * The stamp text, or the QR code content when stampType is qr; required when stampType is text or qr. For text stamps only, \n starts a new line; QR content keeps the literal sequence. Both support @page, @total_pages, @date, @date{dd/MM/yyyy}, @time, @filename, @title, @author and @uuid (@@ for a literal @).
*/
stampText?: string;
/**
@@ -174,19 +174,19 @@ export interface AddStampRequest {
}
export interface AddWatermarkRequest {
/**
- * The selected alphabet
+ * Font script matching watermarkText; roman for Latin text
*/
alphabet?: "roman" | "arabic" | "japanese" | "korean" | "chinese" | "thai";
/**
- * Convert the redacted PDF to an image
+ * Turn pages into images so the watermark is hard to remove; text becomes unselectable
*/
convertPDFToImage?: boolean;
/**
- * The color for watermark
+ * Hex colour of the watermark text, e.g. #FF0000
*/
customColor?: string;
/**
- * The font size of the watermark text
+ * Text size in points; for an image watermark, the image height
*/
fontSize?: number;
/**
@@ -473,11 +473,11 @@ export interface DeleteAttachmentRequest {
}
export interface EditTableOfContentsRequest {
/**
- * Bookmark structure in JSON format
+ * The full new outline as a JSON array of {title, pageNumber, children[]}
*/
bookmarkData?: string;
/**
- * Whether to replace existing bookmarks or append to them
+ * Ignored: existing bookmarks are always replaced. To add to them, read them with extract-bookmarks and send the full list.
*/
replaceExisting?: boolean;
}
@@ -551,11 +551,11 @@ export interface FileSizeRequest {
export type FlattenPortfolioRequest = Record<string, never>;
export interface FlattenRequest {
/**
- * True to flatten only the forms, false to flatten full PDF (Convert page to image)
+ * True flattens only form fields; false turns every page into an image
*/
flattenOnlyForms?: boolean;
/**
- * Optional DPI for page rendering when flattening the full document.
+ * DPI for the page images when flattening full pages (default 300)
*/
renderDpi?: number;
}
@@ -639,11 +639,11 @@ export interface IntegrationPurviewReadLabelRequest {
export type ListAttachmentsRequest = Record<string, never>;
export interface ManualRedactPdfRequest {
/**
- * Convert the redacted PDF to an image
+ * Rasterize every output page, making page text unselectable. Redaction areas already remove covered page content by default.
*/
convertPDFToImage?: boolean;
/**
- * Pages to black out completely, e.g. '1,3-5'. Omit to redact only the listed areas.
+ * Pages to wipe completely, e.g. '1,3-5'. Omit to redact only the listed areas.
*/
pageNumbers?: string;
/**
@@ -651,12 +651,12 @@ export interface ManualRedactPdfRequest {
*/
pageRedactionColor?: string;
/**
- * A list of areas that should be redacted
+ * Areas whose covered page content is removed: page (from 1), x and y of the top-left corner from the page's top-left, width and height, in points
*/
redactions: RedactionArea[];
}
/**
- * A list of areas that should be redacted
+ * Areas whose covered page content is removed: page (from 1), x and y of the top-left corner from the page's top-left, width and height, in points
*/
export interface RedactionArea {
/**
@@ -768,11 +768,11 @@ export interface MergePdfsRequest {
}
export interface MetadataRequest {
/**
- * Map list of key and value of custom parameters. Note these must start with customKey and customValue if they are non-standard
+ * Custom metadata to add or update, e.g. {"Department":"Finance"}. Existing custom keys are kept. customKeyN/customValueN pairs also work.
*/
allRequestParams?: {
/**
- * Map list of key and value of custom parameters. Note these must start with customKey and customValue if they are non-standard
+ * Custom metadata to add or update, e.g. {"Department":"Finance"}. Existing custom keys are kept. customKeyN/customValueN pairs also work.
*/
[k: string]: string | undefined;
};
@@ -789,7 +789,7 @@ export interface MetadataRequest {
*/
creator?: string;
/**
- * Delete all metadata if set to true
+ * True removes all metadata, including XMP, and ignores the other fields
*/
deleteAll?: boolean;
/**
@@ -851,43 +851,43 @@ export interface OptimizePdfRequest {
*/
normalize?: boolean;
/**
- * The level of optimization to apply to the PDF file. Higher values indicate greater compression but may reduce quality.
+ * Compression level from 1 (lightest) to 9 (strongest). Or set expectedOutputSize to pick one automatically.
*/
- optimizeLevel: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
+ optimizeLevel?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
}
export interface OverlayImageRequest {
/**
- * Whether to overlay the image onto every page of the PDF.
+ * Draw the image on every page; when false, only on page 1.
*/
everyPage?: boolean;
imageFile: File;
/**
- * The x-coordinate at which to place the top-left corner of the image.
+ * X of the image's lower-left corner in PDF user-space points
*/
x?: number;
/**
- * The y-coordinate at which to place the top-left corner of the image.
+ * Y of the image's lower-left corner in PDF user-space points
*/
y?: number;
}
export interface OverlayPdfsRequest {
/**
- * 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.
+ * FixedRepeatOverlay only: one repeat count per overlay file
*/
counts?: number[];
/**
- * 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.
+ * PDFs drawn onto the base PDF's pages, in the order set by overlayMode
*/
overlayFiles: File[];
/**
- * The mode of overlaying: 'SequentialOverlay' for sequential application, 'InterleavedOverlay' for round-robin application, 'FixedRepeatOverlay' for fixed repetition based on provided counts
+ * SequentialOverlay uses each overlay file's pages in order and repeats as needed. With multiple files it starts with the second file, proceeds through the remaining files, then wraps to the first (e.g. B, A for files [A, B]). A single file repeats from its first page. InterleavedOverlay takes each overlay file in turn. FixedRepeatOverlay uses counts.
*/
overlayMode:
| "SequentialOverlay"
| "InterleavedOverlay"
| "FixedRepeatOverlay";
/**
- * Overlay position 0 is Foregound, 1 is Background
+ * 0 = foreground (over the content), 1 = background (behind it)
*/
overlayPosition: 0 | 1;
}
@@ -945,7 +945,7 @@ export interface PageSizeRequest {
}
export interface PdfToPdfARequest {
/**
- * The output format type (PDF/A or PDF/X)
+ * pdfa, pdfa-2, pdfa-2b = PDF/A-2b (usual choice); pdfa-1 = PDF/A-1b; pdfa-3, pdfa-3b = PDF/A-3b (allows attachments, e.g. e-invoice XML); pdfa-1a/2a/3a also tag, else fall back to level B (strict=true errors instead); pdfx = PDF/X.
*/
outputFormat:
| "pdfa"
@@ -973,7 +973,7 @@ export interface PdfToPdfARequest {
}
export interface PdfToPdfUaRequest {
/**
- * Alternative descriptions for figures, as key=text pairs separated by newlines. Keys come from the accessibility-report endpoint's figuresNeedingDescription list, for example "0:12=Bar chart of quarterly revenue". Descriptions are never invented, so without these an illustrated document cannot claim conformance.
+ * Alt text for figures, one key=description per line, e.g. "0:12=Bar chart of revenue". Keys come from accessibility-report's figuresNeedingDescription.
*/
altText?: string;
/**
@@ -1099,14 +1099,7 @@ export interface ProcessPdfWithOcrRequest {
}
export interface RearrangePagesRequest {
/**
- * The custom mode for page rearrangement. Valid values are:
- * CUSTOM: Uses order defined in PageNums DUPLICATE: Duplicate pages n times (if Page order defined as 4, then duplicates each page 4 times)REVERSE_ORDER: Reverses the order of all pages.
- * 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, ...).
- * ODD_EVEN_SPLIT: Splits and arranges pages into odd and even numbered pages.
- * REMOVE_FIRST: Removes the first page.
- * REMOVE_LAST: Removes the last page.
- * REMOVE_FIRST_AND_LAST: Removes both the first and the last pages.
- *
+ * Omit or CUSTOM to use pageNumbers. Presets: REVERSE_ORDER, DUPLEX_SORT (fronts then backs reversed), BOOKLET_SORT, SIDE_STITCH_BOOKLET_SORT, ODD_EVEN_SPLIT (odd then even), REMOVE_FIRST, REMOVE_LAST, REMOVE_FIRST_AND_LAST, DUPLICATE (copies = pageNumbers, default 2).
*/
customMode?:
| "CUSTOM"
@@ -1126,15 +1119,15 @@ export interface RearrangePagesRequest {
}
export interface RedactExecuteRequest {
/**
- * Rectangular areas to black out, each defined by a page number and bounding box coordinates.
+ * Rectangular areas identified by page and bounding box. AUTO removes covered page content or rasterizes affected pages; OVERLAY_ONLY paints boxes without a content-removal step.
*/
imageBoxes?: ImageBox[];
/**
- * Text ranges to redact by specifying a start and end anchor phrase. All content between the two phrases (inclusive) is redacted. Anchors work best when short and unique. They must appear verbatim in the document.
+ * Text located using start and end anchor phrases (inclusive). AUTO removes selected page content or rasterizes affected pages; OVERLAY_ONLY paints boxes without a content-removal step.
*/
ranges?: TextRange[];
/**
- * 1-indexed page numbers to redact all detected images from. Pass an empty list to redact images from every page. Omit or pass null to skip image redaction entirely.
+ * 1-indexed pages whose detected image regions are redacted; an empty list means every page, null skips it. AUTO removes covered page content or rasterizes affected pages; OVERLAY_ONLY paints boxes.
*/
redactImagePages?: number[];
/**
@@ -1152,7 +1145,7 @@ export interface RedactExecuteRequest {
wipePages?: number[];
}
/**
- * Rectangular areas to black out, each defined by a page number and bounding box coordinates.
+ * Rectangular areas identified by page and bounding box. AUTO removes covered page content or rasterizes affected pages; OVERLAY_ONLY paints boxes without a content-removal step.
*/
export interface ImageBox {
/**
@@ -1177,7 +1170,7 @@ export interface ImageBox {
y2: number;
}
/**
- * Text ranges to redact by specifying a start and end anchor phrase. All content between the two phrases (inclusive) is redacted. Anchors work best when short and unique. They must appear verbatim in the document.
+ * Text located using start and end anchor phrases (inclusive). AUTO removes selected page content or rasterizes affected pages; OVERLAY_ONLY paints boxes without a content-removal step.
*/
export interface TextRange {
/**
@@ -1198,7 +1191,7 @@ export interface RedactStyle {
*/
color?: string;
/**
- * Rasterize output to prevent text extraction
+ * Rasterize every output page, making page text unselectable
*/
convertToImage?: boolean;
/**
@@ -1206,7 +1199,7 @@ export interface RedactStyle {
*/
padding?: number;
/**
- * Execution strategy hint for the redaction pipeline
+ * AUTO removes covered page content and may rasterize affected pages. OVERLAY_ONLY draws text/range/image boxes without removal. IMAGE_FINALIZE rasterizes every output page. Whole-page wipes remove page content in every strategy; convertToImage also controls final rasterization independently.
*/
strategy?: "AUTO" | "OVERLAY_ONLY" | "IMAGE_FINALIZE";
}
@@ -1216,15 +1209,15 @@ export interface RedactPdfRequest {
*/
caseSensitive?: boolean;
/**
- * Convert the redacted PDF to an image
+ * Rasterize every output page, making page text unselectable
*/
convertPDFToImage?: boolean;
/**
- * Custom padding for redaction
+ * Extra space around each redaction box, in points
*/
- customPadding: number;
+ customPadding?: number;
/**
- * Newline-separated list of text to redact from the PDF
+ * Text to redact, one term per line (not comma-separated); each line is a regex when useRegex=true
*/
listOfText: string;
/**
@@ -1366,11 +1359,11 @@ export interface ScalePagesRequest {
}
export interface ScannerEffectRequest {
/**
- * Whether advanced settings are enabled
+ * Use brightness, contrast, blur, noise and resolution instead of the quality preset. Border, rotation, colorspace and yellowish always apply.
*/
advancedEnabled?: boolean;
/**
- * Blur amount (0 = none, higher = more blur)
+ * Blur amount (0 = none, higher = more blur). Needs advancedEnabled=true.
*/
blur?: number;
/**
@@ -1378,7 +1371,7 @@ export interface ScannerEffectRequest {
*/
border?: number;
/**
- * Brightness multiplier (1.0 = no change)
+ * Brightness multiplier (1.0 = no change). Needs advancedEnabled=true.
*/
brightness?: number;
/**
@@ -1386,19 +1379,19 @@ export interface ScannerEffectRequest {
*/
colorspace?: "grayscale" | "color";
/**
- * Contrast multiplier (1.0 = no change)
+ * Contrast multiplier (1.0 = no change). Needs advancedEnabled=true.
*/
contrast?: number;
/**
- * Noise amount (0 = none, higher = more noise)
+ * Noise amount (0 = none, higher = more noise). Needs advancedEnabled=true.
*/
noise?: number;
/**
- * Scan quality preset
+ * Scan quality preset, used unless advancedEnabled is true
*/
quality: "low" | "medium" | "high";
/**
- * Rendering resolution in DPI
+ * Rendering resolution in DPI. Needs advancedEnabled=true.
*/
resolution?: number;
/**
@@ -1537,13 +1530,7 @@ export interface SplitPdfBySectionsRequest {
*/
pageNumbers?: string;
/**
- * Modes for page split. Valid values are:
- * SPLIT_ALL_EXCEPT_FIRST_AND_LAST: Splits all except the first and the last pages.
- * SPLIT_ALL_EXCEPT_FIRST: Splits all except the first page.
- * SPLIT_ALL_EXCEPT_LAST: Splits all except the last page.
- * SPLIT_ALL: Splits all pages.
- * CUSTOM: Custom split.
- *
+ * Which pages to split (default SPLIT_ALL). SPLIT_ALL splits every page; SPLIT_ALL_EXCEPT_FIRST, SPLIT_ALL_EXCEPT_LAST and SPLIT_ALL_EXCEPT_FIRST_AND_LAST keep those pages whole; CUSTOM splits only pageNumbers.
*/
splitMode?:
| "CUSTOM"
@@ -1558,11 +1545,11 @@ export interface SplitPdfBySectionsRequest {
}
export interface SplitPdfBySizeOrCountRequest {
/**
- * Determines the type of split: 0 for size, 1 for page count, 2 for document count
+ * 0 = by file size, 1 = by pages per file, 2 = by number of files
*/
- splitType?: number;
+ splitType?: 0 | 1 | 2;
/**
- * Value for split: size in MB (e.g., '10MB') or number of pages (e.g., '5')
+ * For splitType 0 a size like '500KB' or '10MB' (a bare number means MB); for 1 and 2 a whole number
*/
splitValue?: string;
}