Over 46,000+ Business Solution Developers Find answers, ask questions, and connect with our community of business solutions developers, business owners and partners.
Handling PDF Printing From FileMaker WebDirect – A New Approach – FileMaker Today
Here is this weekends featured blog from our friends at Core Solutions in Toronto Canada…be sure and sign up for the Core Solutions Newsletter after reading! After working on a solution that eventually became FileMaker WebDirect-ified, it became quite evident that we needed to find a way to do reporting from web-based clients. As most of you are probably already aware, the very useful “Save as PDF” script step that FileMaker Pro provides is not available to clients accessing your system via Web Direct. There are a number of solutions to this problem already, but I had problems getting some of them to work, and others didn’t quite fit the bill.
As a result of this dilemma, I decided to roll on my own – I ended up creating a module that is relatively easy to implement, flexible, and even allows you to reuse your existing reporting scripts should you find yourself in a situation similar to mine.
How to Install this Module
Copy custom functions
Clean up the layouts that are automatically created (delete everything but the “Container” field, make the layout blend in with your system, and make that container field take up the majority of the screen)
Copy the main script folder (Perform Script On Robot) from sample solution into yours
Create a new account in your system to be used by the robot. The default account name is “Robot”, though this can be changed in the config file
Modify the “PSOR Config” script (Optional)
Attach the “PSOR On Record Load – Look For New Jobs” script as an On Record Load script trigger on the “PSOR_ActiveJobs” layout
Attach the “PSOR On First Window Open” and “PSOR On Last Window Close” as script triggers on the file
Login to the system with your “Robot” account from FileMaker Pro on the robot machine
Once installed, the solution can be very simple to implement. To understand how to implement it, you should keep in mind that the goal of this module was twofold; to be able to create PDF’s seemingly from WebDirect and to be able to reuse the same scripts that create those PDF’s from FileMaker Pro clients. After all, who likes rewriting code to do the same thing multiple times?
Keeping that in mind, with just a couple of simple additions, every one of your scripts that generates a PDF file can probably be modified so that it can be run from your Robot machine as well.
Each one of those scripts will need a section at the top that determines if the script should continue running, or be handed off to the robot to continue (see sample file for details on this)
#IF THIS IS BEING RUN FROM WEB-DIRECT, HAVE THE ROBOT MACHINE RUN THIS SCRIPT INSTEAD
IF [ $$IAMWEBDIRECT ]
PERFORM SCRIPT [ “PSOR - ASK ROBOT TO RUN THIS” ;
PARAMETER: INFOFORROBOT__CF ( )GO
//& NAMEVALUEPAIR_BROWSE__CF ( _NAME ; _VALUE )
//& NAMEVALUEPAIR_FIND__CF ( _NAME ; _VALUE ) ]
#ROBOT MACHINE RUNS EVERYTHING UNDER THIS LINE, AND SHOULD EXIT WITH THE PATH TO THE PDF THAT WAS CREATED
Each one of those scripts should create a PDF (or some kind of file), and exit the script with a result representing the path to that newly created file
If everything went smoothly, then anytime you try to run one of your newly modified scripts from WebDirect, the handoff should take place, and the user will be left on a screen that displays the PDF.
If you’re interested in the actual solution, you can download it here.
If you enjoy these FileMaker Blogs, be sure to subscribe to our Core FileMaker Newsletter!
Have any questions or comments about this solution? Have anything you would like to add or change? Feel free to let us know by clicking our link below.
And as always, Thanks For Reading,