From b8c2c04df9c728a66f1af59d25f7f694c027f7c0 Mon Sep 17 00:00:00 2001 From: ryanmiura Date: Mon, 13 Apr 2026 14:20:09 -0300 Subject: [PATCH] fix: reset context state on SignPDF retry --- sign/sign.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sign/sign.go b/sign/sign.go index 4856963..ada786d 100644 --- a/sign/sign.go +++ b/sign/sign.go @@ -86,6 +86,11 @@ func (context *SignContext) SignPDF() error { context.SignData.Appearance.Page = 1 } + // Reset slices and states that might be polluted from previous run if this is a retry + context.newXrefEntries = nil + context.updatedXrefEntries = nil + context.lastXrefID = 0 + context.OutputBuffer = filebuffer.New([]byte{}) // Copy old file into new buffer.