mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 19:33:11 +02:00
Pdf comment agent (#6196)
Co-authored-by: James Brunton <[email protected]>
This commit is contained in:
co-authored by
James Brunton
parent
2dc5276e8b
commit
86774d556e
@@ -18,6 +18,16 @@ class AddAttachmentsParams(ApiModel):
|
||||
)
|
||||
|
||||
|
||||
class AddCommentsParams(ApiModel):
|
||||
comments: str | None = Field(
|
||||
None,
|
||||
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 AddImageParams(ApiModel):
|
||||
every_page: bool | None = Field(False, description="Whether to overlay the image onto every page of the PDF.")
|
||||
x: float | None = Field(0, description="The x-coordinate at which to place the top-left corner of the image.")
|
||||
@@ -447,6 +457,7 @@ class MergePdfsParams(ApiModel):
|
||||
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 | None = 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.",
|
||||
@@ -688,6 +699,10 @@ class PdfToPresentationParams(ApiModel):
|
||||
output_format: OutputFormat2 | None = Field(None, description="The output Presentation format")
|
||||
|
||||
|
||||
class PdfToTextEditorParams(ApiModel):
|
||||
lightweight: bool | None = False
|
||||
|
||||
|
||||
class OutputFormat3(StrEnum):
|
||||
rtf = "rtf"
|
||||
txt = "txt"
|
||||
@@ -1037,6 +1052,11 @@ class UrlToPdfParams(ApiModel):
|
||||
url_input: str | None = Field(None, description="The input URL to be converted to a PDF file")
|
||||
|
||||
|
||||
class ValidateCertificateParams(ApiModel):
|
||||
cert_type: str | None = None
|
||||
password: str | None = None
|
||||
|
||||
|
||||
class OutputFormat6(StrEnum):
|
||||
eps = "eps"
|
||||
ps = "ps"
|
||||
@@ -1075,6 +1095,7 @@ class Model(
|
||||
| PdfToPdfaParams
|
||||
| PdfToPresentationParams
|
||||
| PdfToTextParams
|
||||
| PdfToTextEditorParams
|
||||
| PdfToVectorParams
|
||||
| PdfToWordParams
|
||||
| PdfToXlsxParams
|
||||
@@ -1097,6 +1118,7 @@ class Model(
|
||||
| SplitPdfByChaptersParams
|
||||
| SplitPdfBySectionsParams
|
||||
| AddAttachmentsParams
|
||||
| AddCommentsParams
|
||||
| AddImageParams
|
||||
| AddPageNumbersParams
|
||||
| AddStampParams
|
||||
@@ -1118,6 +1140,7 @@ class Model(
|
||||
| AutoRedactParams
|
||||
| CertSignParams
|
||||
| SessionsParams
|
||||
| ValidateCertificateParams
|
||||
| RedactParams
|
||||
| RemovePasswordParams
|
||||
| SanitizePdfParams
|
||||
@@ -1139,6 +1162,7 @@ class Model(
|
||||
| PdfToPdfaParams
|
||||
| PdfToPresentationParams
|
||||
| PdfToTextParams
|
||||
| PdfToTextEditorParams
|
||||
| PdfToVectorParams
|
||||
| PdfToWordParams
|
||||
| PdfToXlsxParams
|
||||
@@ -1161,6 +1185,7 @@ class Model(
|
||||
| SplitPdfByChaptersParams
|
||||
| SplitPdfBySectionsParams
|
||||
| AddAttachmentsParams
|
||||
| AddCommentsParams
|
||||
| AddImageParams
|
||||
| AddPageNumbersParams
|
||||
| AddStampParams
|
||||
@@ -1182,6 +1207,7 @@ class Model(
|
||||
| AutoRedactParams
|
||||
| CertSignParams
|
||||
| SessionsParams
|
||||
| ValidateCertificateParams
|
||||
| RedactParams
|
||||
| RemovePasswordParams
|
||||
| SanitizePdfParams
|
||||
@@ -1204,6 +1230,7 @@ type ParamToolModel = (
|
||||
| PdfToPdfaParams
|
||||
| PdfToPresentationParams
|
||||
| PdfToTextParams
|
||||
| PdfToTextEditorParams
|
||||
| PdfToVectorParams
|
||||
| PdfToWordParams
|
||||
| PdfToXlsxParams
|
||||
@@ -1226,6 +1253,7 @@ type ParamToolModel = (
|
||||
| SplitPdfByChaptersParams
|
||||
| SplitPdfBySectionsParams
|
||||
| AddAttachmentsParams
|
||||
| AddCommentsParams
|
||||
| AddImageParams
|
||||
| AddPageNumbersParams
|
||||
| AddStampParams
|
||||
@@ -1247,6 +1275,7 @@ type ParamToolModel = (
|
||||
| AutoRedactParams
|
||||
| CertSignParams
|
||||
| SessionsParams
|
||||
| ValidateCertificateParams
|
||||
| RedactParams
|
||||
| RemovePasswordParams
|
||||
| SanitizePdfParams
|
||||
@@ -1270,6 +1299,7 @@ class ToolEndpoint(StrEnum):
|
||||
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_TEXT_EDITOR = "/api/v1/convert/pdf/text-editor"
|
||||
PDF_TO_VECTOR = "/api/v1/convert/pdf/vector"
|
||||
PDF_TO_WORD = "/api/v1/convert/pdf/word"
|
||||
PDF_TO_XLSX = "/api/v1/convert/pdf/xlsx"
|
||||
@@ -1292,6 +1322,7 @@ class ToolEndpoint(StrEnum):
|
||||
SPLIT_PDF_BY_CHAPTERS = "/api/v1/general/split-pdf-by-chapters"
|
||||
SPLIT_PDF_BY_SECTIONS = "/api/v1/general/split-pdf-by-sections"
|
||||
ADD_ATTACHMENTS = "/api/v1/misc/add-attachments"
|
||||
ADD_COMMENTS = "/api/v1/misc/add-comments"
|
||||
ADD_IMAGE = "/api/v1/misc/add-image"
|
||||
ADD_PAGE_NUMBERS = "/api/v1/misc/add-page-numbers"
|
||||
ADD_STAMP = "/api/v1/misc/add-stamp"
|
||||
@@ -1313,6 +1344,7 @@ class ToolEndpoint(StrEnum):
|
||||
AUTO_REDACT = "/api/v1/security/auto-redact"
|
||||
CERT_SIGN = "/api/v1/security/cert-sign"
|
||||
SESSIONS = "/api/v1/security/cert-sign/sessions"
|
||||
VALIDATE_CERTIFICATE = "/api/v1/security/cert-sign/validate-certificate"
|
||||
REDACT = "/api/v1/security/redact"
|
||||
REMOVE_PASSWORD = "/api/v1/security/remove-password"
|
||||
SANITIZE_PDF = "/api/v1/security/sanitize-pdf"
|
||||
@@ -1334,6 +1366,7 @@ OPERATIONS: dict[ToolEndpoint, ParamToolModelType] = {
|
||||
ToolEndpoint.PDF_TO_PDFA: PdfToPdfaParams,
|
||||
ToolEndpoint.PDF_TO_PRESENTATION: PdfToPresentationParams,
|
||||
ToolEndpoint.PDF_TO_TEXT: PdfToTextParams,
|
||||
ToolEndpoint.PDF_TO_TEXT_EDITOR: PdfToTextEditorParams,
|
||||
ToolEndpoint.PDF_TO_VECTOR: PdfToVectorParams,
|
||||
ToolEndpoint.PDF_TO_WORD: PdfToWordParams,
|
||||
ToolEndpoint.PDF_TO_XLSX: PdfToXlsxParams,
|
||||
@@ -1356,6 +1389,7 @@ OPERATIONS: dict[ToolEndpoint, ParamToolModelType] = {
|
||||
ToolEndpoint.SPLIT_PDF_BY_CHAPTERS: SplitPdfByChaptersParams,
|
||||
ToolEndpoint.SPLIT_PDF_BY_SECTIONS: SplitPdfBySectionsParams,
|
||||
ToolEndpoint.ADD_ATTACHMENTS: AddAttachmentsParams,
|
||||
ToolEndpoint.ADD_COMMENTS: AddCommentsParams,
|
||||
ToolEndpoint.ADD_IMAGE: AddImageParams,
|
||||
ToolEndpoint.ADD_PAGE_NUMBERS: AddPageNumbersParams,
|
||||
ToolEndpoint.ADD_STAMP: AddStampParams,
|
||||
@@ -1377,6 +1411,7 @@ OPERATIONS: dict[ToolEndpoint, ParamToolModelType] = {
|
||||
ToolEndpoint.AUTO_REDACT: AutoRedactParams,
|
||||
ToolEndpoint.CERT_SIGN: CertSignParams,
|
||||
ToolEndpoint.SESSIONS: SessionsParams,
|
||||
ToolEndpoint.VALIDATE_CERTIFICATE: ValidateCertificateParams,
|
||||
ToolEndpoint.REDACT: RedactParams,
|
||||
ToolEndpoint.REMOVE_PASSWORD: RemovePasswordParams,
|
||||
ToolEndpoint.SANITIZE_PDF: SanitizePdfParams,
|
||||
|
||||
Reference in New Issue
Block a user