Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/octane/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 MB image not shown  

Quellcode-Bibliothek pdfjs.js   Sprache: JAVA

 
// Portions copyright 2012 Google, Inc.
// Portions copyright 2011 Mozilla Foundation. All rights reserved.

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

// The PDF-JS code in this file has been written by Mozilla.
// It is available in its latest version from:
//
//   https://github.com/mozilla/pdf.js


//////// Benchmark set-up. (c) by Google. ////////

var pdf_file = "test.pdf";
var canvas_logs = [];

var PdfJS = new BenchmarkSuite("PdfJS", [10124921], [
  new Benchmark("PdfJS"falsefalse, 24,
    runPdfJS, setupPdfJS, tearDownPdfJS, null, 4)
]);

function setupPdfJS() {
  // Check for Typed Arrays support, throw error if not.
  if (!(typeof Uint8Array != "undefined" &&
    typeof Float64Array != "undefined" &&
    typeof (new Uint8Array(0)).subarray != "undefined")) {
      throw "TypedArrayUnsupported";
    }

  PdfJS_window.__resources__[pdf_file] = buffer(PdfJS_window.atob(getPDF()));
}

function runPdfJS() {
  PDFJS.getDocument(pdf_file).then(function(pdf) {
    var canvas = PdfJS_window.document.getElementById('canvas');
    var context = canvas.getContext('2d');
    var renderContext = {canvasContext: context};
    canvas_logs.push(context.__log__);

    // Cycle through all pages.
    function renderPages(i, j) {
      if (i > j) return;
      context.clearRect(0, 0, canvas.width, canvas.height);
      pdf.getPage(i).then(function(page) {
        renderContext.viewport = page.getViewport(1);
        canvas.height = renderContext.viewport.height;
        canvas.width = renderContext.viewport.width;
        page.render(renderContext).then(renderPages.bind(null, i + 1, j));
      });
    }
    renderPages(1, pdf.numPages);
  });

  // Wait for everything to complete.
  PdfJS_window.flushTimeouts();
}

function tearDownPdfJS() {
  // Should produce 36788 939524096 for all runs.
  for (var i = 0; i < canvas_logs.length; ++i) {
    var log_length = canvas_logs[i].length;
    var log_hash = hash(canvas_logs[i].join(" "));
    var expected_length = 36788;
    var expected_hash = 939524096;
    if (log_length !== expected_length || log_hash !== expected_hash) {
      var message = "PdfJS produced incorrect output: " +
          "expected " + expected_length + " " + expected_hash + ", " +
          "got " + log_length + " " + log_hash;
      console.log(message + "\n");
      throw message;
    }
  }
  // Allow GC of global state.
  delete this.PDFJS;
  delete this.PdfJS_window;
}

function buffer(s) {
  var b = new ArrayBuffer(s.length);
  var a = new Uint8Array(b);
  for (var i = 0; i < s.length; ++i) a[i] = s.charCodeAt(i);
  return b;
}

function hash(s) {
  var up = Math.floor((s.length + 3) / 4);
  var h = 0;
  for (var i = 0; 4*i - 3 < s.length; i += 4) {
    for (var j = 0; j < 4 && i + j < s.length; ++j)
      h = (h + s.charCodeAt(i + j) << (8*j)) | 0;
  }
  return h;
}


///////// Mocks of relevant browser functionality. (c) by Google. ////////

// Every acces to window will be redirected to PdfJS_window.
var PdfJS_window = Object.create(this);

function PdfJS_windowInstall(name, x) {
  Object.defineProperty(PdfJS_window, name, {value: x});
}

PdfJS_windowInstall("setTimeout"function(cmd, delay) {
  PdfJS_window.__timeouts__.push(cmd);
});

PdfJS_windowInstall("flushTimeouts"function() {
  while (PdfJS_window.__timeouts__.length != 0) {
    var next = PdfJS_window.__timeouts__.pop();
    if (typeof next === "function")
      next({data: "{}"});
    else
      eval(next);
  }
});

PdfJS_windowInstall("window", PdfJS_window);

PdfJS_window.__timeouts__ = [];
PdfJS_window.__resources__ = {};


// Base64 encoding/decoding is based on code by Grant Galitz.
PdfJS_window.__to64__ = [
  "A""B""C""D""E""F""G""H""I""J""K""L""M",
  "N""O""P""Q""R""S""T""U""V""W""X""Y""Z",
  "a""b""c""d""e""f""g""h""i""j""k""l""m",
  "n""o""p""q""r""s""t""u""v""w""x""y""z",
  "0""1""2""3""4""5""6""7""8""9""+""/""="
];

PdfJS_windowInstall("btoa"function(data) {
  var result = "";
  if (data.length > 0) {
    var i = 0;
    while (i < data.length) {
      var b1 = data.charCodeAt(i++) & 0xff;
      var b2 = data.charCodeAt(i++ < data.length ? i-1 : 0) & 0xff;
      var b3 = data.charCodeAt(i++ < data.length ? i-1 : 0) & 0xff;
      result += PdfJS_window.__to64__[b1 >> 2];
      if (i === data.length + 2) {
        result += PdfJS_window.__to64__[(b1 & 0x3) << 4] + "==";
      } else {
        result += PdfJS_window.__to64__[((b1 & 0x3) << 4) | (b2 >> 4)];
        if (i === data.length + 1) {
          result += PdfJS_window.__to64__[(b2 & 0xF) << 2] + "=";
        } else {
          result += PdfJS_window.__to64__[((b2 & 0xF) << 2) | (b3 >> 6)] +
       PdfJS_window.__to64__[b3 & 0x3F];
        }
      }
    }
  }
  return result;
});

PdfJS_window.__from64__ =
  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

PdfJS_windowInstall("atob"function(data) {
  var result = "";
  var i = 0;
  while (i < data.length) {
    var x1 = PdfJS_window.__from64__.indexOf(data.charAt(i++));
    var x2 = PdfJS_window.__from64__.indexOf(data.charAt(i++));
    var x3 = PdfJS_window.__from64__.indexOf(data.charAt(i++));
    var x4 = PdfJS_window.__from64__.indexOf(data.charAt(i++));
    result += String.fromCharCode((x1 << 2) | (x2 >> 4));
    if (x3 != 0x40) {
       result += String.fromCharCode(((x2 & 0x0F) << 4) | (x3 >> 2));
       if (x4 != 0x40) {
         result += String.fromCharCode(((x3 & 0x03) << 6) | x4);
      }
    }
  }
  return result;
});


PdfJS_windowInstall("XMLHttpRequest"function() {
  this.open = function(type, url, some_bool) {
    this.url = url;
  }
  this.overrideMimeType = function() {}
  this.send = function() {
    this.response = PdfJS_window.__resources__[this.url];
    this.readyState = 4;
    this.status = 0;
    this.onreadystatechange();
  }
});

PdfJS_windowInstall("console"this.console ? this.console : {
  log: function(s) {
    // To verify that the test produces the right results,
    // uncomment this code.
    /*
    var re = new RegExp("%d", "g");
    var args = arguments;
    var i = 0;
    print(s.replace(re, function() { return args[++i] }));
    */

  }
});

PdfJS_windowInstall("location", {
  protocol: ""
});

PdfJS_windowInstall("Event"function() {
  this.initEvent = function(name) {
    this.name = name;
  }
});

PdfJS_windowInstall("Element"function(type) {
  this.__listeners__ = {};
  this.element_type = type;
  this.insertBefore = function() {};
  this.addEventListener = function(name, listener) {
    this.__listeners__[name] = listener;
  };
  this.removeEventListener = function(name) {
    delete this.__listeners__[name];
  };
  this.dispatchEvent = function(event) {
    this.__listeners__[event.name](event)
  };
  this.getElementsByTagName = function(name) {
    if (name === "head") {
      return [{appendChild: function() {}}]
    }
  };
  this.appendChild = function() {};
  this.setAttribute = function() {};
  this.sheet = {
    cssRules: [],
    insertRule: function() {}
  };
});

