mirror of
https://github.com/unidoc/unipdf.git
synced 2025-04-30 13:48:51 +08:00
Clear page dictionary prior to building. Add dictionary clear method
This commit is contained in:
parent
9c55596e2d
commit
01cd086550
@ -296,6 +296,7 @@ func (str *PdfObjectString) DefaultWriteString() string {
|
|||||||
return output.String()
|
return output.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String returns a string representation of `name`.
|
||||||
func (name *PdfObjectName) String() string {
|
func (name *PdfObjectName) String() string {
|
||||||
return string(*name)
|
return string(*name)
|
||||||
}
|
}
|
||||||
@ -581,6 +582,12 @@ func (d *PdfObjectDictionary) Keys() []PdfObjectName {
|
|||||||
return d.keys
|
return d.keys
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear resets the dictionary to an empty state.
|
||||||
|
func (d *PdfObjectDictionary) Clear() {
|
||||||
|
d.keys = []PdfObjectName{}
|
||||||
|
d.dict = map[PdfObjectName]PdfObject{}
|
||||||
|
}
|
||||||
|
|
||||||
// Remove removes an element specified by key.
|
// Remove removes an element specified by key.
|
||||||
func (d *PdfObjectDictionary) Remove(key PdfObjectName) {
|
func (d *PdfObjectDictionary) Remove(key PdfObjectName) {
|
||||||
idx := -1
|
idx := -1
|
||||||
|
@ -443,6 +443,7 @@ func (this *PdfPage) getResources() (*PdfPageResources, error) {
|
|||||||
// Convert the Page to a PDF object dictionary.
|
// Convert the Page to a PDF object dictionary.
|
||||||
func (this *PdfPage) GetPageDict() *PdfObjectDictionary {
|
func (this *PdfPage) GetPageDict() *PdfObjectDictionary {
|
||||||
p := this.pageDict
|
p := this.pageDict
|
||||||
|
p.Clear()
|
||||||
p.Set("Type", MakeName("Page"))
|
p.Set("Type", MakeName("Page"))
|
||||||
p.Set("Parent", this.Parent)
|
p.Set("Parent", this.Parent)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user