Forum Discussion
SimonH
Qrew Cadet
Hi Aidon,
Web browsers cannot display PDF thumbnails, this is not a QuickBase limitation but a browser one.
Assuming all else is correct with your formula then pointing it at an image attachment would work.
------------------------------
Simon H
------------------------------
Web browsers cannot display PDF thumbnails, this is not a QuickBase limitation but a browser one.
Assuming all else is correct with your formula then pointing it at an image attachment would work.
------------------------------
Simon H
------------------------------
MarkShnier__You
3 years agoQrew Legend
There is a non native solution which is dependent on the good graces of google to continue to offer a free service.
If you go to the exchange and download a copy of Kirk Trachy's Magic Buttons app there is a demo there of displaying a PDF or Word or Excel documentcas a preview.
But the essential code is a Formula text field called
[[Attachment Type (formula)]
var text Suffix = Right([Receipt Photo or Attachment],".");
var text NonPhotoFileType =
Case($Suffix,
"xls", "File",
"xlsx", "File",
"pdf", "File",
"doc", "File",
"docx", "File",
"ppt", "File",
"pptx", "File");
If(
Trim([Receipt Photo or Attachment])="","",
$NonPhotoFileType<>"", $NonPhotoFileType, "Image")
Then a formula URL field called Preview
If([Attachment Type (formula)]="File",
URLRoot()&"db/"&AppID()&"?a=dbpage&pagename=iframe.html\n&rid="&[Record ID#]
&"&tabledbid="&Dbid()
&"&myurlroot="&URLRoot()
&"&fileattachmentfid=36")
// This field refers to iframe.html that is located in the pages section of this app. You will need to copy that code page into your app.
// You will also have to copy the code from this button and update it for your button to reflect what your file attachment's field id (fid) is. This this example the file attachment is 432. Yours may be different.
// Also be sure to "Allow open access Allow access to this file attachment from a Quickbase link without signing in". Edit the file attachment field properties and check the checkbox. Gview needs to be able to see the file in order to render it.
on that field set checked
Embed as iframe in forms
That field refers to a code page called
iframe.html
<html>
<head><title></title></head>
<body>
<iframe id="kirk" style="height:100%;width:100%;border:none;overflow: scroll;"></iframe>
<script>
const urlParams = new URLSearchParams(window.location.search);
const rid = urlParams.get('rid');
const tabledbid = urlParams.get('tabledbid');
const myurlroot = urlParams.get('myurlroot');
const fileattachmentfid = urlParams.get('fileattachmentfid');
const src = "https://docs.google.com/gview?url=" + myurlroot + "/up/" + tabledbid + "/a/r" + rid + "/e" + fileattachmentfid + "/v0&embedded=true";
document.getElementById("kirk").src = src
</script>
</body>
</html>
------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------
If you go to the exchange and download a copy of Kirk Trachy's Magic Buttons app there is a demo there of displaying a PDF or Word or Excel documentcas a preview.
But the essential code is a Formula text field called
[[Attachment Type (formula)]
var text Suffix = Right([Receipt Photo or Attachment],".");
var text NonPhotoFileType =
Case($Suffix,
"xls", "File",
"xlsx", "File",
"pdf", "File",
"doc", "File",
"docx", "File",
"ppt", "File",
"pptx", "File");
If(
Trim([Receipt Photo or Attachment])="","",
$NonPhotoFileType<>"", $NonPhotoFileType, "Image")
Then a formula URL field called Preview
If([Attachment Type (formula)]="File",
URLRoot()&"db/"&AppID()&"?a=dbpage&pagename=iframe.html\n&rid="&[Record ID#]
&"&tabledbid="&Dbid()
&"&myurlroot="&URLRoot()
&"&fileattachmentfid=36")
// This field refers to iframe.html that is located in the pages section of this app. You will need to copy that code page into your app.
// You will also have to copy the code from this button and update it for your button to reflect what your file attachment's field id (fid) is. This this example the file attachment is 432. Yours may be different.
// Also be sure to "Allow open access Allow access to this file attachment from a Quickbase link without signing in". Edit the file attachment field properties and check the checkbox. Gview needs to be able to see the file in order to render it.
on that field set checked
Embed as iframe in forms
Iframe width:
Iframe height:
Iframe height:
That field refers to a code page called
iframe.html
<html>
<head><title></title></head>
<body>
<iframe id="kirk" style="height:100%;width:100%;border:none;overflow: scroll;"></iframe>
<script>
const urlParams = new URLSearchParams(window.location.search);
const rid = urlParams.get('rid');
const tabledbid = urlParams.get('tabledbid');
const myurlroot = urlParams.get('myurlroot');
const fileattachmentfid = urlParams.get('fileattachmentfid');
const src = "https://docs.google.com/gview?url=" + myurlroot + "/up/" + tabledbid + "/a/r" + rid + "/e" + fileattachmentfid + "/v0&embedded=true";
document.getElementById("kirk").src = src
</script>
</body>
</html>
------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------
- AidonOlligschla3 years agoQrew CadetMark,
For my current use, just changing it to a PNG file is completely fine. For future use, I will consider your insight. I will definitely have to sharpen up my QB skills, though.
------------------------------
Aidon Olligschlager
------------------------------
Related Content
- 13 days ago
- 6 months ago
- 4 months ago
- 3 months ago