Skip to main content

FAQs

How can I view PDF files from external origins?

By default, the viewer only opens file URLs from the same origin. To be able to display files from external origins, the allowedFileOrigins option must be set. See: com.nbx.pdfviewer.Option

XML-View Beispiel:

<mvc:View
controllerName="com.nbx.PDFViewer.Example"
xmlns="sap.m"
xmlns:nbx.PDFViewer="com.nbx.pdfviewer">

<PDFViewer id="idPDFViewer" source="{/Source}" isTrustedSource="true" title="{/Title}">
<nbx.PDFViewer:pdfViewerOptions>
<nbx.PDFViewer:Option name="allowedFileOrigins" value="*://domain.tld" />
</nbx.PDFViewer:pdfViewerOptions>
</PDFViewer>
</mvc:View>
note

Allowing external sources does not guarantee that the viewer will accept URLs from external sources – the CORS headers on the remote server must be configured properly. E.g. access-control-allow-origin *