From 34a7869f91ac66599cf974232f8a20ff8b7c71ec Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Thu, 12 Feb 2026 15:56:38 +0700 Subject: [PATCH] fix: Reset base output stream position before PDF file reading to ensure correct parsing. --- models/sign_document.py | 1 + 1 file changed, 1 insertion(+) diff --git a/models/sign_document.py b/models/sign_document.py index 750d6c0..0365271 100644 --- a/models/sign_document.py +++ b/models/sign_document.py @@ -33,6 +33,7 @@ class SignDocument(models.Model): # 3. Load the base output into PdfFileReader # base_output is a BytesIO try: + base_output.seek(0) # IMPORTANT: Reset stream position to start base_pdf = PdfFileReader(base_output, strict=False) except (ValueError, PdfReadError): # Should not happen if super succeeded, but safety first