diff --git a/README.md b/README.md
index f4073c1..00c8a73 100644
--- a/README.md
+++ b/README.md
@@ -103,6 +103,20 @@ To hide loading spinner
{{< embed-pdf url="./path/to/pdf/file/example.pdf" hideLoader="true" >}}
```
+To hide the download button
+```
+{{< embed-pdf url="./path/to/pdf/file/example.pdf" download="false" >}}
+```
+
+To manually set the width of the preview
+```
+{{< embed-pdf url="./path/to/pdf/file/example.pdf" width="50%" >}}
+```
+or
+```
+{{< embed-pdf url="./path/to/pdf/file/example.pdf" width="200px" >}}
+```
+
### Parameters
- **url (required)** : The relative location of the file.
diff --git a/layouts/shortcodes/embed-pdf.html b/layouts/shortcodes/embed-pdf.html
index 1c2ecd6..3536f82 100644
--- a/layouts/shortcodes/embed-pdf.html
+++ b/layouts/shortcodes/embed-pdf.html
@@ -1,9 +1,9 @@
{{- if not ($.Page.Scratch.Get "embed-pdf-count") -}}
-
+
+
{{- end -}}
{{- $.Page.Scratch.Add "embed-pdf-count" 1 -}}
-
+
+ {{ if not (eq (.Get "download") "false") }}
+ {{ end }}
@@ -141,7 +130,6 @@
paginator = document.getElementById("pdf-paginator-{{ substr (.Get "url" | md5) 0 8 }}"),
loadingWrapper = document.getElementById('pdf-loadingWrapper-{{ substr (.Get "url" | md5) 0 8 }}');
-
// Attempt to show paginator and loader if enabled
showPaginator();
showLoader();
@@ -194,21 +182,24 @@
* If we haven't disabled the loader, show loader and hide canvas
*/
function showLoader() {
- if(hideLoader) return
+ if(hideLoader) return;
loadingWrapper.style.display = 'flex';
canvas.style.display = 'none';
}
/**
- * If we haven't disabled the paginator, show paginator
+ * Controls paginator display based on hidePaginator value.
*/
function showPaginator() {
- if(hidePaginator) return
- paginator.style.display = 'block';
+ if(hidePaginator) {
+ paginator.style.display = 'none';
+ } else {
+ paginator.style.display = 'block';
+ }
}
/**
- * If another page rendering in progress, waits until the rendering is
+ * If another page rendering is in progress, waits until the rendering is
* finished. Otherwise, executes rendering immediately.
*/
function queueRenderPage(num) {
@@ -253,7 +244,7 @@
// If the user passed in a number that is out of range, render the last page.
if(pageNum > numPages) {
- pageNum = numPages
+ pageNum = numPages;
}
// Initial/first page rendering