mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Expose the optional UserUnit entry as a page property
This commit is contained in:
parent
8a1ed8ab1f
commit
f76cd2ce43
4 changed files with 25 additions and 3 deletions
|
@ -42,6 +42,7 @@ var error = sharedUtil.error;
|
|||
var info = sharedUtil.info;
|
||||
var isArray = sharedUtil.isArray;
|
||||
var isArrayBuffer = sharedUtil.isArrayBuffer;
|
||||
var isNum = sharedUtil.isNum;
|
||||
var isString = sharedUtil.isString;
|
||||
var shadow = sharedUtil.shadow;
|
||||
var stringToBytes = sharedUtil.stringToBytes;
|
||||
|
@ -67,6 +68,7 @@ var AnnotationFactory = coreAnnotation.AnnotationFactory;
|
|||
|
||||
var Page = (function PageClosure() {
|
||||
|
||||
var DEFAULT_USER_UNIT = 1.0;
|
||||
var LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
|
||||
|
||||
function Page(pdfManager, xref, pageIndex, pageDict, ref, fontCache) {
|
||||
|
@ -138,6 +140,14 @@ var Page = (function PageClosure() {
|
|||
return shadow(this, 'mediaBox', obj);
|
||||
},
|
||||
|
||||
get userUnit() {
|
||||
var obj = this.getPageProp('UserUnit');
|
||||
if (!isNum(obj) || obj <= 0) {
|
||||
obj = DEFAULT_USER_UNIT;
|
||||
}
|
||||
return shadow(this, 'userUnit', obj);
|
||||
},
|
||||
|
||||
get view() {
|
||||
var mediaBox = this.mediaBox;
|
||||
var cropBox = this.getInheritedPageProp('CropBox');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue