From 5aa7365c13456c2fef83fc8d151624adfc536982 Mon Sep 17 00:00:00 2001 From: Pdf Bot Date: Thu, 8 Sep 2016 09:39:23 +0100 Subject: [PATCH] PDF.js version 1.5.437 - See mozilla/pdf.js@ca61ccc533ab9e0d693d32cec2c27ca9e7aabdd7 --- bower.json | 2 +- build/pdf.combined.js | 52 ++++++++++++++++++++++++++++++------------- build/pdf.js | 52 ++++++++++++++++++++++++++++++------------- build/pdf.worker.js | 4 ++-- package.json | 2 +- web/pdf_viewer.css | 20 +++++++++++++++++ web/pdf_viewer.js | 3 ++- 7 files changed, 100 insertions(+), 35 deletions(-) diff --git a/bower.json b/bower.json index 8cd534eb2..a968dfffc 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.5.434", + "version": "1.5.437", "main": [ "build/pdf.js", "build/pdf.worker.js" diff --git a/build/pdf.combined.js b/build/pdf.combined.js index 4b5f7f958..077a58486 100644 --- a/build/pdf.combined.js +++ b/build/pdf.combined.js @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfCombined = {})); // Use strict in our context only - users might not want it 'use strict'; -var pdfjsVersion = '1.5.434'; -var pdfjsBuild = '8dbb5a7'; +var pdfjsVersion = '1.5.437'; +var pdfjsBuild = 'ca61ccc'; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? @@ -24124,6 +24124,8 @@ var getDefaultSetting = displayDOMUtils.getDefaultSetting; * @property {PageViewport} viewport * @property {IPDFLinkService} linkService * @property {DownloadManager} downloadManager + * @property {string} imageResourcesPath + * @property {boolean} renderInteractiveForms */ /** @@ -24194,6 +24196,7 @@ var AnnotationElement = (function AnnotationElementClosure() { this.linkService = parameters.linkService; this.downloadManager = parameters.downloadManager; this.imageResourcesPath = parameters.imageResourcesPath; + this.renderInteractiveForms = parameters.renderInteractiveForms; if (isRenderable) { this.container = this._createContainer(); @@ -24516,18 +24519,28 @@ var TextWidgetAnnotationElement = ( * @returns {HTMLSectionElement} */ render: function TextWidgetAnnotationElement_render() { - var content = document.createElement('div'); - content.textContent = this.data.fieldValue; - var textAlignment = this.data.textAlignment; - content.style.textAlign = ['left', 'center', 'right'][textAlignment]; - content.style.verticalAlign = 'middle'; - content.style.display = 'table-cell'; - - var font = (this.data.fontRefName ? - this.page.commonObjs.getData(this.data.fontRefName) : null); - this._setTextStyle(content, font); - - this.container.appendChild(content); + this.container.className = 'textWidgetAnnotation'; + + if (this.renderInteractiveForms) { + var input = document.createElement('input'); + input.type = 'text'; + input.value = this.data.fieldValue; + + this.container.appendChild(input); + } else { + var content = document.createElement('div'); + content.textContent = this.data.fieldValue; + var textAlignment = this.data.textAlignment; + content.style.textAlign = ['left', 'center', 'right'][textAlignment]; + content.style.verticalAlign = 'middle'; + content.style.display = 'table-cell'; + + var font = (this.data.fontRefName ? + this.page.commonObjs.getData(this.data.fontRefName) : null); + this._setTextStyle(content, font); + + this.container.appendChild(content); + } return this.container; }, @@ -24954,6 +24967,7 @@ var FileAttachmentAnnotationElement = ( * @property {PDFPage} page * @property {IPDFLinkService} linkService * @property {string} imageResourcesPath + * @property {boolean} renderInteractiveForms */ /** @@ -24986,7 +25000,8 @@ var AnnotationLayer = (function AnnotationLayerClosure() { linkService: parameters.linkService, downloadManager: parameters.downloadManager, imageResourcesPath: parameters.imageResourcesPath || - getDefaultSetting('imageResourcesPath') + getDefaultSetting('imageResourcesPath'), + renderInteractiveForms: parameters.renderInteractiveForms || false, }; var element = annotationElementFactory.create(properties); if (element.isRenderable) { @@ -42483,6 +42498,13 @@ exports.ColorSpace = ColorSpace; PDFJS.isEvalSupported = (PDFJS.isEvalSupported === undefined ? true : PDFJS.isEvalSupported); + /** + * Renders interactive form elements. + * @var {boolean} + */ + PDFJS.renderInteractiveForms = (PDFJS.renderInteractiveForms === undefined ? + false : PDFJS.renderInteractiveForms); + var savedOpenExternalLinksInNewWindow = PDFJS.openExternalLinksInNewWindow; delete PDFJS.openExternalLinksInNewWindow; Object.defineProperty(PDFJS, 'openExternalLinksInNewWindow', { diff --git a/build/pdf.js b/build/pdf.js index 6937013e4..0338bcad0 100644 --- a/build/pdf.js +++ b/build/pdf.js @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {})); // Use strict in our context only - users might not want it 'use strict'; -var pdfjsVersion = '1.5.434'; -var pdfjsBuild = '8dbb5a7'; +var pdfjsVersion = '1.5.437'; +var pdfjsBuild = 'ca61ccc'; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? @@ -4318,6 +4318,8 @@ var getDefaultSetting = displayDOMUtils.getDefaultSetting; * @property {PageViewport} viewport * @property {IPDFLinkService} linkService * @property {DownloadManager} downloadManager + * @property {string} imageResourcesPath + * @property {boolean} renderInteractiveForms */ /** @@ -4388,6 +4390,7 @@ var AnnotationElement = (function AnnotationElementClosure() { this.linkService = parameters.linkService; this.downloadManager = parameters.downloadManager; this.imageResourcesPath = parameters.imageResourcesPath; + this.renderInteractiveForms = parameters.renderInteractiveForms; if (isRenderable) { this.container = this._createContainer(); @@ -4710,18 +4713,28 @@ var TextWidgetAnnotationElement = ( * @returns {HTMLSectionElement} */ render: function TextWidgetAnnotationElement_render() { - var content = document.createElement('div'); - content.textContent = this.data.fieldValue; - var textAlignment = this.data.textAlignment; - content.style.textAlign = ['left', 'center', 'right'][textAlignment]; - content.style.verticalAlign = 'middle'; - content.style.display = 'table-cell'; - - var font = (this.data.fontRefName ? - this.page.commonObjs.getData(this.data.fontRefName) : null); - this._setTextStyle(content, font); - - this.container.appendChild(content); + this.container.className = 'textWidgetAnnotation'; + + if (this.renderInteractiveForms) { + var input = document.createElement('input'); + input.type = 'text'; + input.value = this.data.fieldValue; + + this.container.appendChild(input); + } else { + var content = document.createElement('div'); + content.textContent = this.data.fieldValue; + var textAlignment = this.data.textAlignment; + content.style.textAlign = ['left', 'center', 'right'][textAlignment]; + content.style.verticalAlign = 'middle'; + content.style.display = 'table-cell'; + + var font = (this.data.fontRefName ? + this.page.commonObjs.getData(this.data.fontRefName) : null); + this._setTextStyle(content, font); + + this.container.appendChild(content); + } return this.container; }, @@ -5148,6 +5161,7 @@ var FileAttachmentAnnotationElement = ( * @property {PDFPage} page * @property {IPDFLinkService} linkService * @property {string} imageResourcesPath + * @property {boolean} renderInteractiveForms */ /** @@ -5180,7 +5194,8 @@ var AnnotationLayer = (function AnnotationLayerClosure() { linkService: parameters.linkService, downloadManager: parameters.downloadManager, imageResourcesPath: parameters.imageResourcesPath || - getDefaultSetting('imageResourcesPath') + getDefaultSetting('imageResourcesPath'), + renderInteractiveForms: parameters.renderInteractiveForms || false, }; var element = annotationElementFactory.create(properties); if (element.isRenderable) { @@ -11249,6 +11264,13 @@ exports._UnsupportedManager = _UnsupportedManager; PDFJS.isEvalSupported = (PDFJS.isEvalSupported === undefined ? true : PDFJS.isEvalSupported); + /** + * Renders interactive form elements. + * @var {boolean} + */ + PDFJS.renderInteractiveForms = (PDFJS.renderInteractiveForms === undefined ? + false : PDFJS.renderInteractiveForms); + var savedOpenExternalLinksInNewWindow = PDFJS.openExternalLinksInNewWindow; delete PDFJS.openExternalLinksInNewWindow; Object.defineProperty(PDFJS, 'openExternalLinksInNewWindow', { diff --git a/build/pdf.worker.js b/build/pdf.worker.js index 0327b7954..cd2791bd1 100644 --- a/build/pdf.worker.js +++ b/build/pdf.worker.js @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {})); // Use strict in our context only - users might not want it 'use strict'; -var pdfjsVersion = '1.5.434'; -var pdfjsBuild = '8dbb5a7'; +var pdfjsVersion = '1.5.437'; +var pdfjsBuild = 'ca61ccc'; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? diff --git a/package.json b/package.json index 51612e075..8fc071fcc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.5.434", + "version": "1.5.437", "main": "build/pdf.js", "description": "Generic build of Mozilla's PDF.js library.", "keywords": [ diff --git a/web/pdf_viewer.css b/web/pdf_viewer.css index ce1c88064..e4689a74b 100644 --- a/web/pdf_viewer.css +++ b/web/pdf_viewer.css @@ -110,6 +110,26 @@ cursor: pointer; } +.annotationLayer .textWidgetAnnotation input { + background-color: rgba(0, 54, 255, 0.13); + border: 1px solid transparent; + box-sizing: border-box; + font-size: 9px; + height: 100%; + padding: 0 3px; + vertical-align: top; + width: 100%; +} + +.annotationLayer .textWidgetAnnotation input:hover { + border: 1px solid #000; +} + +.annotationLayer .textWidgetAnnotation input:focus { + background: none; + border: 1px solid transparent; +} + .annotationLayer .popupWrapper { position: absolute; width: 20em; diff --git a/web/pdf_viewer.js b/web/pdf_viewer.js index f433805f4..179691ab3 100644 --- a/web/pdf_viewer.js +++ b/web/pdf_viewer.js @@ -3259,7 +3259,8 @@ var AnnotationLayerBuilder = (function AnnotationLayerBuilderClosure() { annotations: annotations, page: self.pdfPage, linkService: self.linkService, - downloadManager: self.downloadManager + downloadManager: self.downloadManager, + renderInteractiveForms: pdfjsLib.PDFJS.renderInteractiveForms, }; if (self.div) {