Hey everyone! I’ve searched a lot and still can’t find an answer to this problem.
I have a CMS collection with items that include a PDF document. In the Project Item pages I would like to display each PDF in a PDF viewer, however it seems this can’t be done using the “PDF Viewer” App cause it can’t connect to the dataset.
Is there another way I could do that?
Alternatively, I created a button that links to the document. Is there a way to make it so that when someone clicks this button a Pop-up page appears with the PDF container to display the file in a presentation mode?
I’ve tried CodeQueen’s solution but it’s not working… It says forbidden for the PDF
My code:
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;
let src;
$w.onReady(function () {
$w(“#projectsDataset”).onReady( () => {
src = $w(“#linkSource”).link;
let name = src.split(“/”)[4];
let url = src.split(“/”)[3];
$w(“#html1”).src = https://docs.wixstatic.com/ugd/${url}?
;
});
});
Thank you!