cflapt Posted November 7, 2013 Report Share Posted November 7, 2013 My users upload PDF files. When needed, they would like to view these files later as embeded documents within a datapage. The following shows how to embed pdfs, but only pdf NOT stored on the caspio database? http://howto.caspio.com/tech-tips/tech-tip-embed-documents-in-datapages.html Thanks for the help. Quote Link to comment Share on other sites More sharing options...
0 MayMusic Posted November 7, 2013 Report Share Posted November 7, 2013 caspio file link is something like http://b4.caspio.com/dpimages.asp?appkey=dpimages.asp?appkey=c82f1000a638090d2a1c40058bce&file=FILENAME&file=[@field:MyFile] and in the iframe you also have link so if you replace the file link it will be something like: <iframe src="http://docs.google.com/gview?url=http://b4.caspio.com/dpimages.asp?appkey=dpimages.asp?appkey=c82f1000a638090d2a1c40058bce&file=FILENAME&file=[@field:MyFile]&embedded=true" style="width:718px; height:700px;" frameborder="0"></iframe> This way you are using a link inside another link with parameters which is confusing for the browser! Therefore you need to get the URL of the file which is on an external server Quote Link to comment Share on other sites More sharing options...
0 cflapt Posted November 17, 2013 Author Report Share Posted November 17, 2013 Thanks, but the PDFs contain customer specific information, i.e. I need to store them by customers. Storing them on an external server does not seem feasible. Quote Link to comment Share on other sites More sharing options...
0 cflapt Posted November 19, 2013 Author Report Share Posted November 19, 2013 I can't believe there is not a way to view PDFs within Caspio without downloading. If the PDF contains private information then if a user is on their home computer and they view the PDF the PDF will be download to their home computer. Quote Link to comment Share on other sites More sharing options...
0 DataCobalt Posted May 20, 2015 Report Share Posted May 20, 2015 caspio file link is something like http://b4.caspio.com/dpimages.asp?appkey=dpimages.asp?appkey=c82f1000a638090d2a1c40058bce&file=FILENAME&file=[@field:MyFile] and in the iframe you also have link so if you replace the file link it will be something like: <iframe src="http://docs.google.com/gview?url=http://b4.caspio.com/dpimages.asp?appkey=dpimages.asp?appkey=c82f1000a638090d2a1c40058bce&file=FILENAME&file=[@field:MyFile]&embedded=true" style="width:718px; height:700px;" frameborder="0"></iframe> This way you are using a link inside another link with parameters which is confusing for the browser! Therefore you need to get the URL of the file which is on an external server Hey MayMusic, If I understand you correctly this will only use the google docs viewer to display the document, the file itself will be stored on caspio. Is there any risk to the file having any information captured by google? I am also dealing with potentially sensitive information but a key element to moving our company paperless will be this type of viewing platform. Thank you! Quote Link to comment Share on other sites More sharing options...
0 Jan Posted May 21, 2015 Report Share Posted May 21, 2015 Hello DataCobalt, If I understand correctly, the Google viewer cannot display files that are stored on caspio now. The reason, if I understand correctly, is: the link to a file is like http://eu1.caspio.com/dpImages.aspx?appkey=APPKEY&fileID=FileID In other words, the link uses parameters. But the Google viewer uses parameters also: iframe src="http://docs.google.com/gview?url=URL&embedded=true" style="width:718px; height:700px;" frameborder="0" If a link to a file on caspio is pasted instead of URL, the code will be like: iframe src="http://docs.google.com/gview?url=http://eu1.caspio.com/dpImages.aspx?appkey=APPKEY&fileID=FileID&embedded=true" style="width:718px; height:700px;" frameborder="0" But two "?" sings in the same URL do not work. Quote Link to comment Share on other sites More sharing options...
0 DataCobalt Posted May 21, 2015 Report Share Posted May 21, 2015 Would it be possible with making the second "?" a "%" in this case since it is an iframe? Or is there another workaround? At this point having the forms stored in another place isn't really an option for us. Quote Link to comment Share on other sites More sharing options...
0 Jan Posted May 22, 2015 Report Share Posted May 22, 2015 As far as I know, making the second "?" a "%" does not work, but you can try yourself. I will be thankful if share your experience. I cannot find another workaround at the moment, but maybe anybody else can propose his/her solution. Quote Link to comment Share on other sites More sharing options...
0 Vitalikssssss Posted May 24, 2017 Report Share Posted May 24, 2017 Google viewer frame will display embed document from Caspio if you encode the URL link of file stored inside Caspio account: So, URL link will look like this: https%3A%2F%2Fe1.caspio.com%2FdpImages.aspx%3Fappkey%3D____%26fileID%3D_____ I have used following link to generate the encoded URL. Hope this helps Quote Link to comment Share on other sites More sharing options...
0 JoshuaJobin Posted September 13, 2017 Report Share Posted September 13, 2017 (edited) On 5/24/2017 at 7:49 AM, Vitalikssssss said: Google viewer frame will display embed document from Caspio if you encode the URL link of file stored inside Caspio account: So, URL link will look like this: https%3A%2F%2Fe1.caspio.com%2FdpImages.aspx%3Fappkey%3D____%26fileID%3D_____ I have used following link to generate the encoded URL. Hope this helps Are you sure this works? I am encoding the URL with Javascript, but every time I get a "No Preview Available" message. When I decode the URL back, it downloads fine... Here is my code: <iframe id="iframe_pdf" style="width:80%; height: 1100px; display: none;" align="middle" frameborder="0"></iframe> <script> window.onload = function(){ if(!("[@field:cs_form/]" == "")){ embed_pdf(); } } function embed_pdf(){ var google_link= "https://docs.google.com/gview?url="; var google_param = "&embedded=true"; var pdf_link = "[@field:cs_form/]"; var encoded_pdf_link = encodeURIComponent(pdf_link); var iframe_window = document.getElementById("iframe_pdf"); iframe_window.style.display = "block"; iframe_window.src=google_link + encoded_pdf_link + google_param; } </script> EDIT: I found out why it wouldn't show, the datapage was authenticated. And unless you are signed in OR Un-authenticate the datapage, you will not be able to see the PDF. Now... is there a way to pass google the authentication... Edited September 13, 2017 by JoshuaJobin Found new information Quote Link to comment Share on other sites More sharing options...
0 Vitalikssssss Posted December 20, 2017 Report Share Posted December 20, 2017 Hi everyone, I have revised the initial Javascript solution so it could meet the requirements of recent Asynchronous deployment method which do not support window.onload() event. <iframe id="iframe_pdf" style="width:80%; height: 1100px; display: none;" align="middle" frameborder="0"></iframe> <script> document.addEventListener('DataPageReady', function (event){ if(!("[@field:Document/]" == "")){ embed_pdf(); } }); function embed_pdf(){ var google_link= "https://docs.google.com/gview?url="; var google_param = "&embedded=true"; var pdf_link = "[@field:Document/]"; var encoded_pdf_link = encodeURIComponent(pdf_link); var iframe_window = document.getElementById("iframe_pdf"); iframe_window.style.display = "block"; iframe_window.src=google_link + encoded_pdf_link + google_param; } </script> vikovs 1 Quote Link to comment Share on other sites More sharing options...
0 DesiLogi Posted March 19, 2020 Report Share Posted March 19, 2020 Though this is an old thread I'm trying to utilize the solution but can't get it to work. I've got a Details datapage, authenticated, that uses a table that stores files. In this case, a pdf file in Caspio Bridge's Files section. This test example's file path in the field "File_Name" is /TestPdf.pdf. The code in an html block in the datapage is the above from this thread, but it's not working. All I get is a 'No Preview Available' message. Does the user need to be signed into to Google Docs for this to work? Is there a prefix that needs to go in from of the File_Name field since it's just /TestPdf.pdf? Any help would be really appreciated! <iframe id="iframe_pdf" style="width:80%; height: 1100px; display: none;" align="middle" frameborder="0"></iframe> <script> document.addEventListener('DataPageReady', function (event){ if(!("[@field:File_Name/]" == "")){ embed_pdf(); } }); function embed_pdf(){ var google_link= "https://docs.google.com/gview?url="; var google_param = "&embedded=true"; var pdf_link = "[@field:File_Name/]"; var encoded_pdf_link = encodeURIComponent(pdf_link); var iframe_window = document.getElementById("iframe_pdf"); iframe_window.style.display = "block"; iframe_window.src=google_link + encoded_pdf_link + google_param; } </script> Quote Link to comment Share on other sites More sharing options...
0 DesiLogi Posted March 20, 2020 Report Share Posted March 20, 2020 reposted to new thread since this is 3 years old. Quote Link to comment Share on other sites More sharing options...
0 Kurumi Posted November 22, 2021 Report Share Posted November 22, 2021 Hi @DesiLogi - have you tried to use these options?https://stackoverflow.com/questions/2138487/how-does-the-google-docs-pdf-viewer-workhttps://gist.github.com/tzmartin/1cf85dc3d975f94cfddc04bc0dd399be Quote Link to comment Share on other sites More sharing options...
0 DesiLogi Posted November 22, 2021 Report Share Posted November 22, 2021 Thanks for the link--I'll check it out but I pretty much gave up. I need the basic ability of Caspio Bridge being able to preview uploaded pdf's, because they need to be private. kpcollier 1 Quote Link to comment Share on other sites More sharing options...
Question
cflapt
My users upload PDF files. When needed, they would like to view these files later as embeded documents within a datapage.
The following shows how to embed pdfs, but only pdf NOT stored on the caspio database?
http://howto.caspio.com/tech-tips/tech-tip-embed-documents-in-datapages.html
Thanks for the help.
Link to comment
Share on other sites
14 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.