extensions/pdfViewer/pdf/build/pdf.worker.js
function PDFDocument_checkHeader() {
      var stream = this.stream;
      stream.reset();
      if (find(stream, '%PDF-', 1024)) {
        // Found the header, trim off any garbage before it.
        stream.moveStart();
        // Reading file format version
        var MAX_VERSION_LENGTH = 12;
        var version = '', ch;
        while ((ch = stream.getByte()) > 0x20) { // SPACE
          if (version.length >= MAX_VERSION_LENGTH) {
            break;
          }
          version += String.fromCharCode(ch);
        }
        if (!this.pdfFormatVersion) {
          // removing "%PDF-"-prefix
          this.pdfFormatVersion = version.substring(5);
        }
        return;
      }
      // May not be a PDF file, continue anyway.
    }
function PDFDocument_checkHeader() {
      var stream = this.stream;
      stream.reset();
      if (find(stream, '%PDF-', 1024)) {
        // Found the header, trim off any garbage before it.
        stream.moveStart();
        // Reading file format version
        var MAX_VERSION_LENGTH = 12;
        var version = '', ch;
        while ((ch = stream.getByte()) > 0x20) { // SPACE
          if (version.length >= MAX_VERSION_LENGTH) {
            break;
          }
          version += String.fromCharCode(ch);
        }
        if (!this.pdfFormatVersion) {
          // removing "%PDF-"-prefix
          this.pdfFormatVersion = version.substring(5);
        }
        return;
      }
      // May not be a PDF file, continue anyway.
    }
function PDFDocument_checkHeader ( ) { var stream = this . stream ; stream . reset ( ) ; if ( find ( stream , '%PDF-' , 1024 ) ) { // Found the header, trim off any garbage before it. stream . moveStart ( ) ; // Reading file format version var MAX_VERSION_LENGTH = 12 ; var version = '' , ch ; while ( ( ch = stream . getByte ( ) ) > 0x20 ) { // SPACE if ( version . length >= MAX_VERSION_LENGTH ) { break ; } version += String . fromCharCode ( ch ) ; } if ( ! this . pdfFormatVersion ) { // removing "%PDF-"-prefix this . pdfFormatVersion = version . substring ( 5 ) ; } return ; } // May not be a PDF file, continue anyway. }
Find the header, remove leading garbage and setup the stream starting from the header.
Find the header remove leading garbage and setup the stream starting from the header .