Skip to content

Commit

Permalink
Load PDF file from url if buffer isn't provider
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtcode committed Sep 15, 2023
1 parent 8e1f8b2 commit 81863a1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/pdf/pdf-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ class PDFView {
this._iframeWindow.onAttachPage = this._attachPage.bind(this);
this._iframeWindow.onDetachPage = this._detachPage.bind(this);
this._init();
this._iframeWindow.PDFViewerApplication.open({ data: options.data.buf, password: this._password });
if (options.data.buf) {
this._iframeWindow.PDFViewerApplication.open({ data: options.data.buf, password: this._password });
}
else {
this._iframeWindow.PDFViewerApplication.open({ url: options.data.baseURI, password: this._password });
}
window.PDFViewerApplication = this._iframeWindow.PDFViewerApplication;
window.if = this._iframeWindow;
this._resolveInitializedPromise();
Expand Down

0 comments on commit 81863a1

Please sign in to comment.