fix: add embedded file(s) to catalog
This commit is contained in:

committed by
Paul van Brouwershaven

parent
8b036403a6
commit
5a0cd0a9b9
@@ -12,16 +12,28 @@ func (context *SignContext) createCatalog() (catalog string, err error) {
|
|||||||
root := context.PDFReader.Trailer().Key("Root")
|
root := context.PDFReader.Trailer().Key("Root")
|
||||||
root_keys := root.Keys()
|
root_keys := root.Keys()
|
||||||
found_pages := false
|
found_pages := false
|
||||||
|
found_names := false
|
||||||
for _, key := range root_keys {
|
for _, key := range root_keys {
|
||||||
if key == "Pages" {
|
if key == "Pages" {
|
||||||
found_pages = true
|
found_pages = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for _, key := range root_keys {
|
||||||
|
if key == "Names" {
|
||||||
|
found_names = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rootPtr := root.GetPtr()
|
rootPtr := root.GetPtr()
|
||||||
context.CatalogData.RootString = strconv.Itoa(int(rootPtr.GetID())) + " " + strconv.Itoa(int(rootPtr.GetGen())) + " R"
|
context.CatalogData.RootString = strconv.Itoa(int(rootPtr.GetID())) + " " + strconv.Itoa(int(rootPtr.GetGen())) + " R"
|
||||||
|
|
||||||
|
if found_names {
|
||||||
|
names := root.Key("Names").GetPtr()
|
||||||
|
catalog += " /Names " + strconv.Itoa(int(names.GetID())) + " " + strconv.Itoa(int(names.GetGen())) + " R"
|
||||||
|
}
|
||||||
|
|
||||||
if found_pages {
|
if found_pages {
|
||||||
pages := root.Key("Pages").GetPtr()
|
pages := root.Key("Pages").GetPtr()
|
||||||
catalog += " /Pages " + strconv.Itoa(int(pages.GetID())) + " " + strconv.Itoa(int(pages.GetGen())) + " R"
|
catalog += " /Pages " + strconv.Itoa(int(pages.GetID())) + " " + strconv.Itoa(int(pages.GetGen())) + " R"
|
||||||
|
Reference in New Issue
Block a user