
WebApps based on FileMaker
26/06/2025
Why Your FileMaker CRM Needs a Data Upgrade (and How to Start Today)
28/06/2025In some business processes it is of great use if prints are available without executing the print command from a client workstation. In a high capacity workflow like i.e. order picking, printing is basically a waste of time. Having a server print packing slips as orders come in, is much easier and faster.
Unfortunately FileMaker does not support the print functionality when executed in a script on the server. Filemaker Server (FMS) is what we call ‘headless’ and does support printer setup but not the actual print command. This renders the standard “scheduled scripts” as execution option useless. Even when you could print, where would you print to? The server is usually a cloud-machine that has not printers connected right?
Now, is printing from a cloud FMS to local printers possible?
Setup FMS Printing
Yes, if you want to prevent a ‘workstation as printer robot’ in your network and would like FMS Server to take care of the printing, this is possible. Even when your FileMaker Server is in the cloud and you do not have a in-house print server! There are 4 steps needed to print from FMS:
1. a document to print (i.e. a PDF file)
2. a system script that can handle the documents and offer them to get printed
3. PDF reader that can open en print the document
4. a network printer that can receive the print command and output your document.
Ad. 1 Generating a File from a script
Generating a file (i.e. a PDF) from a Filemaker script is luckily an option that is supported by FMS. The option “Save record as PDF” for example will give you the option to save your selected record(s) based on the current layout to a (multi page) PDF file. There are also plugins that can help you do this.
Ad. 2. System Scripts
FileMaker Server offers us the option to execute scheduled FileMaker Scripts, this must be a familiar option to most of you. But besides scheduling Filemaker Scripts, FMS will let you also execute so called System Scripts. These are scripts that run on the server (i.e. Applescripts on Mac or PowerShell scripts on Windows).
Using this System Script option we are able to call “Print” functionality outside of FMS that is not available inside FMS. Below you find an example of some basic scripts that can be used to achieve printing from FMS by a Windows PowerShell script (ps1). Because FMS does not handle .ps1 script very well, in this example we call a batch script (.bat) that in itself calls the .ps1 script.

So as seen in the screen shot above we call: run-printscript.bat which looks like this:
powershell.exe -ExecutionPolicy Bypass -File "C:\Program Files\FileMaker\FileMaker Server\Data\Scripts\print-pdfs.ps1"
And the “run-printscript.bat” will call: print-pdfs.ps1 which looks like this:
$watchFolder = "C:\PrintQueue"
$logFile = "$watchFolder\fms-print-log.txt"
$printedPath = Join-Path -Path $watchFolder -ChildPath "Printed"
$failedPath = Join-Path -Path $watchFolder -ChildPath "Failed"
$sumatraPath = "C:\Program Files\SumatraPDF\SumatraPDF.exe"
# Ensure subfolders exist
if (!(Test-Path -Path $printedPath)) {
New-Item -ItemType Directory -Path $printedPath | Out-Null
}
if (!(Test-Path -Path $failedPath)) {
New-Item -ItemType Directory -Path $failedPath | Out-Null
}
$printerMap = @{
"P1" = "Kyocera ECOSYS M5526cdn"
"P2" = "Kyocera ECOSYS P2040dn KX"
"P3" = "Kyocera P2040dn Bol Printer"
"P4" = "Kyocera Filemaker-KBLANCO"
}
Add-Content -Path $logFile -Value "`n[$(Get-Date)] Starting print job..."
Get-ChildItem -Path $watchFolder -Filter *.pdf | ForEach-Object {
$pdf = $_.FullName
$fileName = $_.Name
Add-Content -Path $logFile -Value "[$(Get-Date)] Found file: ${fileName}"
$prefixMatched = $false
if ($fileName -match "^(P\d+)_") {
$prefix = $matches[1]
$prefixMatched = $true
Add-Content -Path $logFile -Value "[$(Get-Date)] Matched prefix: ${prefix}"
if ($printerMap.ContainsKey($prefix)) {
$printerName = $printerMap[$prefix]
Add-Content -Path $logFile -Value "[$(Get-Date)] Printer mapped: ${printerName}"
}
else {
Add-Content -Path $logFile -Value "[$(Get-Date)] Unknown prefix: ${prefix}"
}
}
if ($prefixMatched) {
try {
Add-Content -Path $logFile -Value "[$(Get-Date)] Attempting to print ${fileName} with SumatraPDF..."
$p = Start-Process -FilePath $sumatraPath -ArgumentList "-print-to `"$printerName`" `"$pdf`"" -PassThru
$p | Wait-Process -Timeout 20
if ($p.HasExited) {
$destination = Join-Path -Path $printedPath -ChildPath $fileName
Move-Item -Path $pdf -Destination $destination
Add-Content -Path $logFile -Value "[$(Get-Date)] SUCCESS: Printed ${fileName}"
} else {
Stop-Process -Id $p.Id -Force
$failedDest = Join-Path -Path $failedPath -ChildPath $fileName
Move-Item -Path $pdf -Destination $failedDest
Add-Content -Path $logFile -Value "[$(Get-Date)] ERROR: Timeout printing ${fileName}"
}
} catch {
Add-Content -Path $logFile -Value "[$(Get-Date)] ERROR printing ${fileName}: ${_}"
$failedDest = Join-Path -Path $failedPath -ChildPath $fileName
Move-Item -Path $pdf -Destination $failedDest
}
} else {
Add-Content -Path $logFile -Value "[$(Get-Date)] Skipped ${fileName}: no valid prefix"
$skippedDest = Join-Path -Path $failedPath -ChildPath $fileName
Move-Item -Path $pdf -Destination $skippedDest
}
}
Add-Content -Path $logFile -Value "[$(Get-Date)] Print job finished."
exit 0
Ad.3. PDF Software
As you can see in the code above we call with this script the SumatraPDF software. This is a lightweight PDFreader that we prefer (because of size and ‘silent printing option’) over Adobe Acrobat. So to make this happen download and installe SumatraPDF on the server. Make sure the path to the .exe is correct.
Ad.4. Contact the printer
Last but not least we need to reach a printer. In the code above you see we wrote some additional lines to make printing to several different printers possible. Depending on the prefix we route the print to the corresponding network printer. What do we mean by network printer, because FMS has no printers conected right? Correct, and here is where the last magic comes in. We installed: Printix.

Printix is a cloud-printing-service that is extremely affordable and easy to use in combination with your FileMaker Server. Simply install a printix client in your office network and on your database server and all printers in your office will become available to any application on your cloud based database server. Which means: a print command executed on the FMS will end up printing on your local office printer!

Conclusion
Printing from FileMaker Server is possible. And in the right production process it is actually more then necessary. Based on above code do not forget to create a PrintQueue folder with a “printed” and “failed” folder inside. Any document saved in the PrintQueue will automatically be printed to the assigned printer. When anything goes wrong – printer not available etc. – documents might end up in the “failed” folder. You can another script to keep track of the fails and i.e. message an administrator when this happens.
If you’re considering or operating with FileMaker for your business, now is the perfect time to contact us and see how we can help you automate your processes.
Do not hesitate to contact us if you want to know more!


