feat: implement redaction UI and backend engine support for area-based PDF redactions

This commit is contained in:
azeeee05
2026-07-09 11:51:28 +05:30
parent 82a07d2e6e
commit f9ec4e1680
12 changed files with 345 additions and 32 deletions
+22 -2
View File
@@ -21,6 +21,19 @@ class TextOverlayData(BaseModel):
fontFamily: str
color: str
class StampData(BaseModel):
text: str
x: float
y: float
width: float
height: float
textColor: str
backgroundColor: str
borderColor: str
fontSize: float = Field(..., gt=0)
includeDate: bool = False
timestamp: str | None = None
class RedactionData(BaseModel):
x: float
@@ -96,6 +109,12 @@ class TextOverlayOperation(BaseModel):
pageIndex: int = Field(..., ge=0)
data: TextOverlayData
class StampOperation(BaseModel):
id: str
type: Literal["stamp"]
pageIndex: int = Field(..., ge=0)
data: StampData
class RedactionOperation(BaseModel):
id: str
@@ -299,6 +318,7 @@ class SignatureOperation(BaseModel):
EditOperation = Annotated[
TextOverlayOperation
| StampOperation
| RedactionOperation
| ImageOverlayOperation
| HighlightOperation
@@ -329,8 +349,8 @@ class EditsRequest(BaseModel):
_OP_PERMISSION = {
"highlight": "canAnnotate", "underline": "canAnnotate", "strikeout": "canAnnotate",
"squiggly": "canAnnotate", "comment": "canAnnotate", "freehand": "canAnnotate",
"free_text": "canAnnotate", "text_overlay": "canAnnotate", "image_overlay": "canAnnotate",
"delete_annotation": "canAnnotate", "update_annotation": "canAnnotate",
"free_text": "canAnnotate", "text_overlay": "canAnnotate", "stamp": "canAnnotate",
"image_overlay": "canAnnotate", "delete_annotation": "canAnnotate", "update_annotation": "canAnnotate",
"replace_text": "canModify", "reflow_paragraph": "canModify", "redaction": "canModify",
"update_field": "canFillForms",
"page_rotation": "canAssemble", "page_deletion": "canAssemble", "page_reorder": "canAssemble",