In your formula, the PDF branch builds an appres://… URI:
"appres://datasources/Documenten/table/************" & EncodeUrl(...)
appres:// is an internal app resource scheme, not HTTPS. The PDF Viewer only accepts HTTPS URLs or binary PDF content. Hence it refuses to load it.
Your non‑PDF branch uses:
Substitute( Gallery3.Selected.Thumbnail.Large, "/thumbnail", "/pdf" )
That returns a proper HTTPS preview endpoint (via Microsoft’s viewer), so it works.
Fix: give the PDF Viewer a real HTTPS URL (or binary content)
Your formula rewritten (simple version)
If(
Lower(Last(Split(Gallery3.Selected.Bestandsnaamextensie, ".")).Value) = "pdf",
// Build a real https link to the pdf file:
"https://contoso.sharepoint.com" & Gallery3.Selected.'ServerRelativeUrl' & "?download=1",
// For Office docs, use the pdf rendition endpoint:
Substitute(Gallery3.Selected.Thumbnail.Large, "/thumbnail", "/pdf")
)
Replace https://contoso.sharepoint.com with your tenant/site origin.
✅ If this answer helped resolve your issue, please mark it as Accepted so it can help others with the same problem.
👍 Feel free to Like the post if you found it useful.