Browse Source

Merge pull request #3454 from Rob--W/configurable-images-directory

Configurable IMAGE_DIR for annotations to get svg images to show up in Chromium extension
Yury Delendik 12 years ago
parent
commit
940415b32c
  1. 2
      extensions/chrome/insertviewer.js
  2. 3
      src/annotation.js
  3. 1
      web/viewer.js

2
extensions/chrome/insertviewer.js

@ -108,9 +108,9 @@ function renderPDF(url) { @@ -108,9 +108,9 @@ function renderPDF(url) {
var script = document.createElement('script');
script.textContent =
'(function(args) {' +
' PDFJS.imageResourcesPath = args.BASE_URL + PDFJS.imageResourcesPath;' +
' PDFJS.workerSrc = args.BASE_URL + PDFJS.workerSrc;' +
' window.DEFAULT_URL = args.pdf_url;' +
' window.IMAGE_DIR = args.BASE_URL + window.IMAGE_DIR;' +
'})(' + JSON.stringify(args) + ');';
document.head.appendChild(script);

3
src/annotation.js

@ -552,7 +552,6 @@ var TextAnnotation = (function TextAnnotationClosure() { @@ -552,7 +552,6 @@ var TextAnnotation = (function TextAnnotationClosure() {
}
var ANNOT_MIN_SIZE = 10;
var IMAGE_DIR = './images/';
Util.inherit(TextAnnotation, Annotation, {
@ -593,7 +592,7 @@ var TextAnnotation = (function TextAnnotationClosure() { @@ -593,7 +592,7 @@ var TextAnnotation = (function TextAnnotationClosure() {
image.style.width = container.style.width;
image.style.height = container.style.height;
var iconName = item.name;
image.src = IMAGE_DIR + 'annotation-' +
image.src = PDFJS.imageResourcesPath + 'annotation-' +
iconName.toLowerCase() + '.svg';
image.alt = '[{{type}} Annotation]';
image.dataset.l10nId = 'text_annotation_type';

1
web/viewer.js

@ -46,6 +46,7 @@ var FindStates = { @@ -46,6 +46,7 @@ var FindStates = {
FIND_PENDING: 3
};
PDFJS.imageResourcesPath = './images/';
//#if (FIREFOX || MOZCENTRAL || B2G || GENERIC || CHROME)
//PDFJS.workerSrc = '../build/pdf.js';
//#endif

Loading…
Cancel
Save