May 5, 2020 Blog FileMaker FileMaker DevCon FileMaker Techniques insert filePDFScriptingWeb ViewerWebDirect Displaying PDF files in FileMaker Displaying PDF files in FileMaker web viewers is convenient for users and adds depth and interactivity to a layout. This article includes a simple step-by-step guide for displaying PDFs in FileMaker, as well as a backend look at why this method works. Interactive PDF in a container field To display PDFs: Add a container field to the layoutGo to layout modeSelect the container field then go to the “Data” tab in the inspector and select “Interactive content” You should now be able to see PDF files in interactive container fields in FileMaker Pro, FileMaker Go and WebDirect. I prefer to use the “Insert File” script step because I can customize its dialog box to have a consistent behavior for users. For example, I can set it to only allow certain files to be uploaded to the container field, and to always display the content of the file when possible. Make sure to select “Content of file” to display the contents of PDF files in interactive container fields. Insert File script step Caveats: Selecting “Optimize for Images” will only render the first page of the PDF fileIf you’re having problems opening the PDF file check out this blogHosted solutions must have a valid SSL certificate. Getting “The webpage cannot be found” is often caused by not having a valid SSL certificate on both the web server and the FileMaker Server.Use SNI on the web server if you’re using an SSL certificate on the web server that’s different than the one installed on the FileMaker server. This is often the case in large WANs. By “web server,” I’m referring to the web server of the FileMaker server, which is Apache for MacOs and IIS for Windows.Storing files as references is a recipe for disaster. For wisdom about container fields, check out our videos about them: part 1 and part 2For internal networks, install an SSL certificate on FileMaker Server and add a DNS record in order to get a valid SSL connection to the server from the client (fms.mycompany.com –> 192.168.1.10) Screen if SSL certificate is not valid Under the hood: The FileMaker server streams the PDF files to the container field. The container field opens https://[your domain]:16000/Streaming_SSL/… to display the PDF file in the interactive viewer. Interactive containers are rendered using the web browser technologies that web viewer uses.FileMaker Glossary (source) Notice the URL at the bottom Cool things you can do with PDF files in FileMaker (including WebDirect): Export layouts as PDF (e.g. sales reports)Interact with PDF files within FileMakerConvert PDF files to HTML using Javascript in a web viewerConvert any Word, Excel or Powerpoint file to PDF without a FileMaker plugin (click here for more info)Append pages to existing PDF filesUse OCR with scanned documents through FileMaker to create PDF files with selectable text Let us know in the comments if you’re interested in an in-depth guide on any of the above. By Karl Jreijiri
6 Comments Jean-Francois Posted on 7:05 PM - June 10, 2020 Hi, I used a web viewer for years to display PDF files stored on or server (windows) with HFS to open access to specific user and server path. In my script à generate the URL, store into a variable that point to the document. The web viewer URL is that variable. Work like a charm on JPG… just updated my iphone to 13.5 and now the PDF won’t display in the web viewer !?! Prior I was able to see it in Safari too, not it offers me to download it ?! So the same behavor is happening with in FM Go, except no download, just failure to see the PDF. I don’t have a device running a lower iOS so I can’t check, but it was working fine before. #1- How to fix this ? #2- Well you said convert PDF to HTML … for web viewer… maybe this is the solution ? Thanks Karl Jreijiri Posted on 6:29 AM - June 11, 2020 Hello, I tested the behavior that you described on iOS 13.4.1 and 13.5.1 on FM Go 18 and 19. The PDF files were displayed successfully in a web viewer in all test combinations. Which version of FM Go are you using? Are you using it on an iPad or iPhone? Is the SSL certificate of the server hosting the PDF files fully valid when checked on https://www.sslshopper.com/ssl-checker.html? Jean-Francois Posted on 11:04 AM - November 15, 2020 Hi, oh boy! I missed that reply ! Two things, I really don’t get your post how to do it at all and I might not have explained my problem correctly. I use FMG0 18 iPhone, FMS16. I have my scanned documents on my server, not on the same server as my FMS. Those documents are used by another application and they cannot be hosted on inserted into a container field. They are contracts and stored //server_1/data/contract/[year]/job_number.pdf [year] and job_number are variable that are calculated based on the current record. FMA Local network, I open URL and the PDF opens in Acrobat. FMA Remote network, I use an HFS file server and I can open using URL http://my_FQDN/data/contract/%5Byear%5D/job_number.pdf and it will open in the user’s browser. Prior to iOS13, I had a Webviewer and the URL was a $$variable it contains the same URL as the remote network http://my_FQDN/data/contract/%5Byear%5D/job_number.pdf and it was possible to see it in the Webviewer But with iOS 13, it’s no longer the case. I don’t have an iOS12 device anymore, but if I enter the URL in Safari it asks to download the file, and I think this is a new behaviour in iOS13… and probably that’s why the Webviewer is no longer displaying the PDF, it asks for a download, but the command fails and stop ! As I mentioned, I use the same scheme to see JPG file and it’s working great. Do you think we can find a solution ? My understanding is that we can have the server stream the PDF to a container field ? How about having a table with a single record with a container field (not global) and have a server side script to insert the PDF and then switch the FMGo to that layout ? I have another issue, FMA17 on Win10, I can no longer see or interact with a container field that contains a PDF, but this seems to be a problem other users have. I haven’t updated to FM18 or 19 because it only use signed plugin and I have very old that I need and until I have fully replace them with an alternative I can’t. I use ScriptMaster to create some, but on Win10 it’s complicated to get them signed… Karl Jreijiri Posted on 6:46 PM - November 17, 2020 Hello Jean-Francois, Thank you for being detailed in your reply. While I couldn’t replicate your issue in iOS, I did a research about it and found that this can be caused by other apps installed on iOS. In fact, multiple persons reported the same issue with the Alibaba app and removing it solved the same issue that you described. I suggest the following: – Try to remove apps one by one and test the web viewer behavior after each removal. – If possible, do a factory reset on one of your iOS 13 devices and see if the issue exists in a fresh OS. Please feel free to contact Eleanor at Eleanor@app.works to schedule a time to meet with one of our developers and diagnose this issue if it persists. We can take a look at the issue with displaying PDF files in FMP 17 on Windows 10 during that meeting too. Dave Evans Posted on 9:00 AM - July 22, 2020 How to fill in the fields on a PDF-with-form-fields inside FM, then push the final edited PDF out to a shared file-server? Caveat… can this be done without plugins? Karl Jreijiri Posted on 11:01 AM - July 22, 2020 Hello Dave, It is possible to fill fields in a PDF file programmatically in FileMaker using existing Javascript Libraries. It gets trickier if you want an interactive way of filling these field (i.e. Show the PDF form in an interactive container field and permanently save the form input). This is considering that you don’t want to use plugins. There are multiple ways of uploading files to a file server, some of them are: – Connect the server hosting FileMaker server to the shared file server through a remote network folder and mount that folder within the FileMaker documents path (due to limitations of file path access on FileMaker Server). Then use a PSoS script to save the container files to the mounted folder. One of the biggest benefits in this setup is that you don’t have to connect any client to the network drive via any protocol. I haven’t tested uploading files with non-ftp protocols, but it would be interesting to see if saving files using the smb or file protocols in the “Insert From URL” script step is possible – this would negate the need to mount the network folder within the server’s documents path. – Use Insert from URL to upload the PDF file to the file server via FTP/S.