Go: additional small fixes
This commit is contained in:
parent
62206ed344
commit
9d2412398a
|
@ -64,9 +64,9 @@ func main() {
|
||||||
die(3, "%s", err)
|
die(3, "%s", err)
|
||||||
}
|
}
|
||||||
if pdfDocument, err = pdf.Sign(pdfDocument, key, certs); err != nil {
|
if pdfDocument, err = pdf.Sign(pdfDocument, key, certs); err != nil {
|
||||||
die(2, "error: %s", err)
|
die(4, "error: %s", err)
|
||||||
}
|
}
|
||||||
if err = ioutil.WriteFile(outputPath, pdfDocument, 0666); err != nil {
|
if err = ioutil.WriteFile(outputPath, pdfDocument, 0666); err != nil {
|
||||||
die(3, "%s", err)
|
die(5, "%s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -795,7 +795,8 @@ type BytesWriter interface {
|
||||||
WriteString(s string) (n int, err error)
|
WriteString(s string) (n int, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update appends an updated object to the end of the document.
|
// Update appends an updated object to the end of the document. The fill
|
||||||
|
// callback must write exactly one PDF object.
|
||||||
func (u *Updater) Update(n uint, fill func(buf BytesWriter)) {
|
func (u *Updater) Update(n uint, fill func(buf BytesWriter)) {
|
||||||
oldRef := u.xref[n]
|
oldRef := u.xref[n]
|
||||||
u.updated[n] = struct{}{}
|
u.updated[n] = struct{}{}
|
||||||
|
@ -880,7 +881,8 @@ func NewDate(ts time.Time) Object {
|
||||||
return NewString(string(buf))
|
return NewString(string(buf))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetFirstPage retrieves the first page of the document or a Nil object.
|
// GetFirstPage retrieves the first page of the given page (sub)tree reference,
|
||||||
|
// or returns a Nil object if unsuccessful.
|
||||||
func (u *Updater) GetFirstPage(nodeN, nodeGeneration uint) Object {
|
func (u *Updater) GetFirstPage(nodeN, nodeGeneration uint) Object {
|
||||||
obj, _ := u.Get(nodeN, nodeGeneration)
|
obj, _ := u.Get(nodeN, nodeGeneration)
|
||||||
if obj.Kind != Dict {
|
if obj.Kind != Dict {
|
||||||
|
@ -1126,7 +1128,7 @@ func Sign(document []byte,
|
||||||
buf.WriteString("\n /Contents <")
|
buf.WriteString("\n /Contents <")
|
||||||
|
|
||||||
signOff = buf.Len()
|
signOff = buf.Len()
|
||||||
signLen = 8192 // cert, digest, encripted digest, ...
|
signLen = 8192 // cert, digest, encrypted digest, ...
|
||||||
buf.Write(bytes.Repeat([]byte{'0'}, signLen))
|
buf.Write(bytes.Repeat([]byte{'0'}, signLen))
|
||||||
buf.WriteString("> >>")
|
buf.WriteString("> >>")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue