fix image scaling in pdf.js

This commit is contained in:
j 2013-02-12 16:22:47 +05:30
parent be5fd4d82f
commit 62f4de2a5e

View file

@ -16,8 +16,8 @@
*/
var PDFJS = {};
PDFJS.version = '0.7.226';
PDFJS.build = 'c40c594';
PDFJS.version = '0.7.227';
PDFJS.build = 'c33b920';
(function pdfjsWrapper() {
// Use strict in our context only - users might not want it
@ -72,7 +72,11 @@ function getPdf(arg, callback) {
var params = arg;
if (typeof arg === 'string')
params = { url: arg };
//#if !B2G
var xhr = new XMLHttpRequest();
//#else
//var xhr = new XMLHttpRequest({mozSystem: true});
//#endif
xhr.open('GET', params.url);
var headers = params.headers;
@ -3287,15 +3291,13 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
0, -h, w, h);
if (this.imageLayer) {
var currentTransform = ctx.mozCurrentTransformInverse;
var widthScale = Math.max(Math.abs(currentTransform[0]), 1);
var heightScale = Math.max(Math.abs(currentTransform[3]), 1);
var position = this.getCanvasPosition(0, 0);
this.imageLayer.appendImage({
objId: objId,
left: position[0],
top: position[1],
width: w / widthScale,
height: h / heightScale
width: w / currentTransform[0],
height: h / currentTransform[3]
});
}
this.restore();
@ -3403,8 +3405,8 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
imgData: imgData,
left: position[0],
top: position[1],
width: width / widthScale,
height: height / heightScale
width: width / currentTransform[0],
height: height / currentTransform[3]
});
}
this.restore();
@ -16010,6 +16012,7 @@ function mapPrivateUseChars(code) {
}
var FontLoader = {
//#if !(MOZCENTRAL)
loadingContext: {
requests: [],
nextRequestId: 0
@ -16206,6 +16209,22 @@ var FontLoader = {
document.body.appendChild(frame);
/** Hack end */
}
//#else
//bind: function fontLoaderBind(fonts, callback) {
// assert(!isWorker, 'bind() shall be called from main thread');
//
// for (var i = 0, ii = fonts.length; i < ii; i++) {
// var font = fonts[i];
// if (font.attached)
// continue;
//
// font.attached = true;
// font.bindDOM()
// }
//
// setTimeout(callback);
//}
//#endif
};
var UnicodeRanges = [
@ -38066,4 +38085,3 @@ var JpegImage = (function jpegImage() {
}).call((typeof window === 'undefined') ? this : window);