mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-02 22:17:06 +08:00
Fix problem with encryptObject having incorrect reference in trailer due to copying
This commit is contained in:
parent
38dae76b5d
commit
4068ea6130
@ -247,6 +247,7 @@ func (this *PdfWriter) copyObjects() {
|
|||||||
this.objectsMap = objectsMap
|
this.objectsMap = objectsMap
|
||||||
this.infoObj = copyObject(this.infoObj, objectToObjectCopyMap).(*PdfIndirectObject)
|
this.infoObj = copyObject(this.infoObj, objectToObjectCopyMap).(*PdfIndirectObject)
|
||||||
this.root = copyObject(this.root, objectToObjectCopyMap).(*PdfIndirectObject)
|
this.root = copyObject(this.root, objectToObjectCopyMap).(*PdfIndirectObject)
|
||||||
|
this.encryptObj = copyObject(this.encryptObj, objectToObjectCopyMap).(*PdfIndirectObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the PDF version of the output file.
|
// Set the PDF version of the output file.
|
||||||
@ -859,6 +860,8 @@ func (this *PdfWriter) Write(writer io.Writer) error {
|
|||||||
}
|
}
|
||||||
// Set version in the catalog.
|
// Set version in the catalog.
|
||||||
this.catalog.Set("Version", MakeName(fmt.Sprintf("%d.%d", this.majorVersion, this.minorVersion)))
|
this.catalog.Set("Version", MakeName(fmt.Sprintf("%d.%d", this.majorVersion, this.minorVersion)))
|
||||||
|
|
||||||
|
// Make a copy of objects prior to optimizing as this can alter the objects.
|
||||||
this.copyObjects()
|
this.copyObjects()
|
||||||
|
|
||||||
if this.optimizer != nil {
|
if this.optimizer != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user