This commit is contained in:
saqib mir
2026-07-30 16:48:46 +05:30
parent 94b7f28d9c
commit ca3d124b0d
55 changed files with 5015 additions and 182 deletions
+5 -2
View File
@@ -26,6 +26,7 @@ def render_page(
rotation: int = 0,
render_mode: RenderMode = RenderMode.NORMAL
) -> Response:
print(f"[RENDER] document_id={document_id} page_index={page_index} zoom={zoom} dpi={dpi}")
if not engine.is_available():
raise HTTPException(
status_code=status.HTTP_501_NOT_IMPLEMENTED,
@@ -202,9 +203,11 @@ def extract_page_text(document_id: str, page_index: Annotated[int, Path(ge=0)]):
@compat_router.get("/render/{document_id}")
def render_page_compat(
request: Request, document_id: str, page: int = 0, zoom: float = 1.0, rotation: int = 0
request: Request, document_id: str, page: int = 0, zoom: float = 1.0, rotation: int = 0, dpi: int | None = None
) -> Response:
dpi = int(96 * zoom)
if dpi is None:
dpi = int(96 * zoom)
print(f"[RENDER_COMPAT] document_id={document_id} page={page} zoom={zoom} dpi={dpi}")
return render_page(request, document_id, page, dpi, zoom, rotation, RenderMode.NORMAL)