PdfJS_windowInstall("Context"function() {
  this.__log__ = [];
  this.save = function() {
    this.__log__.push("save","\n");
  }
  this.restore = function() {
    this.__log__.push("restore","\n");
  }
  this.transform = function(a,b,c,d,e,f) {
    this.__log__.push("transform",a,b,c,d,e,f,"\n");
  }
  this.translate = function(x,y) {
    this.__log__.push("translate",x,y,"\n");
  }
  this.scale = function(x,y) {
    this.__log__.push("scale",x,y,"\n");
  }
  this.rect = function(x,y,w,h) {
    this.__log__.push("rect",x,y,w,h,"\n");
  }
  this.clip = function() {
    this.__log__.push("clip","\n");
  }
  this.fill = function() {
    this.__log__.push("fill","\n");
  }
  this.stroke = function() {
    this.__log__.push("stroke","\n");
  }
  this.beginPath = function() {
    this.__log__.push("beginPath","\n");
  }
  this.closePath = function() {
    this.__log__.push("closePath","\n");
  }
  this.moveTo = function(x,y) {
    this.__log__.push("moveTo",x,y,"\n");
  }
  this.lineTo = function(x,y) {
    this.__log__.push("lineTo",x,y,"\n");
  }
  this.fillRect = function(x,y,w,h) {
    this.__log__.push("fillRect",x,y,w,h,"\n");
  }
  this.fillText = function(s,x,y,w) {
    this.__log__.push("fillText",s,x,y,"\n");
  }
  this.strokeText = function(s,x,y,w) {
    this.__log__.push("strokeText",s,x,y,"\n");
  }
  this.getImageData = function(x,y,w,h) {
    this.__log__.push("getImageData",x,y,w,h,"\n");
    return {data: []};
  }
  this.putImageData = function(data,x,y) {
    this.__log__.push("putImageData","{...}",x,y,"\n");
  }
  this.drawImage = function(image,x,y) {
    this.__log__.push("drawImage","",x,y,"\n");
  }
  this.getParameter = function(name) {
    this.__log__.push("getParameter",name,"\n");
    return null;
  }
  this.enable = function() {
    this.__log__.push("enable","\n");
  }
  this.disable = function() {
    this.__log__.push("disable","\n");
  }
  this.depthFunc = function(param) {
    this.__log__.push("depthFunc",param,"\n");
  }
  this.clearColor = function(r,g,b,a) {
    this.__log__.push("clearColor",r,g,b,a,"\n");
  }
  this.clear = function(m) {
    this.__log__.push("clear",m,"\n");
  }
  this.clearRect = function(x,y,w,h) {
    this.__log__.push("createRect",x,y,w,h,"\n");
  }
});

PdfJS_windowInstall("Canvas"function() {
  this.getContext = function() {
    return new PdfJS_window.Context();
  }
  this.width = 100;
  this.height = 100;
  this.style = { visibility: "visibile" };
});

PdfJS_windowInstall("document", {
  body : new PdfJS_window.Element("body"),
  documentElement : new PdfJS_window.Element("document"),
  createElement : function(element_type) {
    var element;
    if (element_type === "canvas") {
      element = new PdfJS_window.Canvas();
    } else {
      element = new PdfJS_window.Element(element_type);
    }
    element.parentNode = new PdfJS_window.Element("dummy_parent");
    return element;
  },
  getElementById : function(name) {
    if (name === "canvas") {
      return new PdfJS_window.Canvas();
    } else {
      return undefined;
    }
  },
  getElementsByTagName : function(element) {
    if (element === "script") {
      return new Array(new this.createElement(element));
    }
  },
  createEvent : function() { return new PdfJS_window.Event() }
});

PdfJS_window.window.addEventListener = function(name, listener) {
  PdfJS_window.setTimeout(listener)
}

PdfJS_windowInstall("Worker", undefined);


///////// The PDF we want to render, encoded in base64. ////////

function getPDF() {
--> --------------------

--> maximum size reached

--> --------------------

Messung V0.5
C=95 H=89 G=91

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.14Bemerkung:  (vorverarbeitet)  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.