diff --git a/sign/pdfcatalog.go b/sign/pdfcatalog.go index b5b8537..8f16c18 100644 --- a/sign/pdfcatalog.go +++ b/sign/pdfcatalog.go @@ -30,7 +30,7 @@ func (context *SignContext) createCatalog() ([]byte, error) { // If an incremental upgrade requires a version that is higher than specified by the document. // Ensure PDF version is at least 1.5 to support SigFlags in acroFormDict (1.4) and UF in the fileSpecDict (1.5) if v, err := strconv.ParseFloat(context.PDFReader.PDFVersion, 64); err == nil && v < 1.5 { - catalog_buffer.WriteString(" /Version /1.5") + catalog_buffer.WriteString(" /Version /1.5\n") } // Retrieve the root, its pointer and set the root string diff --git a/sign/pdfcatalog_test.go b/sign/pdfcatalog_test.go index e47a4ab..76da046 100644 --- a/sign/pdfcatalog_test.go +++ b/sign/pdfcatalog_test.go @@ -21,11 +21,11 @@ var testFiles = []struct { }, }, { - file: "../testfiles/testfile21.pdf", + file: "../testfiles/testfile12.pdf", expectedCatalogs: map[CertType]string{ - CertificationSignature: "<<\n /Type /Catalog\n /Metadata 8 0 R\n /Names 6 0 R\n /Pages 9 0 R\n /AcroForm <<\n /Fields [16 0 R]\n /SigFlags 3\n >>\n>>\n", - UsageRightsSignature: "<<\n /Type /Catalog\n /Metadata 8 0 R\n /Names 6 0 R\n /Pages 9 0 R\n /AcroForm <<\n /Fields [16 0 R]\n /SigFlags 1\n >>\n>>\n", - ApprovalSignature: "<<\n /Type /Catalog\n /Metadata 8 0 R\n /Names 6 0 R\n /Pages 9 0 R\n /AcroForm <<\n /Fields [16 0 R]\n /SigFlags 3\n >>\n>>\n", + CertificationSignature: "<<\n /Type /Catalog\n /Version /1.5\n /Outlines 2 0 R\n /Pages 3 0 R\n /AcroForm <<\n /Fields [16 0 R]\n /SigFlags 3\n >>\n>>\n", + UsageRightsSignature: "<<\n /Type /Catalog\n /Version /1.5\n /Outlines 2 0 R\n /Pages 3 0 R\n /AcroForm <<\n /Fields [16 0 R]\n /SigFlags 1\n >>\n>>\n", + ApprovalSignature: "<<\n /Type /Catalog\n /Version /1.5\n /Outlines 2 0 R\n /Pages 3 0 R\n /AcroForm <<\n /Fields [16 0 R]\n /SigFlags 3\n >>\n>>\n", }, }, } diff --git a/sign/pdfxref_test.go b/sign/pdfxref_test.go index 1a81a11..a107ca9 100644 --- a/sign/pdfxref_test.go +++ b/sign/pdfxref_test.go @@ -20,7 +20,6 @@ func TestGetLastObjectIDFromXref(t *testing.T) { {"testfile16.pdf", 567}, {"testfile17.pdf", 20}, {"testfile20.pdf", 10}, - {"testfile21.pdf", 16}, } for _, tc := range testCases { diff --git a/testfiles/testfile21.pdf b/testfiles/testfile21.pdf deleted file mode 100644 index f7f0908..0000000 Binary files a/testfiles/testfile21.pdf and /dev/null differ