Skip to content

Commit

Permalink
Merge pull request #48 from aureleoules/2023-01-custom-download-filename
Browse files Browse the repository at this point in the history
Customize download filename
  • Loading branch information
vinodnimbalkar authored Jan 10, 2023
2 parents da115aa + 9c38f9e commit 9dfea4e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/PdfViewer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
]; //array
export let showBorder = true; //boolean
export let totalPage = 0;
export let downloadFileName = '';
pdfjs.GlobalWorkerOptions.workerSrc = pdfjsWorker;
Expand Down Expand Up @@ -211,7 +212,7 @@
};
//Download pdf function
const downloadPdf = (fileURL) => {
let fileName = fileURL.substring(fileURL.lastIndexOf("/") + 1);
let fileName = downloadFileName || fileURL.substring(fileURL.lastIndexOf("/") + 1);
FileSaver.saveAs(fileURL, fileName);
};
//prevent memory leak
Expand Down

0 comments on commit 9dfea4e

Please sign in to comment.