]> git.parisson.com Git - pdf.js.git/commitdiff
skeleton for XRef support
authorAndreas Gal <andreas.gal@gmail.com>
Fri, 6 May 2011 19:12:57 +0000 (12:12 -0700)
committerAndreas Gal <andreas.gal@gmail.com>
Fri, 6 May 2011 19:12:57 +0000 (12:12 -0700)
pdf.js

diff --git a/pdf.js b/pdf.js
index 552d87b9a5c82e3ca09ac44350afc131bffa2bbd..e3e79896d723ac39375fd6b686c74e99234d23c1 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -609,6 +609,16 @@ var Linearization = (function () {
     return constructor;
 })();
 
+var XRef = (function () {
+    function constructor(stream, startXRef, mainXRefEntriesOffset) {
+    }
+
+    constructor.prototype = {
+    };
+
+    return constructor;
+})();
+
 var PDFDoc = (function () {
     function constructor(stream) {
         this.stream = stream;
@@ -660,6 +670,14 @@ var PDFDoc = (function () {
             // shadow the prototype getter with a data property
             return this.startXRef = startXRef;
         },
+        get mainXRefEntriesOffset() {
+            var mainXRefEntriesOffset = 0;
+            var linearization = this.linearization;
+            if (linearization)
+                mainXRefEntriesOffset = linearization.mainXRefEntriesOffset;
+            // shadow the prototype getter with a data property
+            return this.mainXRefEntriesOffset = mainXRefEntriesOffset;
+        },
         // Find the header, remove leading garbage and setup the stream
         // starting from the header.
         checkHeader: function() {
@@ -675,7 +693,10 @@ var PDFDoc = (function () {
         },
         setup: function(arrayBuffer, ownerPassword, userPassword) {
             this.checkHeader(arrayBuffer);
-            print(this.startXRef);
+            this.xref = new XRef(this.stream,
+                                 this.startXRef,
+                                 this.mainXRefEntriesOffset);
+            this.ok = this.xref.ok;
         }
     };