Changed file to writer/reader

This commit is contained in:
Jeroen Bobbeldijk
2017-09-23 16:37:39 +02:00
parent 08040f9140
commit 679656fb8d
9 changed files with 121 additions and 70 deletions

View File

@@ -35,18 +35,18 @@ func (context *SignContext) writeTrailer() error {
trailer_string = strings.Replace(trailer_string, info_string, new_info, -1)
// Write the new trailer.
if _, err := context.OutputFile.Write([]byte(trailer_string)); err != nil {
if _, err := context.OutputBuffer.Write([]byte(trailer_string)); err != nil {
return err
}
}
// Write the new xref start position.
if _, err := context.OutputFile.Write([]byte("\nstartxref\n" + strconv.FormatInt(context.NewXrefStart, 10) + "\n")); err != nil {
if _, err := context.OutputBuffer.Write([]byte("\nstartxref\n" + strconv.FormatInt(context.NewXrefStart, 10) + "\n")); err != nil {
return err
}
// Write PDF ending.
if _, err := context.OutputFile.Write([]byte("%%EOF")); err != nil {
if _, err := context.OutputBuffer.Write([]byte("%%EOF")); err != nil {
return err
}