fix: Reset base output stream position before PDF file reading to ensure correct parsing.
This commit is contained in:
parent
a197c027ef
commit
34a7869f91
@ -33,6 +33,7 @@ class SignDocument(models.Model):
|
|||||||
# 3. Load the base output into PdfFileReader
|
# 3. Load the base output into PdfFileReader
|
||||||
# base_output is a BytesIO
|
# base_output is a BytesIO
|
||||||
try:
|
try:
|
||||||
|
base_output.seek(0) # IMPORTANT: Reset stream position to start
|
||||||
base_pdf = PdfFileReader(base_output, strict=False)
|
base_pdf = PdfFileReader(base_output, strict=False)
|
||||||
except (ValueError, PdfReadError):
|
except (ValueError, PdfReadError):
|
||||||
# Should not happen if super succeeded, but safety first
|
# Should not happen if super succeeded, but safety first
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user