Gviewer needs to be able to see the file in order to render it. Edit the file attachment field properties and check the checkbox. Also be sure to "Allow open access Allow access to this file attachment from a Quickbase link without signing in". This this example the file attachment is 432. 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. You will need to copy that code page into your app. This field refers to iframe.html that is located in the pages section of this app. $NonPhotoFileType"", $NonPhotoFileType, "Image") Just copy paste.Ĭonst urlParams = new URLSearchParams() Ĭonst tabledbid = urlParams.get('tabledbid') Ĭonst myurlroot = urlParams.get('myurlroot') Ĭonst fileattachmentfid = urlParams.get('fileattachmentfid') Ĭonst src = " " + myurlroot + "/up/" + tabledbid + "/a/r" + rid + "/e" + fileattachmentfid + "/v0&embedded=true" ĭocument.getElementById("kirk").src = srcĬreate this field called Attachment type. You don't have to understand the code page. The technique is in Kirk Trachy's Magic Buttons app. Sherry, there is a way to preview most normal file types if you are willing to set your file attachment field to be viewable without logging in. check the embed as iframe box and set the window sizeįor additional optimization I used text HTML to wrap the iframed menu and other fields into a table, table row, and table cells so that the menu is to the left of the fields where the requested items are inputted.Īnd now life is a little easier for my colleagues:.toggle the HTML button so you can add code.upload the pdf to a file attachment field.I did some research and found a way to embed the PDF menu in the form as an iframe. That's when I learned that employees would click the link in the form and the attachment would download and then they would have to open the file to view the menu. IncludeScript("Previously the menu was in the form as a formula URL that had the link to the menu as an attachment from a resources table. TextAreaInput("markedTextFromPdf", label = "Test, if I can copy text from iframed local pdf"), # fulltext::cache_options_set(full_path = paste0(wwwPath, "/cachedFiles")) Repeat steps 2-6 to see the console error.Stop the shiny app, and change the source of the tags$iframe() in App.R by commenting out the current one and uncommenting the one above. Press and release Enter to trigger the javascript function (You should now see the marked text inside the textAreaInput in the parent element.Focus the parent frame by clicking outside the iframe.Inside the webbrowser, mark some text inside the iframe.Open R-Studio and run the app by executing all the code.set up the directory as shown under Folder Structure below.So I originally thought it was only a matter of storing the pdf file in the wrong place ( see this discussion), but I have myPdf.pdf already stored in the into the iframe, but when I embed myHtml.html I don't get that error and the function works as expected (besides the minor issue that I have to click outside the iframe to trigger the function, but that's another issue for another day).Īny help to solve this issues is highly appreciated (hints about that odd behaviour are also welcome) Steps to reproduce: SecurityError: Permission denied to access property "document" on cross-origin object The problem now is that my browser console gives me this error: I'm currently working on a little project to create a shiny app for systematic litreature reviews and as part of that I added functionality to download pdf-files and then show them inside an iframe (The pdf shows inside the iframe as expected).Īs a next step I want to be able to select text in that PDF and use Javascript to automatically copy it to a textAreaInput in the parent-frame. I've tried to get an answer to this on Stackoverflow already, but didn't get any answer for over a month. I've already checked your rules on cross-posting here and I think it's ok to do so, if not I apologize.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |