Skip to content

Commit

Permalink
🎨 Set default url for webViewerPostMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraHuang22 committed Jul 16, 2024
1 parent 61162d6 commit a2e7deb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3274,19 +3274,21 @@ function webViewerPostMessage(evt) {
} else {
({ action, data } = evt.data);
}
const filename = data.name ? `${data.name}.pdf` : "liker-land_ebook.pdf";
const url = `https://liker.land/${filename}`;
switch (action) {
case "openBase64File":
PDFViewerApplication.open({
data: atob(data.data),
originalUrl: data.name,
filename: data.name ? `${data.name}.pdf` : "liker-land_ebook.pdf",
url,
filename,
});
break;
case "openArrayBufferFile":
PDFViewerApplication.open({
data: new Uint8Array(data.data),
originalUrl: data.name,
filename: data.name ? `${data.name}.pdf` : "liker-land_ebook.pdf",
url,
filename,
});
break;
}
Expand Down

0 comments on commit a2e7deb

Please sign in to comment.