Discussions

Expand all | Collapse all

How to display PDF in file attachment fields

Jordan McAlister03-26-2019 17:51

Anna Harris07-12-2019 20:32

QuickBaseCoach Dev./Training03-20-2018 20:38

Jeff Jeff03-20-2018 20:51

  • 1.  How to display PDF in file attachment fields

    Posted 04-26-2014 23:03

    File attachment fields can show the attached files in forms and reports, but only a few file types are accepted (jpeg and such). Is there a way around this so that PDF attachments can be shown either directly in the form, or as a pop up window (I believe that is called an Iframe ?) after clicking on some button for that purpose?

    I now have that sort of working through a Chrome extension, which opens the PDF in another tab, but it's slow and cumbersome and has some unwanted side effects.



  • 2.  RE: How to display PDF in file attachment fields

    Top
    Contributor
    Posted 04-27-2014 05:08
    We need the same thing. It would be awesome if there were a way to preview the file instead of downloading upon clicking, much like in gmail? Any way to do this?


  • 3.  RE: How to display PDF in file attachment fields

    Top
    Contributor
    Posted 04-28-2014 21:50
    Hi Berry & Matt,
    I've not heard of this being possible natively however it would be really useful, would suggest you add it as a feedback item and vote it up, the Quickbase team are always looking for good ideas to enhance Quickbase and add functionality. In case your unfamiliar with the feedback button you can find it on the My Apps page its an orange table half way down on the left. If you let me know when you have put it up ill add some votes to it myself as its something I too would like added.
    Regards
    Jack


  • 4.  RE: How to display PDF in file attachment fields

    Top
    Contributor
    Posted 05-27-2014 21:22
    We have an invoice management application in Quickbase where all the 3rd party invoices are stored as PDF files in Amazon S3 and this application is integrated with S3. In the application we created a button which contains a link to the S3 document. Clicking this button will open the document in a separate window.


  • 5.  RE: How to display PDF in file attachment fields

    Posted 05-28-2014 00:01
    Well, we had that using dropbox but it was a nuisance, especially when dropbox got issues with their shared links recently.  The new Quickbase rates for storage are competitive and we want to move everything in quickbase now, just need a way to see the document like you see JPEG files and such.  Am not keen for any third party stuff.


  • 6.  RE: How to display PDF in file attachment fields

    Top
    Contributor
    Posted 07-27-2016 20:47
    I was able to accomplish this with the Image Onload Technique:
    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=320&rl=psr

    Create a Formula - Text Field named Attachment Viewer (separate from the Image Onload field) in the desired table. Be sure to check the box allowing HTML and insert the following:

    var text URL =
      "https://docs.google.com/gview?url="; &
      URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/eFID/v0&embedded=True";
    "<embed src=\"" & $URL & "\" height=\"650\" width=\"900\">"

    Replace FID with the field # of your attachment field.



    In the module.js page under the desired headings (Edit Record/Display Record) paste the following:

    $("#tdf_22").html($("#tdf_22").text().replace(/{{/g,"<").replace(/}}/g,">"));


    Where I have 22 you'll need to adjust this # to be the placement of the Attachment Viewer in your form. Start with testing the # to the left of the field in the form builder and decrease from there if necessary. 
    Ex: In my case it's the 23rd object on the form, and I need to use 22 in the script page.

    I've attached a picture of the final result.


  • 7.  RE: How to display PDF in file attachment fields

    Posted 05-29-2017 16:51
    Hi,

    so I've tried this but can't get the PDF to display.
    Got the JS Field & page:

    (function(){
    $("#tdf_26").html($("#tdf_26").text().replace(/{{/g,"<").replace(/}}/g,">"));
    $("#tdf_27").html($("#tdf_27").text().replace(/{{/g,"<").replace(/}}/g,">"));
    })();

    Got the field to display
    var text URL = "https://docs.google.com/gview?url="; & URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e30/v0&embedded=True";
    //"<embed src=\"" & $URL & "\" height=\"650\" width=\"900\">"
    "<iframe src=\"" & $URL & "\" height=\"650\" width=\"900\">"


    But get this error:



    Help?!


  • 8.  RE: How to display PDF in file attachment fields

    Posted 01-10-2018 21:08
    Same issue for me. Did you ever resolve it?


  • 9.  RE: How to display PDF in file attachment fields

    Posted 03-26-2018 18:14
    You need to change the properties of the file attachment field. you need to 'Allow open access'


  • 10.  RE: How to display PDF in file attachment fields

    Posted 08-31-2017 21:47
    Did you find a fix for this error ? I have it too


  • 11.  RE: How to display PDF in file attachment fields

    Top
    Contributor
    Posted 08-31-2017 22:10
    I suggest you put in a suggestion over at the UserVoice ghetto and wait a few years to realize that this feature will not be added to the product. Then use script as suggested by Ryan above. If you have an issue using script ask a new question with exactly what problem you are encountering. Script solves all QuickBase problems.


  • 12.  RE: How to display PDF in file attachment fields

    Posted 01-10-2018 21:51
    I got the same error screen as Carlos.

    I tested with a document in a public application and it worked. It seems that embedding it doesn't carry over the security from the main window. Do you know if I have to code in a token or something?


  • 13.  RE: How to display PDF in file attachment fields

    Posted 03-26-2019 17:51
    did you ever figure this out?


  • 14.  RE: How to display PDF in file attachment fields

    Posted 07-12-2019 20:20
    Any update on this? Having the same kind of issue in my app. 


  • 15.  RE: How to display PDF in file attachment fields

    Posted 07-12-2019 20:23
    Kirk Trachy has an app in the exchange called Magic Buttons where he gets this to work with no Image onload - all native.  :)

    Look for the section heading on the example records called 

    Iframe Document Previews


  • 16.  RE: How to display PDF in file attachment fields

    Posted 07-12-2019 20:25
    Im using magic buttons... Have everything exactly as in MB and its just showing me the HTML code in the iframe but not the actual pdf? 


  • 17.  RE: How to display PDF in file attachment fields

    Posted 07-12-2019 20:27
    Kirk demoed this at EMPOWER but I have not actually done it myself.  Is your field type Rich Text formula field?


  • 18.  RE: How to display PDF in file attachment fields

    Posted 07-12-2019 20:30
    The file attachment field properties have to be set so that a user can access the file without being signed in. For this reason, I have not been able to use this desirable function myself.


  • 19.  RE: How to display PDF in file attachment fields

    Posted 07-12-2019 20:32
    yeah. 



  • 20.  RE: How to display PDF in file attachment fields

    Posted 07-14-2019 15:33
    Anna, I added this app to my account, but then I had to check the box in the file attachment field which allows access without signing in. It appears to be working.


  • 21.  RE: How to display PDF in file attachment fields

    Posted 07-15-2019 16:34
    It works in the magic buttons app but not in mine for some reason? I did those same steps. 


  • 22.  RE: How to display PDF in file attachment fields

    Bronze
    Contributor
    Posted 07-15-2019 16:50
    Confirm that you made the File Attachment field "Allow Open Access" property is checked...

    That's the piece that I missed.


  • 23.  RE: How to display PDF in file attachment fields

    Posted 07-15-2019 16:52
    Unfortunately">https://d2r1vs3d9006ap.cloudfront.net/s3_images/1797492/RackMultipart20190715-38571-urdvk0-Iframe_errors2_inline.PNG?1563209553">Unfortunately I've done that too... Please let me know if you see if i've missed it? 


  • 24.  RE: How to display PDF in file attachment fields

    Bronze
    Contributor
    Posted 07-15-2019 16:57
    What's the field ID for the Estimate 1 File Attachment field? it'll be under the usage tab.


  • 25.  RE: How to display PDF in file attachment fields

    Posted 07-15-2019 17:00
    The other thing I missed at first is where it says "/e30/" in the url, 30 should be replaced with your Attachment Field ID#.


  • 26.  RE: How to display PDF in file attachment fields

    Posted 07-15-2019 18:23
    JEFF man thank you!!!! THAT was the magic number!!!!!!!! It works! :) 


  • 27.  RE: How to display PDF in file attachment fields

    Posted 08-31-2017 22:27
    Hi Dan,
    I used the script as per Ryan's suggestion and I have the same error as Carlos. Instead to show the pdf , it shows the html of the page in pdf format :).

    something curious, for an image I use the same formula(without google docs) and instead an iframe tag I use an image tag and it is working.
    It seems the url  ....../a/r1/e21/v0 it works for images but not for the pdf. It not gets the pdf file but the html page.

    Any sugestion ?
    Regards,
    Mihai


  • 28.  RE: How to display PDF in file attachment fields

    Posted 03-20-2018 20:25
    I'm getting a syntax error when trying to save the rich text formula field. Any thoughts?

    Formula syntax error

    A formula cannot end with an assignment to a variable declaration.


    var text URL = 
      "https://docs.google.com/gview?url=";   
      URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e269/v0&embedded=True";
    "<embed src=\"" & $URL & "\" height=\"200\" width=\"193\">"


  • 29.  RE: How to display PDF in file attachment fields

    Posted 03-20-2018 20:38
    What are you trying to do - just show a thumbnail?


  • 30.  RE: How to display PDF in file attachment fields

    Posted 03-20-2018 20:51
    Yes, that's right.


  • 31.  RE: How to display PDF in file attachment fields

    Posted 03-20-2018 21:00
    Try this as a formula Rich text field type  but 

    I have a few different formuals on file, try this one.  Replace the 6 with the fid holding the file attachment.  Play with the width to get the size you want.  You can also instead specify the height, but I suggest not specifying both as the image will get skewed.

    "<img src=" & URLRoot() & "up/" & Dbid () & "/a/r"   & [Record ID#] & "/e6/v0' width='300' >"


  • 32.  RE: How to display PDF in file attachment fields

    Posted 03-20-2018 21:19
    Did anyone manage to get the PDF's to display again?


  • 33.  RE: How to display PDF in file attachment fields

    Posted 03-20-2018 21:24
    Thanks for the new formula but it does not work for PDFs which is why I was trying to use the google viewer as Ryan suggested.


  • 34.  RE: How to display PDF in file attachment fields

    Posted 03-27-2018 14:39

    Hi guys,

    I�m currently evaluating whether to use Quick Base to deliver a business solution and the ability to view PDFs is a must-have feature.

    I managed to get the file attachment to view if it is an jpg with a rich text field containing:

     "<img max-width=\"32px\" max-height=\"100px\" src=\"" & URLRoot() & "up/" & Dbid () & "/a/r" & [Record ID#] & "/e46/v0\" />"

     

    And these variables :       

    /iol               &rand='+new Date().getTime())};">

    iol           <img qbu='module' src='/i/clear2x2.gif' onload="javascript:if(typeof QBU=='undefined'){QBU={};$.getScript(gReqAppDBID+'?a=dbpage&pagename=



    However, when I attached a PDF and use a second text field with

    var text URL = "https://docs.google.com/gview?url="; & URLRoot() & "up/" & Dbid () & "/a/r" & [Record ID#] & "/e46/v0&embedded=true";

    "<embed src=\"" & $URL & "\" height=\"650\" width=\"900\">"

    It just renders to this on the page!!!

    <embed src="https://docs.google.com/gview?url=https://msip.quickbase.com/up/bnfd9ydpg/a/r5/e46/v0&embedded=t...; height="650" width="900">

     

    Also, if I copy this url into a browser it just renders HTML.

     

    Can anyone help?

     



  • 35.  RE: How to display PDF in file attachment fields

    Posted 03-27-2018 14:43
    Are the file attachment field properties set to allow open access?


  • 36.  RE: How to display PDF in file attachment fields

    Posted 03-27-2018 16:00

    Thanks - I set  allow open access to true and the https://docs.google.com/gview?url=https://msip.quickbase.com/up/bnfd9ydpg/a/r5/e46/v0&embedded=t...   worked fine.

    However, for this solution the attachment needs to be private.

    So, I think my problem is that the script for the "<embed"  is being rendered to text on the page rather than being treated as a script.



  • 37.  RE: How to display PDF in file attachment fields

    Posted 03-27-2018 16:09
    The problem you're having is that this solution relies on using google docs, which is why you need to allow access outside of quickbase. 
    If you can find a way to use a document viewer internally with your app that would solve your privacy problem. Unfortunately outside of finding a third party app I don't know of a way to do that
    If you figure out a way, please share  


  • 38.  RE: How to display PDF in file attachment fields

    Posted 03-27-2018 16:34

    Thanks Chad,

    Also, can you explain why the embed is rendering to text rather than as an embed tag



  • 39.  RE: How to display PDF in file attachment fields

    Posted 03-27-2018 16:43
    the embed tag is doing what its supposed to be doing. An embed tag is a container that displays what information it receives from a plug-in or external source. 
    So in the case where you are seeing that html feedback (text), you are seeing what google docs spit back when it was sent the attachment with no access. 


  • 40.  RE: How to display PDF in file attachment fields

    Posted 06-17-2019 12:37
    I would like QuickBase to be able to display embedded PDFs from my network. I do not know if this is possible.

    Side note: Formula - URL field can open files into Chrome, e.g.: "C:\\\\Users\\wesmc\\Desktop\\"&"Empower.pdf"

    Using the Magic Buttons app, I have a PDF (file attachment) displaying embedded in a form. I am trying to take it a step further by displaying a file from a hyperlink (to the file on my local network).

    Left: Attachment; Right: Hyperlink



    I am not sure if this is possible since the file is not actually in QuickBase. The error in the iframe looks like what you get when trying to display the PDF without checking the box "Allow open access" in the Field Properties for the file attachment.

    This makes me wonder if there might be a way around this.

    Any ideas about whether this is feasible would be appreciated.

    Thanks!


  • 41.  RE: How to display PDF in file attachment fields

    Posted 06-17-2019 12:46
    Haven't tested it, but my initial thought is that the field is not publicly available. So in order to do that you'd need to have a role for 'Everyone on the Internet', with view access of that field.
    As a caveat though, if you're linking to a local resource only those with access to the resource will see the file.


  • 42.  RE: How to display PDF in file attachment fields

    Posted 06-17-2019 12:55
    Thanks for the response. I just tried EOTI, but I did not make any progress that I can see. Also, thanks for addressing the limitation of access.


  • 43.  RE: How to display PDF in file attachment fields

    Posted 06-17-2019 13:25
    Another thought I had is if it would be possible to use a rich text field to display a button that - when clicked - actually attaches a file to a record (from the established location), redirect/refresh to the record, and then display.

    Basically, this would be a step between my URL field to the PDF on my network and the file attachment field that is displaying as needed.