diff --git a/demo/index.html b/demo/index.html
index 50b4530..d1328ba 100644
--- a/demo/index.html
+++ b/demo/index.html
@@ -1,5 +1,5 @@
-
+
Angular PDF.js demo
@@ -31,11 +31,16 @@
+
+
-
+
diff --git a/dist/angular-pdfjs-viewer.js b/dist/angular-pdfjs-viewer.js
index 390fa55..3d27de6 100644
--- a/dist/angular-pdfjs-viewer.js
+++ b/dist/angular-pdfjs-viewer.js
@@ -373,14 +373,15 @@
'\n' +
' \n' +
' \n' +
-' ',
+' \n',
restrict: 'E',
scope: {
onInit: '&',
onPageLoad: '&',
scale: '=?',
src: '@?',
- data: '=?'
+ data: '=?',
+ fileName: '@?'
},
link: function ($scope, $element, $attrs) {
$element.children().wrap('');
@@ -466,8 +467,16 @@
if (!src && !data) {
return;
}
-
- window.PDFViewerApplication.open(src || data);
+ if (src) {
+ window.PDFViewerApplication.open(src);
+ } else if (data) {
+ if ($scope.fileName) {
+ // Passing fileName through url parameter
+ window.PDFViewerApplication.open(data, {url: $scope.fileName});
+ } else {
+ window.PDFViewerApplication.open(data);
+ }
+ }
});
// watch other attributes
@@ -496,8 +505,14 @@
if ($attrs.height) {
document.getElementById('outerContainer').style.height = $attrs.height;
}
+
+ if ($attrs.sidebar === 'false') {
+ document.getElementById('sidebarToggle').setAttribute('hidden', 'true');
+ }
});
}
};
}]);
+
+ //
}();
diff --git a/src/angular-pdfjs-viewer.js b/src/angular-pdfjs-viewer.js
index 2060533..993491c 100644
--- a/src/angular-pdfjs-viewer.js
+++ b/src/angular-pdfjs-viewer.js
@@ -77,7 +77,8 @@
onPageLoad: '&',
scale: '=?',
src: '@?',
- data: '=?'
+ data: '=?',
+ fileName: '@?'
},
link: function ($scope, $element, $attrs) {
$element.children().wrap('');
@@ -163,8 +164,16 @@
if (!src && !data) {
return;
}
-
- window.PDFViewerApplication.open(src || data);
+ if (src) {
+ window.PDFViewerApplication.open(src);
+ } else if (data) {
+ if ($scope.fileName) {
+ // Passing fileName through url parameter
+ window.PDFViewerApplication.open(data, {url: $scope.fileName});
+ } else {
+ window.PDFViewerApplication.open(data);
+ }
+ }
});
// watch other attributes
@@ -193,6 +202,10 @@
if ($attrs.height) {
document.getElementById('outerContainer').style.height = $attrs.height;
}
+
+ if ($attrs.sidebar === 'false') {
+ document.getElementById('sidebarToggle').setAttribute('hidden', 'true');
+ }
});
}
};