Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

FileMaker Server-side PDF generation

(0 reviews)

A question we are frequently asked is how to generate PDFs on the server and find them in a FileMaker application, inserted into container fields.

We will try to answer this clearly and illustrate our point with an example file.

The process takes place in three steps:

1 – The client triggers the server-side script

The client-side script will perform two operations:

  • Commit the record where the server-side script will need to write (depending on the use case, your server script may create a new record rather than modify an existing one. In that case, this step is unnecessary).

  • Call the server-side script, which will generate the PDF and insert it into a container field. A script parameter is passed to ensure that the server script can retrieve the correct context (record(s), sort order, print layout, etc.).

2 – The server script retrieves the context

In the example file, it’s quite simple: it just needs to find a record, so the script basically performs a find based on the script parameter. Often, it is necessary to find a set of records, sort them, etc. Everything that a Snapshot Link would allow, but unfortunately, you can’t open a Snapshot Link on the server. Your script might, therefore, be a bit more complex than just performing a search (Often, using Go To Related Record is the best option for, say, find an invoice record and then go to the related invoice lines viewed as list)

3 – The server script generates the PDF and inserts it into a container

Next, a file path $path is determined, and the PDF is saved.

Since the Insert File script step is not server-compatible, we convert this path into a URL using the function ConvertFromFileMakerPath($path; URLPath).

We could directly insert from the URL into the container field, but I always prefer an intermediate step that involves passing through a variable. The reason is how containers are displayed in the FileMaker Pro interface afterward. By using a variable and Set Field, we get more consistent results between macOS and Windows.

To insert a file into a variable using the Insert From URL script step, we need to specify a cURL option: --FM-return-container-variable.

We can then insert from the URL into the $pdf variable and set the container field with the contents of the variable.

Here is an example file to illustrate the concept. Account name: admin (no password)

Downlad demo file: Server-Side PDF

 

The post FileMaker Server-side PDF generation appeared first on fmcloud.fm.

View the full article

0 Comments

Recommended Comments

There are no comments to display.

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.