Reputation: 83
We use the CDN server to store sources for the pdfjs's web and build folders and then setup ng2-pdfjs-viewer like this:
<ng2-pdfjs-viewer #externalPdfViewer
[hidden]="error()"
viewerId="DocumentPdfViewer"
[viewerFolder]="https://cdn.some.url/pdfjs"
(onDocumentLoad)="onDocumentLoad()"></ng2-pdfjs-viewer>
then loading pdf and set it as Blob URL
const res = await this.getPdfAsBlobUrl(downloadUrl);
this.externalPdfViewer().pdfSrc = res as Blob;
this.externalPdfViewer().refresh();
It worked fine with the previous version of the ng2-pdfjs-viewer, but the current version uses IFRAME and fails to load the BLOB URL, it's blocked by the browser because of different domains I assume.
The question is: has someone resolved such a problem? Is it possible to force ng2-pdfjs-viewer to not use IFRAME or send the File in a different way other than BLOB URL? (cannot just put the file URL and let the library load it by itself because of too complicated document loading procedure)
Upvotes: 1
Views: 57