I have a file where locations have photos and PDF attachments stored as BLOBs. Using the HTML widget, I have gotten it to show the photos as per a previous answer on this forum.
I'm not sure how to do the same for the PDFs. I have very limited knowledge in both QGIS and code so quite frankly I have no idea what I'm doing.
Nothing I've tried has worked. This is the furthest I've gotten:
fileName=(expression.evaluate("\"ATT_NAME\""));
fileType=fileName.slice(-3)
if(fileType == "jpg"){
document.write(expression.evaluate(" '<img width="100%" src=' || '"data:image/png;base64,' || to_base64("DATA") || '">' "));
}
else{
document.write(expression.evaluate(" '<object data=' || '"data:application/pdf;base64,' || to_base64("DATA") || '" type='application/pdf'>' "));
}
How can I display a PDF?