Turn web view into image on server

The built-in Filemaker charts are super limited, so I have a number of web views on my screen, but they really slow down load time. I'd love to find a way to run a nightly script on the server which turns all my web views into images and stuffs them into a container.

I think I can do this with MBS, but this function doesn't run on the server (which makes sense). Is there some workaround for this? Does anyone else have any advice for this?

MBS function: Monkeybread Software - MBS FileMaker Plugin: WebView.Screenshot

UPDATE: I did find this outline that someone shares, but my brain isn't seeing how to use javascript to turn the page itself into an image. Claris Community (English)

you may better install a FileMaker Pro to do the batch jobs.
Then it can use web viewer and our screenshot function.
This robot could run on the server, if it's a macOS server or a Windows server with GUI.

I'm using a 3rd party host so this probably won't work without buying another machine (it's a public school so that's a 6-month process)... but I'll keep it in my back pocket.

Maybe you can do it with cURL, some APIs like Google Maps have extra endpoints for rendering of the dynamic content into PNG or JPEG but it really depends...

Hi it may not be a solution to your problem. I think you may use html2canvas to save the webviewer to an image and then into a container field.

https://html2canvas.hertzen.com/

Since you are doing server side and execute JavaScript in webviewer is not supported on server, you are required to change the work flow to auto save the image after some actions if you adopt this method. Hope this help, thank you.

@JasonMark the most reliable way I've found to convert html into pdf/png is by creating a webservice that literally spins up a headless chrome instance, renders the html, and "prints" it.

I've done this before using AWS Lambda/APIGateway. That way you only pay for what you use, and it's very cheap. Spinning up headless chrome takes up a lot of RAM so, it's definitely a good strategy to use serverless functions like AWS Lambda.

In this case, since you'd be running this via a server schedule, webviewers won't even work, so you'll just take the HTML that you would have displayed and send it to your service to render, and retrieve the result (either directly in the http response or from an S3 bucket).

4 Likes