FMDiff™   

FileMaker Business Alliance
View Jürgen Geßwein's profile on LinkedIn

This site is W3C compliant:
Valid XHTML - Valid CSS
Last modified February 24 2016, 21:20:26 MET.

FileMaker Crashes with Multiple Print Jobs

Sending more than 15 or 20 documents to the printer in rapid succession may cause a crash

This is a well-known bug that has nothing to do with FileMaker. It occurs for more than 20 years under both Windows and MAC OS X.

So why is it happening?

When the print function was implemented into the system a long time ago, nobody had thought it might ever be called from a database that is capable to produce many print jobs in a row. Hence the Printer Queue was - and still is - very limited. So whenever the total number of print jobs in the queue exceeds a certain value, an overflow occures that crashes the application and possibly creates other damage. As a developer you must take care that this is not going to happen!

How to avoid this?

Keep in mind that each print job generated increases the counter of the printer queue and the printer working off a job decreases the counter. Unfortunately, there is no query option, how many jobs are currently in the queue. Therefore you must ensure that the printer will have enough time to process the generated print jobs before creating new ones. That means you have to insert appropriate Pause script steps. How long these Pauses must be depends on the printer and the type of documents. The best way is to stop the time that the printer needs, taking an average value, and add some security.

Unfortunately, this method is not 100% reliable, as at times the printer may run out of paper or a paper jam occurs.

Don't mix up Print Jobs with the number of Print Pages!

Printing a single page counts as one Print Job, but printing a document with 100 pages also as just one print job. So if your solution is used to print more copies of the same document, don't let your users hit a button a hundred times, offer a more sophisticated approach.

Here is the solution I published a few years ago:

It consists of a script loop that starts with the number of requested copies, and a number of predefined print statements that for example print 64, 32, 16, 8, 4, 2, 1, pages, always using the maximum possible number of pages until done, while subtracting the printed pages from the total count remaining.

First define some scripts that print 64, 32, 16, 8, 4, 2, 1, pages. Print without dialog since otherwise the number of pages will not stick.

    print 1 copy
    print 2 copies
    print 4 copies
    print 8 copies
    print 16 copies
    print 32 copies
    print 64 copies

Then define the script that does the actual work and counts down the pages. It is assumed the number of pages to print is provided as ScriptParameter.

Set Variable [ $n; Value:Get ( ScriptParameter ) ] 
If [ $n > 200	// maximum number allowed ]
    Beep
Else
    Loop 
        If [ $n >= 64 ]
            Perform Script [ “print 64 copies” ]
            Set Variable [ $n; Value:$n - 64 ] 
        Else If [ $n >= 32 ]
            Perform Script [ “print 32 copies” ]
            Set Variable [ $n; Value:$n - 32 ] 
        Else If [ $n >= 16 ]
            Perform Script [ “print 16 copies” ]
            Set Variable [ $n; Value:$n - 16 ] 
        Else If [ $n >= 8 ]
            Perform Script [ “print 8 copies” ]
            Set Variable [ $n; Value:$n - 8 ] 
        Else If [ $n >= 4 ]
            Perform Script [ “print 4 copies” ]
            Set Variable [ $n; Value:$n - 4 ] 
        Else If [ $n >= 2 ]
            Perform Script [ “print 2 copies” ] 
            Set Variable [ $n; Value:$n - 2 ]
        Else
            Perform Script [ “print 1 copy” ]
            Set Variable [ $n; Value:$n - 1 ] 
        End If
        Exit Loop If [ $n < 1 ]
    End Loop
End If

This way you can print almost any number of pages with very few print jobs.


Suggestions, opinions, experience reports and other hints are welcome via our Contacts page.


Examples are provided "AS IS" without warranties of any kind. Use at your own risk.

© 2005 - 2015 Winfried Huslik †. © 2017 Jürgen Geßwein. All Rights Reserved. FMDiff and FMVis are trademarks of Jürgen Geßwein, Augsburg, Germany. FileMaker is a trademark of FileMaker Inc., Santa Clara, CA, USA. Other trademarks mentioned are property of their respective owners. This web site has not been authorised, sponsored, or otherwise approved by FileMaker, Inc.