]> git.parisson.com Git - pdf.js.git/commitdiff
fix next/prev/next bug, fiddle with UI, remove debugging code
authorChris Jones <jones.chris.g@gmail.com>
Wed, 25 May 2011 09:09:06 +0000 (21:09 +1200)
committerChris Jones <jones.chris.g@gmail.com>
Wed, 25 May 2011 09:09:06 +0000 (21:09 +1200)
pdf.js
test.html

diff --git a/pdf.js b/pdf.js
index 1755c74904b2da62ee2843e76d52748c514dc7b4..0628cfe32b662bfed3b7e795d6b381b36c7f09cf 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -1777,7 +1777,7 @@ var XRef = (function() {
             if (e) {
                 // The stream might be in use elsewhere, so clone it.
                 if (IsStream(e))
-                    e = e.makeSubStream(0);
+                    e = e.makeSubStream(e.start, e.length, e.dict);
                 return e;
             }
             e = this.getEntry(num);
@@ -2261,7 +2261,8 @@ var CanvasGraphics = (function() {
             if (!font)
                 return;
             this.current.fontSize = size;
-            this.ctx.font = this.current.fontSize +'px '+ font.BaseFont;
+            TODO("using hard-coded font for testing");
+            this.ctx.font = this.current.fontSize +'px "Nimbus Roman No9 L"';
         },
         moveText: function (x, y) {
             this.current.x = this.current.lineX += x;
@@ -2273,14 +2274,6 @@ var CanvasGraphics = (function() {
             this.current.y = this.current.lineY = 0;
         },
         showText: function(text) {
-
-
-            if (text == "Figur") {
-                console.log("  Tm: "+ this.current.textMatrix);
-                console.log("  cx/cy: "+ this.current.x +"/"+ this.current.y);
-            }
-
-
             this.ctx.save();
             this.ctx.translate(0, 2 * this.current.y);
             this.ctx.scale(1, -1);
index 9d5c0bf18dc2b1a76fee33ea94700e4af3e17dbe..10a35e16359074aa95a454d965a725d3cf488d4e 100644 (file)
--- a/test.html
+++ b/test.html
@@ -9,6 +9,19 @@ body {
   padding: 0px;
   background-color: #c0bdb7;
 }
+#controls {
+  border-bottom: 1px solid black;
+  position:fixed;
+  left: 0px; top: 0px;
+  width: 100%;
+  padding: 7px;
+  background-color: rgb(242, 240, 238);
+}
+span#info {
+  float: right;
+  font: 14px sans-serif;
+  margin-right: 10px;
+}
 #viewer {
   margin: auto;
   border: 1px solid black;
@@ -26,10 +39,14 @@ function load() {
     canvas = document.getElementById("canvas");
     canvas.mozOpaque = true;
     pageDisplay = document.getElementById("pageNumber");
-    timeDisplay = document.getElementById("time");
+    infoDisplay = document.getElementById("info");
+    open("uncompressed.tracemonkey-pldi-09.pdf");
+}
 
+function open(url) {
+    document.title = url;
     req = new XMLHttpRequest();
-    req.open("GET", "uncompressed.tracemonkey-pldi-09.pdf");
+    req.open("GET", url);
     req.mozResponseType = req.responseType = "arraybuffer";
     req.expected = (document.URL.indexOf("file:") == 0) ? 0 : 200;
     req.onreadystatechange = xhrstate;
@@ -68,7 +85,7 @@ function displayPage(num) {
 
     var t2 = Date.now();
 
-    timeDisplay.innerHTML = (t1 - t0) + "/" + (t2 - t1) + " ms";
+    infoDisplay.innerHTML = "Time to render: "+ (t1 - t0) + "/" + (t2 - t1) + " ms";
 }
 
 function nextPage() {
@@ -91,12 +108,13 @@ function gotoPage(num) {
 </head>
 
 <body onload="load();">
-  <div>
+  <div id="controls">
     <button onclick="prevPage();">Previous</button>
     <button onclick="nextPage();">Next</button>
     <input type="text" id="pageNumber" onchange="gotoPage(this.value);"
-           value="1" size="5"></input>
-    Time to render: <span id="time"></span>
+           value="1" size="4"></input>
+    <span id="info"></span>
+  </div>
   <div id="viewer">
     <!-- Canvas dimensions must be specified in CSS pixels.  CSS pixels
       -- are always 96 dpi.  These dimensions are 8.5x11in at 96dpi. -->