Append instead of replace
This commit is contained in:
@@ -22,7 +22,7 @@ func (context *SignContext) writeXref() error {
|
||||
|
||||
func (context *SignContext) writeXrefTable() error {
|
||||
xref_size := "xref\n0 " + strconv.FormatInt(context.PDFReader.XrefInformation.ItemCount, 10)
|
||||
new_xref_size := "xref\n0 " + strconv.FormatInt(context.PDFReader.XrefInformation.ItemCount+2, 10)
|
||||
new_xref_size := "xref\n0 " + strconv.FormatInt(context.PDFReader.XrefInformation.ItemCount+3, 10)
|
||||
|
||||
if _, err := context.OutputFile.Write([]byte(new_xref_size)); err != nil {
|
||||
return err
|
||||
@@ -34,7 +34,16 @@ func (context *SignContext) writeXrefTable() error {
|
||||
}
|
||||
|
||||
// Create the new catalog xref line.
|
||||
catalog_object_start_position := strconv.FormatInt(context.PDFReader.XrefInformation.StartPos, 10)
|
||||
visual_signature_object_start_position := strconv.FormatInt(context.Filesize, 10)
|
||||
visual_signature_xref_line := leftPad(visual_signature_object_start_position, "0", 10-len(visual_signature_object_start_position)) + " 00000 n\n"
|
||||
|
||||
// Write the new catalog xref line.
|
||||
if _, err := context.OutputFile.Write([]byte(visual_signature_xref_line)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Create the new catalog xref line.
|
||||
catalog_object_start_position := strconv.FormatInt(context.Filesize+context.VisualSignData.Length, 10)
|
||||
catalog_xref_line := leftPad(catalog_object_start_position, "0", 10-len(catalog_object_start_position)) + " 00000 n\n"
|
||||
|
||||
// Write the new catalog xref line.
|
||||
@@ -43,7 +52,7 @@ func (context *SignContext) writeXrefTable() error {
|
||||
}
|
||||
|
||||
// Create the new signature xref line.
|
||||
signature_object_start_position := strconv.FormatInt(context.PDFReader.XrefInformation.StartPos+context.CatalogData.Length, 10)
|
||||
signature_object_start_position := strconv.FormatInt(context.Filesize+context.VisualSignData.Length+context.CatalogData.Length, 10)
|
||||
signature_xref_line := leftPad(signature_object_start_position, "0", 10-len(signature_object_start_position)) + " 00000 n\n"
|
||||
|
||||
// Write the new signature xref line.
|
||||
|
Reference in New Issue
Block a user