fix image scaling in pdf.js
This commit is contained in:
parent
be5fd4d82f
commit
62f4de2a5e
1 changed files with 27 additions and 9 deletions
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var PDFJS = {};
|
var PDFJS = {};
|
||||||
PDFJS.version = '0.7.226';
|
PDFJS.version = '0.7.227';
|
||||||
PDFJS.build = 'c40c594';
|
PDFJS.build = 'c33b920';
|
||||||
|
|
||||||
(function pdfjsWrapper() {
|
(function pdfjsWrapper() {
|
||||||
// Use strict in our context only - users might not want it
|
// Use strict in our context only - users might not want it
|
||||||
|
@ -72,7 +72,11 @@ function getPdf(arg, callback) {
|
||||||
var params = arg;
|
var params = arg;
|
||||||
if (typeof arg === 'string')
|
if (typeof arg === 'string')
|
||||||
params = { url: arg };
|
params = { url: arg };
|
||||||
|
//#if !B2G
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
|
//#else
|
||||||
|
//var xhr = new XMLHttpRequest({mozSystem: true});
|
||||||
|
//#endif
|
||||||
xhr.open('GET', params.url);
|
xhr.open('GET', params.url);
|
||||||
|
|
||||||
var headers = params.headers;
|
var headers = params.headers;
|
||||||
|
@ -3287,15 +3291,13 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
||||||
0, -h, w, h);
|
0, -h, w, h);
|
||||||
if (this.imageLayer) {
|
if (this.imageLayer) {
|
||||||
var currentTransform = ctx.mozCurrentTransformInverse;
|
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);
|
var position = this.getCanvasPosition(0, 0);
|
||||||
this.imageLayer.appendImage({
|
this.imageLayer.appendImage({
|
||||||
objId: objId,
|
objId: objId,
|
||||||
left: position[0],
|
left: position[0],
|
||||||
top: position[1],
|
top: position[1],
|
||||||
width: w / widthScale,
|
width: w / currentTransform[0],
|
||||||
height: h / heightScale
|
height: h / currentTransform[3]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.restore();
|
this.restore();
|
||||||
|
@ -3403,8 +3405,8 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
||||||
imgData: imgData,
|
imgData: imgData,
|
||||||
left: position[0],
|
left: position[0],
|
||||||
top: position[1],
|
top: position[1],
|
||||||
width: width / widthScale,
|
width: width / currentTransform[0],
|
||||||
height: height / heightScale
|
height: height / currentTransform[3]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.restore();
|
this.restore();
|
||||||
|
@ -16010,6 +16012,7 @@ function mapPrivateUseChars(code) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var FontLoader = {
|
var FontLoader = {
|
||||||
|
//#if !(MOZCENTRAL)
|
||||||
loadingContext: {
|
loadingContext: {
|
||||||
requests: [],
|
requests: [],
|
||||||
nextRequestId: 0
|
nextRequestId: 0
|
||||||
|
@ -16206,6 +16209,22 @@ var FontLoader = {
|
||||||
document.body.appendChild(frame);
|
document.body.appendChild(frame);
|
||||||
/** Hack end */
|
/** 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 = [
|
var UnicodeRanges = [
|
||||||
|
@ -38066,4 +38085,3 @@ var JpegImage = (function jpegImage() {
|
||||||
|
|
||||||
}).call((typeof window === 'undefined') ? this : window);
|
}).call((typeof window === 'undefined') ? this : window);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue