summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2009-05-29 12:14:02 +0200
committerCarlos Garcia Campos <carlosgc@gnome.org>2009-06-16 16:34:15 +0200
commit1c92657be72c44dba7185808ffb00dd85c5ab289 (patch)
treed26a082845a75bcb7be6d65d4af20abf50e89257
parent4ad2d663262008e4b97342c4ed67c686ff5abd13 (diff)
Save page object and ref in Page class
This is needed to be able to modify the page object.
-rw-r--r--poppler/Catalog.cc2
-rw-r--r--poppler/Page.cc6
-rw-r--r--poppler/Page.h4
3 files changed, 9 insertions, 3 deletions
diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index a48639f2..9a18e244 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -309,7 +309,7 @@ int Catalog::readPageTree(Dict *pagesDict, PageAttrs *attrs, int start,
kids.arrayGet(i, &kid);
if (kid.isDict("Page")) {
attrs2 = new PageAttrs(attrs1, kid.getDict());
- page = new Page(xref, start+1, kid.getDict(), attrs2, form);
+ page = new Page(xref, start+1, kid.getDict(), kidRef.getRef(), attrs2, form);
if (!page->isOk()) {
++start;
goto err3;
diff --git a/poppler/Page.cc b/poppler/Page.cc
index 40cb6d9e..67d93e03 100644
--- a/poppler/Page.cc
+++ b/poppler/Page.cc
@@ -252,7 +252,7 @@ GBool PageAttrs::readBox(Dict *dict, char *key, PDFRectangle *box) {
// Page
//------------------------------------------------------------------------
-Page::Page(XRef *xrefA, int numA, Dict *pageDict, PageAttrs *attrsA, Form *form) {
+Page::Page(XRef *xrefA, int numA, Dict *pageDict, Ref pageRefA, PageAttrs *attrsA, Form *form) {
Object tmp;
ok = gTrue;
@@ -261,6 +261,9 @@ Page::Page(XRef *xrefA, int numA, Dict *pageDict, PageAttrs *attrsA, Form *form)
duration = -1;
pageWidgets = NULL;
+ pageObj.initDict(pageDict);
+ pageRef = pageRefA;
+
// get attributes
attrs = attrsA;
@@ -334,6 +337,7 @@ Page::Page(XRef *xrefA, int numA, Dict *pageDict, PageAttrs *attrsA, Form *form)
Page::~Page() {
delete pageWidgets;
delete attrs;
+ pageObj.free();
annots.free();
contents.free();
trans.free();
diff --git a/poppler/Page.h b/poppler/Page.h
index 61160839..103a5446 100644
--- a/poppler/Page.h
+++ b/poppler/Page.h
@@ -126,7 +126,7 @@ class Page {
public:
// Constructor.
- Page(XRef *xrefA, int numA, Dict *pageDict, PageAttrs *attrsA, Form *form);
+ Page(XRef *xrefA, int numA, Dict *pageDict, Ref pageRefA, PageAttrs *attrsA, Form *form);
// Destructor.
~Page();
@@ -235,6 +235,8 @@ public:
private:
XRef *xref; // the xref table for this PDF file
+ Object pageObj; // page dictionary
+ Ref pageRef; // page reference
int num; // page number
PageAttrs *attrs; // page attributes
Object annots; // annotations array