PDF in WebDirect

by JanSTP

This module uses my ‘Perform script on other client’ method to generate a PDF in WebDirect.

 

The technique I use is fully FileMaker native. In fact it is just the ‘onRecordLoad’ script trigger…

I have a layout especially for the robot with a script on the ‘OnRecordLoad’ script trigger. The robot is just viewing this layout.

Now you have two options:

1.  You delete all the records in the table first and let the robot wait without any records loaded. The moment a record is made, the script will run on the robot. The creation of the record can be done from everywhere: another client, WD, by the server, FMGo, …

2. The second option is that you let the robot ‘sit’ on a particular record. When you delete that particular record from another session, the ‘OnRecordLoad’ script trigger will also be fired at the robot…

Once the robot is triggered you will need of course a sort of session table to let the robot know what he has to do.

At the end of the task, the robot can then trigger the client to say: ‘Hello I’m ready!’

Great!? Isn’t it?

See the links below for more information about the technique:

– ClickWorks blog article

YouTube video from FileMaker Pro Gurus about the technique

 

The robot can be on the server machine itself ( best on another user ). This keeps the technique reliable and fast.

 

Some of the advantages:

– on click

– no plugins

– free

 

Click on the following link for the module with example: PDFinWD_20170420.fmp12

( updated on 2017.04.20: refresh window added + double suffix ‘.pdf’ problem fixed )

 

12 responses to “PDF in WebDirect”

  1. Dennis Burnham says:

    Wondering if I have discovered some typos, or if I don’t understand: In the first sentence I think you mean “two” options. But more important, isn’t it a record that you are creating, not a script, from another client, WD, FM Go etc. ??

    If I’m right, this would be the revision

    Now you have two options:

    1. You delete all the records in the table first and let the robot wait without any records loaded. The moment a record is made, the script will run on the robot. The creation of the record can be done from everywhere: another client, WD, by the server, FMGo, …

    • JanSTP says:

      Hi Dennis,

      You are totally right! Excuse me for the typos.
      English is not my native language so I’ll blame it on that. 🙂
      I’ve updated the module!

      Thx!

      JanSTP

  2. Evan Z says:

    This is insanely fortuitous as I am trying to figure out how to print labels through the browser interface of WebDirect. Can I use this robot to create a PDF of the labels and then allow users to print? (I am brand new to robot usage so be reading the blog post and watching the video now.)

    • JanSTP says:

      Hi Evan,

      Yes, you can let the WebDirect say to the robot: ‘Create me this label’. Then, when the robot is finished it can trigger the WebDirect session to say: ‘Here is your label you asked for’. The user is then presented with a dialog box to download the pdf…
      So it takes two steps: first trigger the robot to create the pdf. Then when the robot is finished let him trigger the webdirect session to pass the pdf. ( store somewhere in a container )

      Succes with it!

      Grts,

      JanSTP

  3. Evan Z says:

    JanSTP, thank you!

    Working on integrating in now. A couple steps I am slightly confused on (.ReadMe file):

    Line 32: “You should pass the ID of the record to print and the type”. I’m not sure what this means. In the Conifg file, I specified “labels” and integrated in my labels creating script. I’m not sure I understand where the “ID” comes in though. I set it up so it asks the user where to save on the Desktop (as is used within the example files already). Do I need to do something with an ID? If so, what ID and what needs to happen to it?

    Line 38: “Open the file on the robot with the ‘robot’ account”. I specified the robot account in the config script. Does the Robot need to have any particular permissions? ALSO, and this is where I got confused, does the script automatically open the file with the Robot account or do I have to do something ADDITIONAL to open the file? Or is that taken care of in Line 19?

    Thank you ahead of time and I apologize if these are obvious answers that I am just too new at this to see immediately.

  4. Evan Z says:

    I think I realized an error (in what I am not fully understanding/having issues with setup). Is the “Robot” an account/client in the FMP file (like any other user but with admin privileges) or is it located somewhere/somehow else?

  5. Evan Z says:

    Line 44 of Config file: “THE SCRIPT RESULT HAS TO BE THE FILEMAKER FILEPATH TO THE CREATED PDF!!!”

    How/where do I specify that?

  6. Evan Z says:

    Please disregard the 1:42 and 2:44 posts. I think I dissected enough to understand. And, for Line 44, it is noting, I’m assuming, the $filePath defined in your own create PDF script. That said, when I run it I get an error: “Something went wrong while making the pdf. The PDF generator is not responding, contact the administrator.” Any thoughts?

  7. Evan Z says:

    JanSTP: Would it be possible to use this module WITHOUT a robot? As in, have it send to a queue for a FMP user, who, when logs in, receives the cue and can process the orders to then email out to the users who requested the PDFs? I do not have the ability to setup a robot at present, and the PDFs are not immediately needed for each PDF request so I am trying to come up with a workaround.

    If this is the case, do you have a recommended place I start tweaking the script?

    This tweak would allow those using WebDirect but not on a higher budget scale to successfully get PDFs without the higher cost associated with have a robot machine running.

    • JanSTP says:

      Hi Evan,

      If there is no need to directly create the PDF it is off coarse possible to do it without a robot.
      When someone requests a pdf, just create a record in a queu table with the ID of the pdf to create and his email for example.
      When a user logs in with FileMaker Pro, you can go to all unprocessed records in the queu, create the pdf’s and send them out.
      So this would be very easy to accomplish, you don’t need any ‘trigger-script-on-other-client’ functionality for that… just create a record in a table.

      Good luck with your project!

      Grts,

      Jan

  8. Christoffer says:

    Hi Jan

    First of, fantastic work, I’ve implemented it into several of our existing databases.

    Although, I am wondering whether or not the Robot can handle, if a client requests downloading/exporting a specific file from a container field, since WebDirect does not support this feature particularly well.

    I am just curious before beginning to script my way through this.

    Best regards

  9. […] Een voorbeeld van PDF aanmaak in WebDirect via een robot staat nu op modularfileMaker.org. […]

Leave a Reply

Your email address will not be published. Required fields are marked *