mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-21 15:48:06 +02:00
Implement support for FileAttachment annotations
This commit is contained in:
parent
e9a1a47d28
commit
6a33dfd13a
10 changed files with 127 additions and 9 deletions
|
@ -72,6 +72,7 @@
|
|||
.annotationLayer .highlightAnnotation,
|
||||
.annotationLayer .underlineAnnotation,
|
||||
.annotationLayer .squigglyAnnotation,
|
||||
.annotationLayer .strikeoutAnnotation {
|
||||
.annotationLayer .strikeoutAnnotation,
|
||||
.annotationLayer .fileAttachmentAnnotation {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
* @property {HTMLDivElement} pageDiv
|
||||
* @property {PDFPage} pdfPage
|
||||
* @property {IPDFLinkService} linkService
|
||||
* @property {DownloadManager} downloadManager
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -35,6 +36,7 @@ var AnnotationLayerBuilder = (function AnnotationLayerBuilderClosure() {
|
|||
this.pageDiv = options.pageDiv;
|
||||
this.pdfPage = options.pdfPage;
|
||||
this.linkService = options.linkService;
|
||||
this.downloadManager = options.downloadManager;
|
||||
|
||||
this.div = null;
|
||||
}
|
||||
|
@ -59,7 +61,8 @@ var AnnotationLayerBuilder = (function AnnotationLayerBuilderClosure() {
|
|||
div: self.div,
|
||||
annotations: annotations,
|
||||
page: self.pdfPage,
|
||||
linkService: self.linkService
|
||||
linkService: self.linkService,
|
||||
downloadManager: self.downloadManager
|
||||
};
|
||||
|
||||
if (self.div) {
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
/* globals RenderingStates, PDFJS, DEFAULT_SCALE, CSS_UNITS, getOutputScale,
|
||||
TextLayerBuilder, AnnotationLayerBuilder, Promise,
|
||||
approximateFraction, roundToDivide */
|
||||
TextLayerBuilder, Promise, approximateFraction, roundToDivide */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
/*jshint globalstrict: false */
|
||||
/* globals PDFJS, PDFViewer, PDFPageView, TextLayerBuilder, PDFLinkService,
|
||||
DefaultTextLayerFactory, AnnotationLayerBuilder, PDFHistory,
|
||||
DefaultAnnotationLayerFactory, getFileName, ProgressBar */
|
||||
DefaultAnnotationLayerFactory, getFileName, DownloadManager,
|
||||
ProgressBar */
|
||||
|
||||
// Initializing PDFJS global object (if still undefined)
|
||||
if (typeof PDFJS === 'undefined') {
|
||||
|
@ -29,6 +30,7 @@ if (typeof PDFJS === 'undefined') {
|
|||
//#include pdf_link_service.js
|
||||
//#include pdf_viewer.js
|
||||
//#include pdf_history.js
|
||||
//#include download_manager.js
|
||||
|
||||
PDFJS.PDFViewer = PDFViewer;
|
||||
PDFJS.PDFPageView = PDFPageView;
|
||||
|
@ -40,5 +42,6 @@ if (typeof PDFJS === 'undefined') {
|
|||
PDFJS.PDFHistory = PDFHistory;
|
||||
|
||||
PDFJS.getFileName = getFileName;
|
||||
PDFJS.DownloadManager = DownloadManager;
|
||||
PDFJS.ProgressBar = ProgressBar;
|
||||
}).call((typeof window === 'undefined') ? this : window);
|
||||
|
|
|
@ -40,6 +40,8 @@ var DEFAULT_CACHE_SIZE = 10;
|
|||
* @property {HTMLDivElement} container - The container for the viewer element.
|
||||
* @property {HTMLDivElement} viewer - (optional) The viewer element.
|
||||
* @property {IPDFLinkService} linkService - The navigation/linking service.
|
||||
* @property {DownloadManager} downloadManager - (optional) The download
|
||||
* manager component.
|
||||
* @property {PDFRenderingQueue} renderingQueue - (optional) The rendering
|
||||
* queue object.
|
||||
* @property {boolean} removePageBorders - (optional) Removes the border shadow
|
||||
|
@ -92,6 +94,7 @@ var PDFViewer = (function pdfViewer() {
|
|||
this.container = options.container;
|
||||
this.viewer = options.viewer || options.container.firstElementChild;
|
||||
this.linkService = options.linkService || new SimpleLinkService();
|
||||
this.downloadManager = options.downloadManager || null;
|
||||
this.removePageBorders = options.removePageBorders || false;
|
||||
|
||||
this.defaultRenderingQueue = !options.renderingQueue;
|
||||
|
@ -757,7 +760,8 @@ var PDFViewer = (function pdfViewer() {
|
|||
return new AnnotationLayerBuilder({
|
||||
pageDiv: pageDiv,
|
||||
pdfPage: pdfPage,
|
||||
linkService: this.linkService
|
||||
linkService: this.linkService,
|
||||
downloadManager: this.downloadManager
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -134,7 +134,8 @@ var PDFViewerApplication = {
|
|||
container: container,
|
||||
viewer: viewer,
|
||||
renderingQueue: pdfRenderingQueue,
|
||||
linkService: pdfLinkService
|
||||
linkService: pdfLinkService,
|
||||
downloadManager: new DownloadManager()
|
||||
});
|
||||
pdfRenderingQueue.setViewer(this.pdfViewer);
|
||||
pdfLinkService.setViewer(this.pdfViewer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue