Browse Source

don't use array buffes to implement moveStart, that won't work for filtered streams

Andreas Gal 14 years ago
parent
commit
dd5ab1f10f
  1. 6
      pdf.js

6
pdf.js

@ -5,6 +5,7 @@ var Stream = (function() {
function constructor(arrayBuffer) { function constructor(arrayBuffer) {
this.bytes = Uint8Array(arrayBuffer); this.bytes = Uint8Array(arrayBuffer);
this.pos = 0; this.pos = 0;
this.start = 0;
} }
constructor.prototype = { constructor.prototype = {
@ -12,7 +13,7 @@ var Stream = (function() {
return this.bytes.length; return this.bytes.length;
}, },
reset: function() { reset: function() {
this.pos = 0; this.pos = this.start;
}, },
lookChar: function() { lookChar: function() {
var bytes = this.bytes; var bytes = this.bytes;
@ -37,8 +38,7 @@ var Stream = (function() {
this.pos += n; this.pos += n;
}, },
moveStart: function() { moveStart: function() {
this.bytes = Uint8Array(this.bytes, this.pos); this.start = this.pos;
this.pos = 0;
}, },
find: function(needle, limit, backwards) { find: function(needle, limit, backwards) {
var length = this.bytes.length; var length = this.bytes.length;

Loading…
Cancel
Save