#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
# AUTO-GENERATED FILE. DO NOT EDIT.
# Generated by scripts/generate_tool_models.py from Java OpenAPI spec (SwaggerDoc.json).
# ruff: noqa: E501
from __future__ import annotations
from enum import Enum, IntEnum, StrEnum
from pydantic import Field, RootModel, SecretStr
from stirling.models.base import ApiModel
class Profile(StrEnum):
"""
Profile to check against
"""
ua1 = "ua1"
ua2 = "ua2"
class AccessibilityReportParams(ApiModel):
"""
Validates the document against PDF/UA and reports what fails, which failures can be fixed automatically, and which checks still need a person. Does not modify the file. Input:PDF Output:JSON Type:SISO
"""
profile: Profile = Field(Profile.ua1, description="Profile to check against")
class AddCommentsParams(ApiModel):
"""
Attaches PDF Text (sticky-note) annotations to the document. Each CommentSpec can either supply absolute coordinates or an `anchorText` hint; when provided, the tool locates the first matching line on the target page and anchors the icon there (falling back to the coordinates if no match). Input:PDF Output:PDF Type:SISO
"""
comments: str = Field(
...,
description="JSON array of comment specs. Each element has: {pageIndex, x, y, width, height, text, author?, subject?}. Coordinates are PDF user-space with origin at the page's bottom-left.",
examples=[
'[{"pageIndex":0,"x":72,"y":720,"width":20,"height":20,"text":"Check this paragraph","author":"Reviewer","subject":"Unclear wording"}]'
],
)
class CustomMargin(StrEnum):
"""
Custom margin: small/medium/large/x-large
"""
small = "small"
medium = "medium"
large = "large"
x_large = "x-large"
class FontType(StrEnum):
"""
Font type for page numbers
"""
helvetica = "helvetica"
courier = "courier"
times = "times"
class Position(IntEnum):
"""
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
integer_2 = 2
integer_3 = 3
integer_4 = 4
integer_5 = 5
integer_6 = 6
integer_7 = 7
integer_8 = 8
integer_9 = 9
class AddPageNumbersParams(ApiModel):
"""
This operation takes an input PDF file and adds page numbers to it. Input:PDF Output:PDF Type:SISO
"""
custom_margin: CustomMargin = Field(CustomMargin.medium, description="Custom margin: small/medium/large/x-large")
custom_text: str = Field(
"{n}",
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"])
font_size: float = Field(12, description="Font size for page numbers", ge=1.0)
font_type: FontType = Field(..., description="Font type for page numbers")
page_numbers: str = Field(
"all",
description="The pages to select, Supports ranges (e.g., '1,3,5-9'), or 'all' or functions in the format 'an+b' where 'a' is the multiplier of the page number 'n', and 'b' is a constant (e.g., '2n+1', '3n', '6n-5')",
)
pages_to_number: str = Field("all", description="Which pages to number (e.g. '1,3-5,7' or 'all')")
position: Position = Field(
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(
0, description="Zero-padding width for page numbers (Bates Stamping). Set to 0 to disable padding", ge=0
)
class KeyLength(IntEnum):
"""
The length of the encryption key
"""
integer_40 = 40
integer_128 = 128
integer_256 = 256
class AddPasswordParams(ApiModel):
"""
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="Password needed to change the prevent* restrictions. Must differ from password for them to hold.",
)
password: SecretStr | None = Field(
None, description="Password needed to open the PDF. Leave empty to only add restrictions."
)
preserve_existing: bool = Field(
False,
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")
prevent_extract_for_accessibility: bool = Field(
False, description="Whether content extraction for accessibility is prevented"
)
prevent_fill_in_form: bool = Field(False, description="Whether form filling is prevented")
prevent_modify: bool = Field(False, description="Whether document modification is prevented")
prevent_modify_annotations: bool = Field(False, description="Whether modification of annotations is prevented")
prevent_printing: bool = Field(False, description="Whether printing of the document is prevented")
prevent_printing_faithful: bool = Field(False, description="Whether faithful printing is prevented")
source_password: SecretStr | None = Field(
None,
description="Credential for authenticating an existing protected source, separate from the new passwords. Omit to retain legacy add-password behaviour.",
)
class Alphabet(StrEnum):
"""
Font script matching stampText; roman for Latin text
"""
roman = "roman"
arabic = "arabic"
japanese = "japanese"
korean = "korean"
chinese = "chinese"
thai = "thai"
class CustomMargin1(StrEnum):
"""
Margin between the stamp and the page edge when placed by position
"""
small = "small"
medium = "medium"
large = "large"
x_large = "x-large"
class Position1(IntEnum):
"""
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
integer_2 = 2
integer_3 = 3
integer_4 = 4
integer_5 = 5
integer_6 = 6
integer_7 = 7
integer_8 = 8
integer_9 = 9
class StampType(StrEnum):
"""
The stamp type (text, image or qr). When omitted, image is used if stampImage is supplied, otherwise text.
"""
text = "text"
image = "image"
qr = "qr"
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="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="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="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",
description="The pages to select, Supports ranges (e.g., '1,3,5-9'), or 'all' or functions in the format 'an+b' where 'a' is the multiplier of the page number 'n', and 'b' is a constant (e.g., '2n+1', '3n', '6n-5')",
)
position: Position1 = Field(
Position1.integer_5,
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. 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,
description="The stamp type (text, image or qr). When omitted, image is used if stampImage is supplied, otherwise text.",
)
class Alphabet1(StrEnum):
"""
Font script matching watermarkText; roman for Latin text
"""
roman = "roman"
arabic = "arabic"
japanese = "japanese"
korean = "korean"
chinese = "chinese"
thai = "thai"
class WatermarkType(StrEnum):
"""
The watermark type (text or image). When omitted, image is used if watermarkImage is supplied, otherwise text.
"""
text = "text"
image = "image"
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="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")
watermark_text: str | None = Field(None, description="The watermark text, required when watermarkType is text")
watermark_type: WatermarkType | None = Field(
None,
description="The watermark type (text or image). When omitted, image is used if watermarkImage is supplied, otherwise text.",
)
width_spacer: int = Field(50, description="The width spacer between watermark elements", ge=0)
class AutoRedactParams(ApiModel):
"""
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="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="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")
whole_word_search: bool = Field(False, description="Whether to use whole word search")
class AutoRenameParams(ApiModel):
"""
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(
False,
description="Flag indicating whether to use the first text as a fallback if no suitable title is found. Defaults to false.",
)
class DetectionMode(StrEnum):
"""
Detection method. 'auto' tries embedded-text direction first and falls back to Tesseract OSD for pages without usable text; 'text' uses only embedded-text direction; 'osd' forces Tesseract OSD for every page
"""
auto = "auto"
text = "text"
osd = "osd"
class AutoSplitPdfParams(ApiModel):
"""
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(
False,
description="Flag indicating if the duplex mode is active, where the page after the divider also gets removed.",
)
class BatchProcessAttachmentsParams(ApiModel):
"""
This endpoint applies batch renames, deletions, and additions to PDF attachments in a single pass. Unknown rename or delete targets are skipped, so re-list attachments afterwards to reconcile. Input:PDF Output:PDF Type:SISO
"""
attachments: list[bytes] | None = None
convert_to_pdf_a3b: bool | None = None
ops_json: str | None = None
class DuplexPass(StrEnum):
"""
For manual duplex: which pass to generate
"""
both = "BOTH"
first = "FIRST"
second = "SECOND"
class PagesPerSheet(Enum):
"""
The number of pages per side for booklet printing (always 2 for proper booklet).
"""
number_2 = 2
class SpineLocation(StrEnum):
"""
The spine location for the booklet.
"""
left = "LEFT"
right = "RIGHT"
class BookletImpositionParams(ApiModel):
"""
This operation combines page reordering for booklet printing with multi-page layout. It rearranges pages in the correct order for booklet printing and places multiple pages on each sheet for proper folding and binding. Input:PDF Output:PDF Type:SISO
"""
add_border: bool | None = Field(None, description="Boolean for if you wish to add border around the pages")
add_gutter: bool | None = Field(None, description="Add gutter margin (inner margin for binding)")
double_sided: bool | None = Field(None, description="Generate both front and back sides (double-sided printing)")
duplex_pass: DuplexPass = Field(DuplexPass.both, description="For manual duplex: which pass to generate")
flip_on_short_edge: bool | None = Field(
None, description="Flip back sides for short-edge duplex printing (default is long-edge)"
)
gutter_size: float = Field(12, description="Gutter margin size in points (used when addGutter is true)")
pages_per_sheet: PagesPerSheet = Field(
PagesPerSheet.number_2,
description="The number of pages per side for booklet printing (always 2 for proper booklet).",
)
spine_location: SpineLocation = Field(SpineLocation.left, description="The spine location for the booklet.")
class CbrToPdfParams(ApiModel):
"""
This endpoint converts a CBR (RAR) comic book archive to a PDF file. Input:CBR Output:PDF Type:SISO
"""
optimize_for_ebook: bool = Field(False, description="Optimize the output PDF for ebook reading using Ghostscript")
class CbzToPdfParams(ApiModel):
"""
This endpoint converts a CBZ (ZIP) comic book archive to a PDF file. Input:CBZ Output:PDF Type:SISO
"""
optimize_for_ebook: bool = Field(False, description="Optimize the output PDF for ebook reading using Ghostscript")
class LineArtEdgeLevel(IntEnum):
"""
Edge detection strength to use for line art conversion (1-3). This maps to ImageMagick's -edge radius.
"""
integer_1 = 1
integer_2 = 2
integer_3 = 3
class OptimizeLevel(IntEnum):
"""
Compression level from 1 (lightest) to 9 (strongest). Or set expectedOutputSize to pick one automatically.
"""
integer_1 = 1
integer_2 = 2
integer_3 = 3
integer_4 = 4
integer_5 = 5
integer_6 = 6
integer_7 = 7
integer_8 = 8
integer_9 = 9
class CompressPdfParams(ApiModel):
"""
This endpoint accepts a PDF file and optimizes it based on the provided parameters. Input:PDF Output:PDF Type:SISO
"""
expected_output_size: str | None = Field(
None,
description="Target output size, e.g. '100MB' or '25KB'. When set, the optimization level is chosen automatically to reach it; omit to compress at optimizeLevel.",
examples=["25KB"],
)
grayscale: bool = Field(False, description="Whether to convert the PDF to grayscale. Default is false.")
line_art: bool = Field(
False, description="Whether to convert images to high-contrast line art using ImageMagick. Default is false."
)
line_art_edge_level: LineArtEdgeLevel = Field(
LineArtEdgeLevel.integer_1,
description="Edge detection strength to use for line art conversion (1-3). This maps to ImageMagick's -edge radius.",
)
line_art_threshold: float = Field(55, description="Threshold to use for line art conversion (0-100).")
linearize: bool = Field(False, description="Whether to linearize the PDF for faster web viewing. Default is false.")
normalize: bool = Field(
False, description="Whether to normalize the PDF content for better compatibility. Default is false."
)
optimize_level: OptimizeLevel = Field(
OptimizeLevel.integer_5,
description="Compression level from 1 (lightest) to 9 (strongest). Or set expectedOutputSize to pick one automatically.",
)
class CreatePortfolioParams(ApiModel):
"""
This endpoint bundles one or more files into an Adobe PDF Portfolio (a PDF with a /Collection dictionary) behind a cover page. Input:ANY Output:PDF Type:MISO
"""
cover_title: str = Field("PDF Portfolio", description="Title shown on the portfolio cover page.")
files: list[bytes] = Field(..., description="The files to bundle into the PDF Portfolio.")
class CropParams(ApiModel):
"""
This operation takes an input PDF file and crops it according to the given coordinates. Input:PDF Output:PDF Type:SISO
"""
auto_crop: bool | None = Field(None, description="Enable auto-crop to detect and remove white space")
height: float | None = Field(None, description="The height of the crop area")
page_numbers: str = Field(
"all", description="Pages to crop (e.g. '1, 3, 5-8' or 'all'). Omit or leave blank for all pages."
)
remove_data_outside_crop: bool | None = Field(
None, description="Whether to remove text outside the crop area (keeps images)"
)
width: float | None = Field(None, description="The width of the crop area")
x: float | None = Field(None, description="The x-coordinate of the top-left corner of the crop area")
y: float | None = Field(None, description="The y-coordinate of the top-left corner of the crop area")
class DeleteAttachmentParams(ApiModel):
"""
This endpoint deletes an embedded attachment from a PDF. Input:PDF Output:PDF Type:SISO
"""
attachment_name: str = Field(..., description="The name of the attachment to delete")
class EmbedAllFonts(Enum):
"""
Embed all fonts from the eBook into the generated PDF
"""
boolean_true = True
boolean_false = False
class IncludePageNumbers(Enum):
"""
Add page numbers to the generated PDF
"""
boolean_true = True
boolean_false = False
class IncludeTableOfContents(Enum):
"""
Add a generated table of contents to the resulting PDF
"""
boolean_true = True
boolean_false = False
class OptimizeForEbook(Enum):
"""
Optimize the PDF for eBook reading (smaller file size, better rendering on eInk devices)
"""
boolean_true = True
boolean_false = False
class EbookToPdfParams(ApiModel):
"""
This endpoint converts common eBook formats (EPUB, MOBI, AZW3, FB2, TXT, DOCX) to PDF using Calibre or Stirling Office Convert. Input:EBOOK Output:PDF Type:SISO
"""
embed_all_fonts: EmbedAllFonts = Field(
EmbedAllFonts.boolean_false, description="Embed all fonts from the eBook into the generated PDF"
)
include_page_numbers: IncludePageNumbers = Field(
IncludePageNumbers.boolean_false, description="Add page numbers to the generated PDF"
)
include_table_of_contents: IncludeTableOfContents = Field(
IncludeTableOfContents.boolean_false, description="Add a generated table of contents to the resulting PDF"
)
optimize_for_ebook: OptimizeForEbook = Field(
OptimizeForEbook.boolean_false,
description="Optimize the PDF for eBook reading (smaller file size, better rendering on eInk devices)",
)
use_stirling_office_convert: bool | None = Field(
None, description="Use Stirling Office Convert; when omitted, follow the server setting"
)
class EditTableOfContentsParams(ApiModel):
"""
Add or edit bookmarks/table of contents in a PDF document. Input:PDF Output:PDF Type:SISO
"""
bookmark_data: str | None = Field(
None,
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="Ignored: existing bookmarks are always replaced. To add to them, read them with extract-bookmarks and send the full list.",
examples=[True],
)
class EmlToPdfParams(ApiModel):
"""
This endpoint converts EML (email) and MSG (Outlook) files to PDF format with extensive customization options. Features include font settings, image constraints, display modes, attachment handling, and HTML debug output. or MSG file, or HTML file. Input:EMAIL Output:PDF Type:SISO
"""
download_html: bool | None = Field(
None, description="Download HTML intermediate file instead of PDF", examples=[False]
)
include_all_recipients: bool | None = Field(
None, description="Include CC and BCC recipients in header (if available)", examples=[True]
)
include_attachments: bool | None = Field(
None, description="Include email attachments in the PDF output", examples=[False]
)
max_attachment_size_mb: int | None = Field(
None,
description="Maximum attachment size in MB to include (default 10MB, range: 1-100)",
examples=[10],
ge=1,
le=100,
)
use_stirling_office_convert: bool | None = Field(
None, description="Use Stirling Office Convert; when omitted, follow the server setting"
)
class ExtractAttachmentsParams(ApiModel):
"""
This endpoint extracts all embedded attachments from a PDF into a ZIP archive. Input:PDF Output:ZIP Type:SISO
"""
class ExtractImageScansParams(ApiModel):
"""
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")
border_size: int = Field(1, description="The border size for the image scan extraction")
min_area: int = Field(10000, description="The minimum area for the image scan extraction")
min_contour_area: int = Field(500, description="The minimum contour area for the image scan extraction")
tolerance: int = Field(30, description="The tolerance for the image scan extraction")
class Format(StrEnum):
"""
The output image format e.g., 'png', 'jpeg', or 'gif'
"""
png = "png"
jpeg = "jpeg"
gif = "gif"
class ExtractImagesParams(ApiModel):
"""
This endpoint extracts images from a given PDF file and returns them in a zip file. Users can specify the output image format. Input:PDF Output:IMAGE Type:SIMO
"""
format: Format = Field(Format.png, description="The output image format e.g., 'png', 'jpeg', or 'gif'")
class ExtractSingleAttachmentParams(ApiModel):
"""
This endpoint extracts a single embedded attachment from a PDF by name. Input:PDF Output:ANY Type:SISO
"""
attachment_name: str = Field(..., description="Name of the embedded attachment to extract")
class FileToPdfParams(ApiModel):
"""
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
class FlattenParams(ApiModel):
"""
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 flattens only form fields; false turns every page into an image"
)
render_dpi: int | None = Field(
None, description="DPI for the page images when flattening full pages (default 300)", ge=72
)
class FlattenPortfolioParams(ApiModel):
"""
This endpoint removes the /Collection wrapper from a PDF Portfolio so it opens as a standard PDF, keeping the bundled files as attachments. Input:PDF Output:PDF Type:SISO
"""
class HtmlToPdfParams(ApiModel):
"""
This endpoint takes an HTML or ZIP file input and converts it to a PDF format. Input:HTML/ZIP Output:PDF Type:SISO
"""
use_stirling_office_convert: bool | None = Field(
None, description="Use Stirling Office Convert; when omitted, follow the server setting"
)
zoom: float = Field(1, description="Zoom level for displaying the website. Default is '1'.")
class ImageBox(ApiModel):
"""
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).")
x1: float = Field(..., description="Left x coordinate of the redaction rectangle in PDF user-space points.")
x2: float = Field(..., description="Right x coordinate of the redaction rectangle in PDF user-space points.")
y1: float = Field(..., description="Top y coordinate of the redaction rectangle in PDF user-space points.")
y2: float = Field(..., description="Bottom y coordinate of the redaction rectangle in PDF user-space points.")
class ColorType(StrEnum):
"""
The color type of the output image(s)
"""
color = "color"
greyscale = "greyscale"
blackwhite = "blackwhite"
class FitOption(StrEnum):
"""
Option to determine how the image will fit onto the page
"""
fill_page = "fillPage"
fit_document_to_image = "fitDocumentToImage"
fit_document_to_page = "fitDocumentToPage"
maintain_aspect_ratio = "maintainAspectRatio"
class ImgToPdfParams(ApiModel):
"""
This endpoint converts one or more images to a PDF file. Users can specify whether to stretch the images to fit the PDF page, and whether to automatically rotate the images. Input:IMAGE Output:PDF Type:MISO
"""
auto_rotate: bool = Field(
False, description="Whether to automatically rotate the images to better fit the PDF page"
)
color_type: ColorType = Field(ColorType.color, description="The color type of the output image(s)")
fit_option: FitOption = Field(
FitOption.fill_page, description="Option to determine how the image will fit onto the page"
)
class MarkdownToPdfParams(ApiModel):
"""
This endpoint takes a Markdown file or ZIP (containing Markdown + images) input, converts it to HTML, and then to PDF format. Input:MARKDOWN/ZIP Output:PDF Type:SISO
"""
use_stirling_office_convert: bool | None = None
class SortType(StrEnum):
"""
The type of sorting to be applied on the input files before merging.
"""
order_provided = "orderProvided"
by_file_name = "byFileName"
by_date_modified = "byDateModified"
by_date_created = "byDateCreated"
by_pdf_title = "byPDFTitle"
class MergePdfsParams(ApiModel):
"""
This endpoint merges multiple PDF files into a single PDF file. The merged file will contain all pages from the input files in the order they were provided. Image inputs are converted to PDF pages before merging. Input:PDF/IMAGE Output:PDF Type:MISO
"""
client_file_ids: str | None = Field(
None, description="JSON array of client-provided IDs for each uploaded file (same order as fileInput)"
)
file_order: str | None = None
generate_toc: bool = Field(
False,
description="Flag indicating whether to generate a table of contents for the merged PDF. If true, a table of contents will be created using the input filenames as chapter names.",
)
remove_cert_sign: bool = Field(
True,
description="Flag indicating whether to remove certification signatures from the merged PDF. If true, all certification signatures will be removed from the final merged document.",
)
sort_type: SortType = Field(
SortType.order_provided, description="The type of sorting to be applied on the input files before merging."
)
class Arrangement(StrEnum):
"""
The arrangement of pages on the sheet: BY_ROWS fills pages row by row, while BY_COLUMNS fills pages column by column.
"""
by_rows = "BY_ROWS"
by_columns = "BY_COLUMNS"
class Mode(StrEnum):
"""
Input mode: DEFAULT uses pagesPerSheet; CUSTOM uses explicit cols x rows.
"""
default = "DEFAULT"
custom = "CUSTOM"
class Orientation(StrEnum):
"""
The orientation of the output PDF pages
"""
portrait = "PORTRAIT"
landscape = "LANDSCAPE"
class PagesPerSheet1(IntEnum):
"""
The number of pages to fit onto a single sheet in the output PDF.
"""
integer_2 = 2
integer_4 = 4
integer_9 = 9
integer_16 = 16
class ReadingDirection(StrEnum):
"""
The direction in which pages are arranged on the sheet: LTR (left-to-right) or RTL (right-to-left).
"""
ltr = "LTR"
rtl = "RTL"
class MultiPageLayoutParams(ApiModel):
"""
This operation takes an input PDF file and the number of pages to merge into a single sheet in the output PDF file. Input:PDF Output:PDF Type:SISO
"""
add_border: bool | None = Field(None, description="Boolean for if you wish to add border around the pages")
arrangement: Arrangement = Field(
Arrangement.by_rows,
description="The arrangement of pages on the sheet: BY_ROWS fills pages row by row, while BY_COLUMNS fills pages column by column.",
)
border_width: float = Field(
1, description="Border width (in points) to apply around each page when merging", examples=[2], ge=0.0
)
bottom_margin: float = Field(
0, description="Bottom margin (in points) to apply to the output pages when merging", examples=[200], ge=0.0
)
cols: float = Field(2, description="Number of columns", examples=[2], ge=1.0, le=300.0)
inner_margin: float = Field(
0, description="Inner margin (in points) to apply around each page when merging", examples=[200], ge=0.0
)
left_margin: float = Field(
0, description="Left margin (in points) to apply to the output pages when merging", examples=[200], ge=0.0
)
mode: Mode = Field(
Mode.default, description="Input mode: DEFAULT uses pagesPerSheet; CUSTOM uses explicit cols x rows."
)
orientation: Orientation = Field(Orientation.portrait, description="The orientation of the output PDF pages")
pages_per_sheet: PagesPerSheet1 | None = Field(
None, description="The number of pages to fit onto a single sheet in the output PDF."
)
reading_direction: ReadingDirection = Field(
ReadingDirection.ltr,
description="The direction in which pages are arranged on the sheet: LTR (left-to-right) or RTL (right-to-left).",
)
right_margin: float = Field(
0, description="Right margin (in points) to apply to the output pages when merging", examples=[200], ge=0.0
)
rows: float = Field(1, description="Number of rows", examples=[3], ge=1.0, le=300.0)
top_margin: float = Field(
0, description="Top margin (in points) to apply to the output pages when merging", examples=[200], ge=0.0
)
class OcrRenderType(StrEnum):
"""
Specify the OCR render type, either 'hocr' or 'sandwich'
"""
hocr = "hocr"
sandwich = "sandwich"
class OcrType(StrEnum):
"""
How to treat pages that already contain text: 'skip-text' OCRs only pages without text, 'force-ocr' rasterises and OCRs every page.
"""
skip_text = "skip-text"
force_ocr = "force-ocr"
normal = "Normal"
class OcrPdfParams(ApiModel):
"""
This endpoint processes a PDF file using OCR (Optical Character Recognition). Users can specify languages, sidecar, deskew, clean, cleanFinal, ocrType, ocrRenderType, and removeImagesAfter options. Uses OCRmyPDF if available, falls back to Tesseract. Input:PDF Output:PDF Type:SISO
"""
clean: bool = Field(False, description="Clean the input file if set to true")
clean_final: bool = Field(False, description="Clean the final output if set to true")
deskew: bool = Field(False, description="Deskew the input file if set to true")
languages: list[str] = Field(["eng"], description="List of languages to use in OCR processing, e.g., 'eng', 'deu'")
ocr_render_type: OcrRenderType = Field(
OcrRenderType.hocr, description="Specify the OCR render type, either 'hocr' or 'sandwich'"
)
ocr_type: OcrType = Field(
OcrType.skip_text,
description="How to treat pages that already contain text: 'skip-text' OCRs only pages without text, 'force-ocr' rasterises and OCRs every page.",
)
remove_images_after: bool = Field(False, description="Remove images from the output PDF if set to true")
rotate_pages: bool = Field(
False, description="Auto-correct page orientation (90/180/270) using Tesseract OSD if set to true"
)
sidecar: bool = Field(False, description="Include OCR text in a sidecar text file if set to true")
class PageRotation(ApiModel):
"""
Optional pre-computed corrections to apply without running detection. Pages not listed are left unchanged, and a page may only appear once
"""
page_number: int = Field(..., description="1-based page number to rotate", examples=[1])
rotation: int = Field(
...,
description="Additional clockwise rotation to add to the page's current rotation, in degrees. Must be a multiple of 90",
examples=[90],
)
class PdfToCbrParams(ApiModel):
"""
This endpoint converts a PDF file to a CBR comic book archive using the local RAR CLI. Input:PDF Output:CBR Type:SISO
"""
dpi: int = Field(..., description="The DPI (Dots Per Inch) for rendering PDF pages as images", examples=[150])
class PdfToCbzParams(ApiModel):
"""
This endpoint converts a PDF file to a CBZ (ZIP) comic book archive. Input:PDF Output:CBZ Type:SISO
"""
dpi: int = Field(..., description="The DPI (Dots Per Inch) for rendering PDF pages as images", examples=[150])
class PdfToCsvParams(ApiModel):
"""
This operation takes an input PDF file and returns CSV file of whole page. Input:PDF Output:CSV Type:SIMO
"""
page_numbers: str = Field(
"all",
description="The pages to select, Supports ranges (e.g., '1,3,5-9'), or 'all' or functions in the format 'an+b' where 'a' is the multiplier of the page number 'n', and 'b' is a constant (e.g., '2n+1', '3n', '6n-5')",
)
class DetectChapters(Enum):
"""
Detect headings that look like chapters and insert EPUB page breaks.
"""
boolean_true = True
boolean_false = False
class OutputFormat(StrEnum):
"""
Choose the output format for the ebook.
"""
epub = "EPUB"
azw3 = "AZW3"
epub_1 = "EPUB"
azw3_1 = "AZW3"
class TargetDevice(StrEnum):
"""
Choose an output profile optimized for the reader device.
"""
tablet_phone_images = "TABLET_PHONE_IMAGES"
kindle_eink_text = "KINDLE_EINK_TEXT"
tablet_phone_images_1 = "TABLET_PHONE_IMAGES"
kindle_eink_text_1 = "KINDLE_EINK_TEXT"
class PdfToEpubParams(ApiModel):
"""
Convert a PDF file to an EPUB or AZW3 ebook using Calibre or Stirling Office Convert. Input:PDF Output:EBOOK Type:SISO
"""
detect_chapters: DetectChapters = Field(
DetectChapters.boolean_true, description="Detect headings that look like chapters and insert EPUB page breaks."
)
output_format: OutputFormat = Field(OutputFormat.epub, description="Choose the output format for the ebook.")
target_device: TargetDevice = Field(
TargetDevice.tablet_phone_images, description="Choose an output profile optimized for the reader device."
)
use_stirling_office_convert: bool | None = Field(
None, description="Use Stirling Office Convert; when omitted, follow the server setting"
)
class PdfToHtmlParams(ApiModel):
"""
This endpoint converts a PDF file to HTML format. Input:PDF Output:ZIP Type:SISO
"""
use_stirling_office_convert: bool | None = None
class ImageFormat(StrEnum):
"""
The output image format
"""
png = "png"
jpeg = "jpeg"
jpg = "jpg"
gif = "gif"
webp = "webp"
class SingleOrMultiple(StrEnum):
"""
Choose between a single image containing all pages or separate images for each page
"""
single = "single"
multiple = "multiple"
class PdfToImgParams(ApiModel):
"""
This endpoint converts a PDF file to image(s) with the specified image format, color type, and DPI. Users can choose to get a single image or multiple images. Input:PDF Output:IMAGE Type:SIMO
"""
color_type: ColorType = Field(ColorType.color, description="The color type of the output image(s)")
dpi: int = Field(300, description="The DPI (dots per inch) for the output image(s)")
image_format: ImageFormat = Field(ImageFormat.png, description="The output image format")
include_annotations: bool = Field(False, description="Include annotations such as comments in the output image(s)")
page_numbers: str = Field(
"all",
description="The pages to select, Supports ranges (e.g., '1,3,5-9'), or 'all' or functions in the format 'an+b' where 'a' is the multiplier of the page number 'n', and 'b' is a constant (e.g., '2n+1', '3n', '6n-5')",
)
single_or_multiple: SingleOrMultiple = Field(
SingleOrMultiple.multiple,
description="Choose between a single image containing all pages or separate images for each page",
)
class PdfToMarkdownParams(ApiModel):
"""
This endpoint converts a PDF file to Markdown format. Input:PDF Output:MARKDOWN Type:SISO
"""
use_stirling_office_convert: bool | None = None
class OutputFormat1(StrEnum):
"""
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"
pdfa_1 = "pdfa-1"
pdfa_2 = "pdfa-2"
pdfa_2b = "pdfa-2b"
pdfa_3 = "pdfa-3"
pdfa_3b = "pdfa-3b"
pdfa_1a = "pdfa-1a"
pdfa_2a = "pdfa-2a"
pdfa_3a = "pdfa-3a"
pdfx = "pdfx"
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="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.",
)
strict: bool | None = Field(
None, description="If true, the conversion will fail if the output is not perfectly compliant"
)
use_stirling_office_convert: bool | None = Field(
None, description="Use Stirling Office Convert; when omitted, follow the server setting"
)
class OutputFormat2(StrEnum):
"""
The output Presentation format
"""
ppt = "ppt"
pptx = "pptx"
odp = "odp"
class PdfToPresentationParams(ApiModel):
"""
This endpoint converts a given PDF file to a Presentation format. Input:PDF Output:PPT Type:SISO
"""
output_format: OutputFormat2 = Field(..., description="The output Presentation format")
use_stirling_office_convert: bool | None = None
class PdfToSinglePageParams(ApiModel):
"""
This endpoint converts a multi-page PDF document into a single paged PDF document. The width of the single page will be same as the input's width, but the height will be the sum of all the pages' heights. Input:PDF Output:PDF Type:SISO
"""
class OutputFormat3(StrEnum):
"""
The output Text or RTF format
"""
rtf = "rtf"
txt = "txt"
class PdfToTextParams(ApiModel):
"""
This endpoint converts a given PDF file to Text or RTF format. Input:PDF Output:TEXT Type:SISO
"""
output_format: OutputFormat3 = Field(..., description="The output Text or RTF format")
use_stirling_office_convert: bool | None = None
class ExistingTags(StrEnum):
"""
What to do with an existing structure tree: keep it, rebuild it, or decide automatically
"""
auto = "auto"
keep = "keep"
rebuild = "rebuild"
class FigurePolicy(StrEnum):
"""
How to treat images with no description. require-alt leaves them undescribed so the report asks for input; mark-decorative treats every image as decoration.
"""
require_alt = "require-alt"
mark_decorative = "mark-decorative"
class Profile1(StrEnum):
"""
PDF/UA conformance level to target
"""
ua1 = "ua1"
ua2 = "ua2"
class PdfToUaParams(ApiModel):
"""
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='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,
description="Embed fonts the document references but does not carry. Required for conformance and needs Ghostscript.",
)
existing_tags: ExistingTags = Field(
ExistingTags.auto,
description="What to do with an existing structure tree: keep it, rebuild it, or decide automatically",
)
figure_policy: FigurePolicy = Field(
FigurePolicy.require_alt,
description="How to treat images with no description. require-alt leaves them undescribed so the report asks for input; mark-decorative treats every image as decoration.",
)
language: str = Field(
"en-US",
description="Document language as a BCP-47 tag, for example en-US. Applied only when the document does not already declare one, unless overrideLanguage is set.",
)
override_language: bool = Field(
False,
description="Replace the language the document already declares. Off by default, so a document is never relabelled into a language it is not written in.",
)
profile: Profile1 = Field(Profile1.ua1, description="PDF/UA conformance level to target")
title: str | None = Field(
None, description="Document title, required by PDF/UA. Falls back to the first heading, then the filename."
)
class OutputFormat4(StrEnum):
"""
The output Word document format
"""
doc = "doc"
docx = "docx"
odt = "odt"
class PdfToWordParams(ApiModel):
"""
This endpoint converts a given PDF file to a Word document format. Input:PDF Output:WORD Type:SISO
"""
output_format: OutputFormat4 = Field(..., description="The output Word document format")
use_stirling_office_convert: bool | None = None
class PdfToXlsxParams(ApiModel):
"""
Extracts tabular data from each page of a PDF and writes it into an Excel workbook, one sheet per table. Input:PDF Output:EXCEL Type:SISO
"""
page_numbers: str = Field(
"all",
description="The pages to select, Supports ranges (e.g., '1,3,5-9'), or 'all' or functions in the format 'an+b' where 'a' is the multiplier of the page number 'n', and 'b' is a constant (e.g., '2n+1', '3n', '6n-5')",
)
use_stirling_office_convert: bool | None = None
class PdfToXmlParams(ApiModel):
"""
This endpoint converts a PDF file to an XML file. Input:PDF Output:XML Type:SISO
"""
use_stirling_office_convert: bool | None = None
class CustomMode(StrEnum):
"""
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), ODD_EVEN_MERGE (interleave the halves back together, inverse of ODD_EVEN_SPLIT), REMOVE_FIRST, REMOVE_LAST, REMOVE_FIRST_AND_LAST, DUPLICATE (copies = pageNumbers, default 2).
"""
custom = "CUSTOM"
reverse_order = "REVERSE_ORDER"
duplex_sort = "DUPLEX_SORT"
booklet_sort = "BOOKLET_SORT"
side_stitch_booklet_sort = "SIDE_STITCH_BOOKLET_SORT"
odd_even_split = "ODD_EVEN_SPLIT"
odd_even_merge = "ODD_EVEN_MERGE"
remove_first = "REMOVE_FIRST"
remove_last = "REMOVE_LAST"
remove_first_and_last = "REMOVE_FIRST_AND_LAST"
duplicate = "DUPLICATE"
class RearrangePagesParams(ApiModel):
"""
Builds the output from pageNumbers, in the order given: '3-7' keeps only pages 3 to 7, '3,1,2' keeps pages 3, 1 and 2 in that order, and pages not listed are dropped (a page listed twice is kept once). Or set customMode to a preset such as REVERSE_ORDER, DUPLEX_SORT or REMOVE_FIRST; with DUPLICATE, pageNumbers is how many copies of each page to make. Input:PDF Output:PDF Type:SISO
"""
custom_mode: CustomMode | None = Field(
None,
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), ODD_EVEN_MERGE (interleave the halves back together, inverse of ODD_EVEN_SPLIT), REMOVE_FIRST, REMOVE_LAST, REMOVE_FIRST_AND_LAST, DUPLICATE (copies = pageNumbers, default 2).",
)
page_numbers: str = Field(
"all",
description="The pages to select, Supports ranges (e.g., '1,3,5-9'), or 'all' or functions in the format 'an+b' where 'a' is the multiplier of the page number 'n', and 'b' is a constant (e.g., '2n+1', '3n', '6n-5')",
)
class Strategy(StrEnum):
"""
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"
overlay_only = "OVERLAY_ONLY"
image_finalize = "IMAGE_FINALIZE"
class Style(ApiModel):
"""
Redaction style options
"""
color: str = Field("#000000", description="Hex redaction box color")
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="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):
"""
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.")
height: float | None = Field(None, description="The height of the area to be redacted.")
page: int | None = Field(None, description="The page on which the area should be redacted.")
width: float | None = Field(None, description="The width of the area to be redacted.")
x: float | None = Field(None, description="The left edge point of the area to be redacted.")
y: float | None = Field(None, description="The top edge point of the area to be redacted.")
class RemoveBlanksParams(ApiModel):
"""
This endpoint removes blank pages from a given PDF file. Users can specify the threshold and white percentage to tune the detection of blank pages. Input:PDF Output:PDF Type:SIMO
"""
threshold: int = Field(10, description="The threshold value to determine blank pages", ge=0, le=255)
white_percent: float = Field(
99.9, description="The percentage of white color on a page to consider it as blank", ge=0.1, le=100.0
)
class RemoveCertSignParams(ApiModel):
"""
This endpoint accepts a PDF file and returns the PDF file without the digital signature. Input:PDF Output:PDF Type:SISO
"""
class RemoveImagePdfParams(ApiModel):
"""
This endpoint removes all embedded images from a PDF file and returns the modified document. Input:PDF Output:PDF Type:SISO
"""
class RemovePagesParams(ApiModel):
"""
This endpoint removes specified pages from a given PDF file. Users can provide a comma-separated list of page numbers or ranges to delete. Input:PDF Output:PDF Type:SISO
"""
page_numbers: str = Field(
"all",
description="The pages to select, Supports ranges (e.g., '1,3,5-9'), or 'all' or functions in the format 'an+b' where 'a' is the multiplier of the page number 'n', and 'b' is a constant (e.g., '2n+1', '3n', '6n-5')",
)
class RemovePasswordParams(ApiModel):
"""
This endpoint removes the password from a protected PDF file while preserving its document permissions. Users need to provide the existing password. Optional ownerPassword, sourcePassword or retainedOpeningPassword enable selective removal: nonempty password and ownerPassword select which passwords to remove; blank selections retain them. removeAll explicitly removes all protection, subject to the owner-password policy. Source and retained credentials never select removal. Input:PDF/PDF_ENCRYPTED Output:PDF Type:SISO
"""
owner_password: SecretStr | None = Field(
None,
description="Permissions password to remove. Supplying this field enables selective removal; leave blank to retain the permissions password.",
)
password: SecretStr | None = Field(None, description="The password of the PDF file")
remove_all: bool = Field(
False,
description="Explicitly remove all passwords and restrictions, subject to the server owner-password policy. The password or sourcePassword authenticates the source; selective removal fields do not apply.",
)
retained_opening_password: SecretStr | None = Field(
None,
description="Opening password to retain when removing only the permissions password. Supplying this field enables selective removal.",
)
source_password: SecretStr | None = Field(
None,
description="Credential for opening the source, without selecting it for removal. Supplying this field enables selective removal; password then selects the opening password to remove and ownerPassword selects the permissions password to remove. Blank selection fields keep their passwords.",
)
class RenameAttachmentParams(ApiModel):
"""
This endpoint renames an embedded attachment in a PDF. Input:PDF Output:PDF Type:SISO
"""
attachment_name: str = Field(..., description="The current name of the attachment to rename")
new_name: str = Field(..., description="The new name for the attachment")
class RepairParams(ApiModel):
"""
This endpoint repairs a given PDF file by running Ghostscript (primary), qpdf (fallback), or PDFBox (if no external tools available). The PDF is first saved to a temporary location, repaired, read back, and then returned as a response. Input:PDF Output:PDF Type:SISO
"""
class HighContrastColorCombination(StrEnum):
"""
If HIGH_CONTRAST_COLOR option selected, then pick the default color option for text and background.
"""
white_text_on_black = "WHITE_TEXT_ON_BLACK"
black_text_on_white = "BLACK_TEXT_ON_WHITE"
yellow_text_on_black = "YELLOW_TEXT_ON_BLACK"
green_text_on_black = "GREEN_TEXT_ON_BLACK"
white_text_on_black_1 = "WHITE_TEXT_ON_BLACK"
black_text_on_white_1 = "BLACK_TEXT_ON_WHITE"
yellow_text_on_black_1 = "YELLOW_TEXT_ON_BLACK"
green_text_on_black_1 = "GREEN_TEXT_ON_BLACK"
class ReplaceAndInvertOption(StrEnum):
"""
Replace and Invert color options of a pdf.
"""
high_contrast_color = "HIGH_CONTRAST_COLOR"
custom_color = "CUSTOM_COLOR"
full_inversion = "FULL_INVERSION"
color_space_conversion = "COLOR_SPACE_CONVERSION"
high_contrast_color_1 = "HIGH_CONTRAST_COLOR"
custom_color_1 = "CUSTOM_COLOR"
full_inversion_1 = "FULL_INVERSION"
color_space_conversion_1 = "COLOR_SPACE_CONVERSION"
class ReplaceInvertPdfParams(ApiModel):
"""
This endpoint accepts a PDF file and provides options to invert all colors, replace text and background colors, or convert to CMYK color space for printing. Input:PDF Output:PDF Type:SISO
"""
back_ground_color: str | None = Field(
None,
description="If CUSTOM_COLOR option selected, then pick the custom color for background. Expected color value should be 24bit decimal value of a color",
)
high_contrast_color_combination: HighContrastColorCombination = Field(
HighContrastColorCombination.white_text_on_black,
description="If HIGH_CONTRAST_COLOR option selected, then pick the default color option for text and background.",
)
replace_and_invert_option: ReplaceAndInvertOption = Field(
ReplaceAndInvertOption.high_contrast_color, description="Replace and Invert color options of a pdf."
)
text_color: str | None = Field(
None,
description="If CUSTOM_COLOR option selected, then pick the custom color for text. Expected color value should be 24bit decimal value of a color",
)
class Angle(IntEnum):
"""
The clockwise angle by which to rotate all pages in the PDF file. Must be a multiple of 90.
"""
integer_0 = 0
integer_90 = 90
integer_180 = 180
integer_270 = 270
class RotatePdfParams(ApiModel):
"""
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(
..., description="The clockwise angle by which to rotate all pages in the PDF file. Must be a multiple of 90."
)
class SanitizePdfParams(ApiModel):
"""
This endpoint processes a PDF file and removes specific elements based on the provided options. Input:PDF Output:PDF Type:SISO
"""
remove_embedded_files: bool = Field(True, description="Remove embedded files from the PDF")
remove_fonts: bool = Field(False, description="Remove fonts from the PDF")
remove_java_script: bool = Field(True, description="Remove JavaScript actions from the PDF")
remove_links: bool = Field(False, description="Remove links from the PDF")
remove_metadata: bool = Field(False, description="Remove document info metadata from the PDF")
remove_xmp_metadata: bool = Field(False, description="Remove XMP metadata from the PDF")
class CustomUnit(StrEnum):
"""
Unit of customWidth and customHeight.
"""
mm = "mm"
cm = "cm"
in_ = "in"
class Orientation1(StrEnum):
"""
Orientation to apply to the target page size. Ignored when pageSize is KEEP or CUSTOM.
"""
portrait = "PORTRAIT"
landscape = "LANDSCAPE"
class PageSize(StrEnum):
"""
The scale of pages in the output PDF. Acceptable values are A0-A6, LETTER, LEGAL, KEEP, CUSTOM. KEEP keeps each page's own size.
"""
a0 = "A0"
a1 = "A1"
a2 = "A2"
a3 = "A3"
a4 = "A4"
a5 = "A5"
a6 = "A6"
letter = "LETTER"
legal = "LEGAL"
keep = "KEEP"
custom = "CUSTOM"
class ScalePagesParams(ApiModel):
"""
This operation takes an input PDF file and the size to scale the pages to in the output PDF file. Input:PDF Output:PDF Type:SISO
"""
custom_height: float | None = Field(
None,
description="Height of the output pages in customUnit. Required when pageSize is CUSTOM; between 3 points (about 1.06 mm) and 200 inches.",
gt=0.0,
)
custom_unit: CustomUnit = Field(CustomUnit.mm, description="Unit of customWidth and customHeight.")
custom_width: float | None = Field(
None,
description="Width of the output pages in customUnit. Required when pageSize is CUSTOM; between 3 points (about 1.06 mm) and 200 inches.",
gt=0.0,
)
orientation: Orientation1 = Field(
Orientation1.portrait,
description="Orientation to apply to the target page size. Ignored when pageSize is KEEP or CUSTOM.",
)
page_size: PageSize = Field(
PageSize.keep,
description="The scale of pages in the output PDF. Acceptable values are A0-A6, LETTER, LEGAL, KEEP, CUSTOM. KEEP keeps each page's own size.",
)
scale_factor: float = Field(
1, description="The scale of the content on the pages of the output PDF. Acceptable values are floats.", ge=0.0
)
class Colorspace(StrEnum):
"""
Colorspace for output image
"""
grayscale = "grayscale"
color = "color"
class Quality(StrEnum):
"""
Scan quality preset, used unless advancedEnabled is true
"""
low = "low"
medium = "medium"
high = "high"
class Rotation(StrEnum):
"""
Rotation preset
"""
none = "none"
slight = "slight"
moderate = "moderate"
severe = "severe"
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="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). 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). 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"])
rotation_value: int | None = None
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: 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="For splitType 0 a size like '500KB' or '10MB' (a bare number means MB); for 1 and 2 a whole number",
)
class PageSize1(StrEnum):
"""
Target page size for output chunks (e.g., 'A4', 'Letter', 'A3')
"""
a4 = "A4"
letter = "Letter"
a3 = "A3"
a5 = "A5"
legal = "Legal"
tabloid = "Tabloid"
class SplitForPosterPrintParams(ApiModel):
"""
This endpoint splits large or oddly-sized PDF pages into smaller chunks suitable for printing on standard paper sizes (e.g., A4, Letter). Divides each page into a grid of smaller pages using Apache PDFBox. Input:PDF Output:PDF Type:SIMO
"""
page_size: PageSize1 = Field(..., description="Target page size for output chunks (e.g., 'A4', 'Letter', 'A3')")
right_to_left: bool = Field(False, description="Split right-to-left instead of left-to-right")
x_factor: int = Field(2, description="Horizontal decimation factor (how many columns to split into)", ge=1, le=10)
y_factor: int = Field(2, description="Vertical decimation factor (how many rows to split into)", ge=1, le=10)
class SplitPagesParams(ApiModel):
"""
This endpoint splits a given PDF file into separate documents based on the specified page numbers or ranges. Users can specify pages using individual numbers, ranges, or 'all' for every page. Input:PDF Output:PDF Type:SIMO
"""
page_numbers: str = Field(
"all",
description='Split points - page numbers after which the PDF will be cut. For example, `"2"` produces two documents (pages 1-2 and pages 3+); `"2,5"` produces three (pages 1-2, 3-5, 6+). Supports ranges (e.g. `"1,3,5-9"` splits after pages 1, 3, 5, 6, 7, 8, 9, yielding 8 documents), `"all"` (split after every page), or functions like `"2n+1"`, `"3n"`, `"6n-5"`.',
)
class SplitPdfByChaptersParams(ApiModel):
"""
Splits a PDF into chapters and returns a ZIP file. Input:PDF Output:PDF Type:SIMO
"""
allow_duplicates: bool = Field(False, description="Whether to allow duplicates or not")
bookmark_level: int = Field(
1,
description="Maximum bookmark nesting level to split on: 0 splits on top-level bookmarks only, 1 also on their children, and so on",
ge=0,
)
include_metadata: bool = Field(False, description="Whether to include Metadata or not")
class SplitMode(StrEnum):
"""
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"
split_all_except_first_and_last = "SPLIT_ALL_EXCEPT_FIRST_AND_LAST"
split_all_except_first = "SPLIT_ALL_EXCEPT_FIRST"
split_all_except_last = "SPLIT_ALL_EXCEPT_LAST"
split_all = "SPLIT_ALL"
class SplitPdfBySectionsParams(ApiModel):
"""
Split each page of a PDF into smaller sections based on the user's choice which page to split, and how to split ( halves, thirds, quarters, etc.), both vertically and horizontally. Input:PDF Output:PDF Type:SIMO
"""
horizontal_divisions: int = Field(0, description="Number of horizontal divisions for each PDF page", ge=0, le=50)
merge: bool = Field(False, description="Merge the split documents into a single PDF")
page_numbers: str | None = Field(
None,
description="Pages to split when splitMode is CUSTOM (required in that mode, ignored otherwise). Supports ranges (e.g. '1,3,5-9'), 'all', or functions like '2n+1'.",
examples=["1,3,5-9"],
)
split_mode: SplitMode | None = Field(
None,
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)
class SvgToPdfParams(ApiModel):
"""
This endpoint converts one or more SVG (Scalable Vector Graphics) files to PDF format. Each SVG is converted to a separate PDF file. The conversion preserves vector graphics for crisp output at any resolution - no rasterization occurs. SVG dimensions (width/height) determine the PDF page size; defaults to A4 if not specified. SVG content is sanitized to prevent XSS attacks. Input:IMAGE Output:PDF Type:MIMO
"""
combine_into_single_pdf: bool = Field(
False,
description="Whether to combine all SVG files into a single PDF (each SVG as a separate page) or create separate PDF files for each SVG.",
)
class TextRange(ApiModel):
"""
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(
...,
description="A short, distinctive phrase (5–15 words) that marks where redaction ends (inclusive). Must appear verbatim in the document. Shorter phrases match more reliably.",
min_length=1,
)
start_string: str = Field(
...,
description="A short, distinctive phrase (5–15 words) that marks where redaction begins (inclusive). Must appear verbatim in the document — e.g. a section heading or a unique sentence fragment.",
min_length=1,
)
class TimestampPdfParams(ApiModel):
"""
Contacts a trusted Time Stamp Authority (TSA) server and embeds an RFC 3161 document timestamp into the PDF. Only a SHA-256 hash of the document is sent to the TSA - the PDF itself never leaves the server. Make the timestamp the last change to the file: any later edit invalidates it. Input:PDF Output:PDF Type:SISO
"""
tsa_url: str | None = Field(
None,
description="URL of the RFC 3161 Time Stamp Authority (TSA) server. Must be one of the built-in presets (DigiCert, Sectigo, SSL.com, FreeTSA, MeSign) or an admin-configured URL in settings.yml (security.timestamp.customTsaUrls). If omitted, the server default is used (security.timestamp.defaultTsaUrl, DigiCert unless changed).",
examples=["http://timestamp.digicert.com"],
)
class UnlockPdfFormsParams(ApiModel):
"""
Removing read-only property from form fields making them fillable Input:PDF Output:PDF Type:SISO
"""
class Trapped(StrEnum):
"""
The trapped status of the document. Omit to remove it unless keepOmitted=true; readers treat a missing value as Unknown.
"""
true = "True"
false = "False"
unknown = "Unknown"
class UpdateMetadataParams(ApiModel):
"""
Standard fields left out are cleared unless keepOmitted=true, so otherwise 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='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 unless keepOmitted=true.", examples=["author"]
)
creation_date: str | None = Field(
None,
description="The creation date of the document (format: yyyy/MM/dd HH:mm:ss). Omit to remove it unless keepOmitted=true.",
examples=["2023/10/01 12:00:00"],
pattern="yyyy/MM/dd HH:mm:ss",
)
creator: str | None = Field(
None,
description="The creator of the document. Omit to remove it unless keepOmitted=true.",
examples=["creator"],
)
delete_all: bool = Field(
False, description="True removes all metadata, including XMP, and ignores the other fields"
)
keep_omitted: bool = Field(
False, description="True keeps the current value of every standard field left out, instead of removing it"
)
keywords: str | None = Field(
None,
description="The keywords for the document. Omit to remove it unless keepOmitted=true.",
examples=["keywords"],
)
modification_date: str | None = Field(
None,
description="The modification date of the document (format: yyyy/MM/dd HH:mm:ss). Omit to remove it unless keepOmitted=true.",
examples=["2023/10/01 12:00:00"],
pattern="yyyy/MM/dd HH:mm:ss",
)
producer: str | None = Field(
None,
description="The producer of the document. Omit to remove it unless keepOmitted=true.",
examples=["producer"],
)
subject: str | None = Field(
None,
description="The subject of the document. Omit to remove it unless keepOmitted=true.",
examples=["subject"],
)
title: str | None = Field(
None, description="The title of the document. Omit to remove it unless keepOmitted=true.", examples=["title"]
)
trapped: Trapped | None = Field(
None,
description="The trapped status of the document. Omit to remove it unless keepOmitted=true; readers treat a missing value as Unknown.",
)
class UrlToPdfParams(ApiModel):
"""
This endpoint fetches content from a URL and converts it to a PDF format. Input:NONE Output:PDF Type:SISO
"""
url_input: str = Field(..., description="The input URL to be converted to a PDF file")
class AutoRotatePdfParams(ApiModel):
"""
Detects each page's orientation (embedded-text direction first, Tesseract OSD for scanned pages) and sets the page rotation so the content displays upright. With dryRun=true, returns a JSON per-page report instead of the PDF. With pageRotations set (a JSON list such as [{"pageNumber":3,"rotation":90}]), applies only those clockwise turns without running detection. Input:PDF Output:PDF Type:SISO
"""
confidence_threshold: float = Field(
14.0,
description="Minimum Tesseract OSD orientation confidence required before a correction is applied. Matches OCRmyPDF's --rotate-pages-threshold scale",
ge=0.0,
)
detection_mode: DetectionMode = Field(
DetectionMode.auto,
description="Detection method. 'auto' tries embedded-text direction first and falls back to Tesseract OSD for pages without usable text; 'text' uses only embedded-text direction; 'osd' forces Tesseract OSD for every page",
)
dry_run: bool | None = Field(
None,
description="If true, no rotation is applied; returns a JSON report of the per-page detection results instead of a PDF",
)
infer_undetected: bool = Field(
True,
description="When a page cannot be decided on its own but the pages that could be decided agree on a single correction for that same current rotation, apply that shared correction to the undecided page. Handles documents rotated uniformly where some pages are too sparse to detect alone",
)
page_rotations: list[PageRotation] | None = Field(
None,
description="Optional pre-computed corrections to apply without running detection. Pages not listed are left unchanged, and a page may only appear once",
)
class RedactExecuteParams(ApiModel):
"""
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 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 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 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,
description="Regex patterns to match and redact. Each match anywhere in the document is blacked out. Uses Java/PCRE regex syntax. Well-suited for strings that follow known patterns, like phone numbers, email addresses, national ID numbers, or dates (which can appear with different separators, optional country codes, etc.). For fixed known strings such as names, use textValues instead.",
)
style: Style | None = Field(None, description="Redaction style options")
text_values: list[str] | None = Field(
None,
description="Exact strings to find and black out. One entry per phrase to redact. Best for known names, identifiers, and specific text found in the document.",
)
wipe_pages: list[int] | None = Field(
None, description="1-indexed page numbers to wipe entirely (all content removed from those pages)."
)
class RedactParams(ApiModel):
"""
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="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 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="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(
RootModel[
CbrToPdfParams
| CbzToPdfParams
| EbookToPdfParams
| EmlToPdfParams
| FileToPdfParams
| HtmlToPdfParams
| ImgToPdfParams
| MarkdownToPdfParams
| PdfToCbrParams
| PdfToCbzParams
| PdfToCsvParams
| PdfToEpubParams
| PdfToHtmlParams
| PdfToImgParams
| PdfToMarkdownParams
| PdfToPdfaParams
| PdfToPresentationParams
| PdfToTextParams
| PdfToUaParams
| PdfToWordParams
| PdfToXlsxParams
| PdfToXmlParams
| SvgToPdfParams
| UrlToPdfParams
| BookletImpositionParams
| CropParams
| EditTableOfContentsParams
| MergePdfsParams
| MultiPageLayoutParams
| PdfToSinglePageParams
| RearrangePagesParams
| RemoveImagePdfParams
| RemovePagesParams
| RotatePdfParams
| ScalePagesParams
| SplitBySizeOrCountParams
| SplitForPosterPrintParams
| SplitPagesParams
| SplitPdfByChaptersParams
| SplitPdfBySectionsParams
| AddCommentsParams
| AddPageNumbersParams
| AddStampParams
| AutoRenameParams
| AutoRotatePdfParams
| AutoSplitPdfParams
| BatchProcessAttachmentsParams
| CompressPdfParams
| CreatePortfolioParams
| DeleteAttachmentParams
| ExtractAttachmentsParams
| ExtractImageScansParams
| ExtractImagesParams
| ExtractSingleAttachmentParams
| FlattenParams
| FlattenPortfolioParams
| OcrPdfParams
| RemoveBlanksParams
| RenameAttachmentParams
| RepairParams
| ReplaceInvertPdfParams
| ScannerEffectParams
| UnlockPdfFormsParams
| UpdateMetadataParams
| AccessibilityReportParams
| AddPasswordParams
| AddWatermarkParams
| AutoRedactParams
| RedactParams
| RedactExecuteParams
| RemoveCertSignParams
| RemovePasswordParams
| SanitizePdfParams
| TimestampPdfParams
]
):
root: (
CbrToPdfParams
| CbzToPdfParams
| EbookToPdfParams
| EmlToPdfParams
| FileToPdfParams
| HtmlToPdfParams
| ImgToPdfParams
| MarkdownToPdfParams
| PdfToCbrParams
| PdfToCbzParams
| PdfToCsvParams
| PdfToEpubParams
| PdfToHtmlParams
| PdfToImgParams
| PdfToMarkdownParams
| PdfToPdfaParams
| PdfToPresentationParams
| PdfToTextParams
| PdfToUaParams
| PdfToWordParams
| PdfToXlsxParams
| PdfToXmlParams
| SvgToPdfParams
| UrlToPdfParams
| BookletImpositionParams
| CropParams
| EditTableOfContentsParams
| MergePdfsParams
| MultiPageLayoutParams
| PdfToSinglePageParams
| RearrangePagesParams
| RemoveImagePdfParams
| RemovePagesParams
| RotatePdfParams
| ScalePagesParams
| SplitBySizeOrCountParams
| SplitForPosterPrintParams
| SplitPagesParams
| SplitPdfByChaptersParams
| SplitPdfBySectionsParams
| AddCommentsParams
| AddPageNumbersParams
| AddStampParams
| AutoRenameParams
| AutoRotatePdfParams
| AutoSplitPdfParams
| BatchProcessAttachmentsParams
| CompressPdfParams
| CreatePortfolioParams
| DeleteAttachmentParams
| ExtractAttachmentsParams
| ExtractImageScansParams
| ExtractImagesParams
| ExtractSingleAttachmentParams
| FlattenParams
| FlattenPortfolioParams
| OcrPdfParams
| RemoveBlanksParams
| RenameAttachmentParams
| RepairParams
| ReplaceInvertPdfParams
| ScannerEffectParams
| UnlockPdfFormsParams
| UpdateMetadataParams
| AccessibilityReportParams
| AddPasswordParams
| AddWatermarkParams
| AutoRedactParams
| RedactParams
| RedactExecuteParams
| RemoveCertSignParams
| RemovePasswordParams
| SanitizePdfParams
| TimestampPdfParams
)
type ParamToolModel = (
CbrToPdfParams
| CbzToPdfParams
| EbookToPdfParams
| EmlToPdfParams
| FileToPdfParams
| HtmlToPdfParams
| ImgToPdfParams
| MarkdownToPdfParams
| PdfToCbrParams
| PdfToCbzParams
| PdfToCsvParams
| PdfToEpubParams
| PdfToHtmlParams
| PdfToImgParams
| PdfToMarkdownParams
| PdfToPdfaParams
| PdfToPresentationParams
| PdfToTextParams
| PdfToUaParams
| PdfToWordParams
| PdfToXlsxParams
| PdfToXmlParams
| SvgToPdfParams
| UrlToPdfParams
| BookletImpositionParams
| CropParams
| EditTableOfContentsParams
| MergePdfsParams
| MultiPageLayoutParams
| PdfToSinglePageParams
| RearrangePagesParams
| RemoveImagePdfParams
| RemovePagesParams
| RotatePdfParams
| ScalePagesParams
| SplitBySizeOrCountParams
| SplitForPosterPrintParams
| SplitPagesParams
| SplitPdfByChaptersParams
| SplitPdfBySectionsParams
| AddCommentsParams
| AddPageNumbersParams
| AddStampParams
| AutoRenameParams
| AutoRotatePdfParams
| AutoSplitPdfParams
| BatchProcessAttachmentsParams
| CompressPdfParams
| CreatePortfolioParams
| DeleteAttachmentParams
| ExtractAttachmentsParams
| ExtractImageScansParams
| ExtractImagesParams
| ExtractSingleAttachmentParams
| FlattenParams
| FlattenPortfolioParams
| OcrPdfParams
| RemoveBlanksParams
| RenameAttachmentParams
| RepairParams
| ReplaceInvertPdfParams
| ScannerEffectParams
| UnlockPdfFormsParams
| UpdateMetadataParams
| AccessibilityReportParams
| AddPasswordParams
| AddWatermarkParams
| AutoRedactParams
| RedactParams
| RedactExecuteParams
| RemoveCertSignParams
| RemovePasswordParams
| SanitizePdfParams
| TimestampPdfParams
)
type ParamToolModelType = type[ParamToolModel]
class ToolEndpoint(StrEnum):
CBR_TO_PDF = "/api/v1/convert/cbr/pdf"
CBZ_TO_PDF = "/api/v1/convert/cbz/pdf"
EBOOK_TO_PDF = "/api/v1/convert/ebook/pdf"
EML_TO_PDF = "/api/v1/convert/eml/pdf"
FILE_TO_PDF = "/api/v1/convert/file/pdf"
HTML_TO_PDF = "/api/v1/convert/html/pdf"
IMG_TO_PDF = "/api/v1/convert/img/pdf"
MARKDOWN_TO_PDF = "/api/v1/convert/markdown/pdf"
PDF_TO_CBR = "/api/v1/convert/pdf/cbr"
PDF_TO_CBZ = "/api/v1/convert/pdf/cbz"
PDF_TO_CSV = "/api/v1/convert/pdf/csv"
PDF_TO_EPUB = "/api/v1/convert/pdf/epub"
PDF_TO_HTML = "/api/v1/convert/pdf/html"
PDF_TO_IMG = "/api/v1/convert/pdf/img"
PDF_TO_MARKDOWN = "/api/v1/convert/pdf/markdown"
PDF_TO_PDFA = "/api/v1/convert/pdf/pdfa"
PDF_TO_PRESENTATION = "/api/v1/convert/pdf/presentation"
PDF_TO_TEXT = "/api/v1/convert/pdf/text"
PDF_TO_UA = "/api/v1/convert/pdf/ua"
PDF_TO_WORD = "/api/v1/convert/pdf/word"
PDF_TO_XLSX = "/api/v1/convert/pdf/xlsx"
PDF_TO_XML = "/api/v1/convert/pdf/xml"
SVG_TO_PDF = "/api/v1/convert/svg/pdf"
URL_TO_PDF = "/api/v1/convert/url/pdf"
BOOKLET_IMPOSITION = "/api/v1/general/booklet-imposition"
CROP = "/api/v1/general/crop"
EDIT_TABLE_OF_CONTENTS = "/api/v1/general/edit-table-of-contents"
MERGE_PDFS = "/api/v1/general/merge-pdfs"
MULTI_PAGE_LAYOUT = "/api/v1/general/multi-page-layout"
PDF_TO_SINGLE_PAGE = "/api/v1/general/pdf-to-single-page"
REARRANGE_PAGES = "/api/v1/general/rearrange-pages"
REMOVE_IMAGE_PDF = "/api/v1/general/remove-image-pdf"
REMOVE_PAGES = "/api/v1/general/remove-pages"
ROTATE_PDF = "/api/v1/general/rotate-pdf"
SCALE_PAGES = "/api/v1/general/scale-pages"
SPLIT_BY_SIZE_OR_COUNT = "/api/v1/general/split-by-size-or-count"
SPLIT_FOR_POSTER_PRINT = "/api/v1/general/split-for-poster-print"
SPLIT_PAGES = "/api/v1/general/split-pages"
SPLIT_PDF_BY_CHAPTERS = "/api/v1/general/split-pdf-by-chapters"
SPLIT_PDF_BY_SECTIONS = "/api/v1/general/split-pdf-by-sections"
ADD_COMMENTS = "/api/v1/misc/add-comments"
ADD_PAGE_NUMBERS = "/api/v1/misc/add-page-numbers"
ADD_STAMP = "/api/v1/misc/add-stamp"
AUTO_RENAME = "/api/v1/misc/auto-rename"
AUTO_ROTATE_PDF = "/api/v1/misc/auto-rotate-pdf"
AUTO_SPLIT_PDF = "/api/v1/misc/auto-split-pdf"
BATCH_PROCESS_ATTACHMENTS = "/api/v1/misc/batch-process-attachments"
COMPRESS_PDF = "/api/v1/misc/compress-pdf"
CREATE_PORTFOLIO = "/api/v1/misc/create-portfolio"
DELETE_ATTACHMENT = "/api/v1/misc/delete-attachment"
EXTRACT_ATTACHMENTS = "/api/v1/misc/extract-attachments"
EXTRACT_IMAGE_SCANS = "/api/v1/misc/extract-image-scans"
EXTRACT_IMAGES = "/api/v1/misc/extract-images"
EXTRACT_SINGLE_ATTACHMENT = "/api/v1/misc/extract-single-attachment"
FLATTEN = "/api/v1/misc/flatten"
FLATTEN_PORTFOLIO = "/api/v1/misc/flatten-portfolio"
OCR_PDF = "/api/v1/misc/ocr-pdf"
REMOVE_BLANKS = "/api/v1/misc/remove-blanks"
RENAME_ATTACHMENT = "/api/v1/misc/rename-attachment"
REPAIR = "/api/v1/misc/repair"
REPLACE_INVERT_PDF = "/api/v1/misc/replace-invert-pdf"
SCANNER_EFFECT = "/api/v1/misc/scanner-effect"
UNLOCK_PDF_FORMS = "/api/v1/misc/unlock-pdf-forms"
UPDATE_METADATA = "/api/v1/misc/update-metadata"
ACCESSIBILITY_REPORT = "/api/v1/security/accessibility-report"
ADD_PASSWORD = "/api/v1/security/add-password"
ADD_WATERMARK = "/api/v1/security/add-watermark"
AUTO_REDACT = "/api/v1/security/auto-redact"
REDACT = "/api/v1/security/redact"
REDACT_EXECUTE = "/api/v1/security/redact-execute"
REMOVE_CERT_SIGN = "/api/v1/security/remove-cert-sign"
REMOVE_PASSWORD = "/api/v1/security/remove-password"
SANITIZE_PDF = "/api/v1/security/sanitize-pdf"
TIMESTAMP_PDF = "/api/v1/security/timestamp-pdf"
OPERATIONS: dict[ToolEndpoint, ParamToolModelType] = {
ToolEndpoint.CBR_TO_PDF: CbrToPdfParams,
ToolEndpoint.CBZ_TO_PDF: CbzToPdfParams,
ToolEndpoint.EBOOK_TO_PDF: EbookToPdfParams,
ToolEndpoint.EML_TO_PDF: EmlToPdfParams,
ToolEndpoint.FILE_TO_PDF: FileToPdfParams,
ToolEndpoint.HTML_TO_PDF: HtmlToPdfParams,
ToolEndpoint.IMG_TO_PDF: ImgToPdfParams,
ToolEndpoint.MARKDOWN_TO_PDF: MarkdownToPdfParams,
ToolEndpoint.PDF_TO_CBR: PdfToCbrParams,
ToolEndpoint.PDF_TO_CBZ: PdfToCbzParams,
ToolEndpoint.PDF_TO_CSV: PdfToCsvParams,
ToolEndpoint.PDF_TO_EPUB: PdfToEpubParams,
ToolEndpoint.PDF_TO_HTML: PdfToHtmlParams,
ToolEndpoint.PDF_TO_IMG: PdfToImgParams,
ToolEndpoint.PDF_TO_MARKDOWN: PdfToMarkdownParams,
ToolEndpoint.PDF_TO_PDFA: PdfToPdfaParams,
ToolEndpoint.PDF_TO_PRESENTATION: PdfToPresentationParams,
ToolEndpoint.PDF_TO_TEXT: PdfToTextParams,
ToolEndpoint.PDF_TO_UA: PdfToUaParams,
ToolEndpoint.PDF_TO_WORD: PdfToWordParams,
ToolEndpoint.PDF_TO_XLSX: PdfToXlsxParams,
ToolEndpoint.PDF_TO_XML: PdfToXmlParams,
ToolEndpoint.SVG_TO_PDF: SvgToPdfParams,
ToolEndpoint.URL_TO_PDF: UrlToPdfParams,
ToolEndpoint.BOOKLET_IMPOSITION: BookletImpositionParams,
ToolEndpoint.CROP: CropParams,
ToolEndpoint.EDIT_TABLE_OF_CONTENTS: EditTableOfContentsParams,
ToolEndpoint.MERGE_PDFS: MergePdfsParams,
ToolEndpoint.MULTI_PAGE_LAYOUT: MultiPageLayoutParams,
ToolEndpoint.PDF_TO_SINGLE_PAGE: PdfToSinglePageParams,
ToolEndpoint.REARRANGE_PAGES: RearrangePagesParams,
ToolEndpoint.REMOVE_IMAGE_PDF: RemoveImagePdfParams,
ToolEndpoint.REMOVE_PAGES: RemovePagesParams,
ToolEndpoint.ROTATE_PDF: RotatePdfParams,
ToolEndpoint.SCALE_PAGES: ScalePagesParams,
ToolEndpoint.SPLIT_BY_SIZE_OR_COUNT: SplitBySizeOrCountParams,
ToolEndpoint.SPLIT_FOR_POSTER_PRINT: SplitForPosterPrintParams,
ToolEndpoint.SPLIT_PAGES: SplitPagesParams,
ToolEndpoint.SPLIT_PDF_BY_CHAPTERS: SplitPdfByChaptersParams,
ToolEndpoint.SPLIT_PDF_BY_SECTIONS: SplitPdfBySectionsParams,
ToolEndpoint.ADD_COMMENTS: AddCommentsParams,
ToolEndpoint.ADD_PAGE_NUMBERS: AddPageNumbersParams,
ToolEndpoint.ADD_STAMP: AddStampParams,
ToolEndpoint.AUTO_RENAME: AutoRenameParams,
ToolEndpoint.AUTO_ROTATE_PDF: AutoRotatePdfParams,
ToolEndpoint.AUTO_SPLIT_PDF: AutoSplitPdfParams,
ToolEndpoint.BATCH_PROCESS_ATTACHMENTS: BatchProcessAttachmentsParams,
ToolEndpoint.COMPRESS_PDF: CompressPdfParams,
ToolEndpoint.CREATE_PORTFOLIO: CreatePortfolioParams,
ToolEndpoint.DELETE_ATTACHMENT: DeleteAttachmentParams,
ToolEndpoint.EXTRACT_ATTACHMENTS: ExtractAttachmentsParams,
ToolEndpoint.EXTRACT_IMAGE_SCANS: ExtractImageScansParams,
ToolEndpoint.EXTRACT_IMAGES: ExtractImagesParams,
ToolEndpoint.EXTRACT_SINGLE_ATTACHMENT: ExtractSingleAttachmentParams,
ToolEndpoint.FLATTEN: FlattenParams,
ToolEndpoint.FLATTEN_PORTFOLIO: FlattenPortfolioParams,
ToolEndpoint.OCR_PDF: OcrPdfParams,
ToolEndpoint.REMOVE_BLANKS: RemoveBlanksParams,
ToolEndpoint.RENAME_ATTACHMENT: RenameAttachmentParams,
ToolEndpoint.REPAIR: RepairParams,
ToolEndpoint.REPLACE_INVERT_PDF: ReplaceInvertPdfParams,
ToolEndpoint.SCANNER_EFFECT: ScannerEffectParams,
ToolEndpoint.UNLOCK_PDF_FORMS: UnlockPdfFormsParams,
ToolEndpoint.UPDATE_METADATA: UpdateMetadataParams,
ToolEndpoint.ACCESSIBILITY_REPORT: AccessibilityReportParams,
ToolEndpoint.ADD_PASSWORD: AddPasswordParams,
ToolEndpoint.ADD_WATERMARK: AddWatermarkParams,
ToolEndpoint.AUTO_REDACT: AutoRedactParams,
ToolEndpoint.REDACT: RedactParams,
ToolEndpoint.REDACT_EXECUTE: RedactExecuteParams,
ToolEndpoint.REMOVE_CERT_SIGN: RemoveCertSignParams,
ToolEndpoint.REMOVE_PASSWORD: RemovePasswordParams,
ToolEndpoint.SANITIZE_PDF: SanitizePdfParams,
ToolEndpoint.TIMESTAMP_PDF: TimestampPdfParams,
}