|
14 | 14 | * See the License for the specific language governing permissions and
|
15 | 15 | * limitations under the License.
|
16 | 16 | */
|
17 |
| -/* globals assert, bytesToString, calculateMD5, Catalog, Dict, error, info, |
18 |
| - isArray, isArrayBuffer, isName, isStream, isString, |
| 17 | +/* globals assert, calculateMD5, Catalog, Dict, error, info, isArray, |
| 18 | + isArrayBuffer, isName, isStream, isString, createPromiseCapability, |
19 | 19 | Linearization, NullStream, PartialEvaluator, shadow, Stream, Lexer,
|
20 | 20 | StreamsSequenceStream, stringToPDFString, stringToBytes, Util, XRef,
|
21 | 21 | MissingDataException, Promise, Annotation, ObjectLoader, OperatorList
|
@@ -301,10 +301,14 @@ var PDFDocument = (function PDFDocumentClosure() {
|
301 | 301 | function find(stream, needle, limit, backwards) {
|
302 | 302 | var pos = stream.pos;
|
303 | 303 | var end = stream.end;
|
| 304 | + var strBuf = []; |
304 | 305 | if (pos + limit > end) {
|
305 | 306 | limit = end - pos;
|
306 | 307 | }
|
307 |
| - var str = bytesToString(stream.getBytes(limit)); |
| 308 | + for (var n = 0; n < limit; ++n) { |
| 309 | + strBuf.push(String.fromCharCode(stream.getByte())); |
| 310 | + } |
| 311 | + var str = strBuf.join(''); |
308 | 312 | stream.pos = pos;
|
309 | 313 | var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
|
310 | 314 | if (index == -1) {
|
|
0 commit comments