fix: Reset base output stream position before PDF file reading to ensure correct parsing.

This commit is contained in:
Suherdy Yacob 2026-02-12 15:56:38 +07:00
parent a197c027ef
commit 34a7869f91

View File

@ -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