5 Replies Latest reply on Aug 28, 2016 6:47 AM by psijmons

    Print layout to PDF (mac/win)

    marksystech

      Hi All,

       

      I'm close to having a PO system working for a customer.  They desire email notification to certain people that PO has been created.  What I would like to do is to print the PO using the layout I've created to a temp file then email a copy of that to each person on the notification list.

       

      This app will run on FileMaker server and must work in both Mac/Win filemaker.  So I'm wondering about generating the PDF file. 

       

      On a mac I can set the print options and even specify a PDF file name.  What I cannot seem to do is to specify where it should be saved and I need to know this so the email part of the script can attach the file to the outgoing emails.

       

      Also I am wondering about Windows ability to generate PDFs.  I know Mac is built in, windows I seem to think you need to select a specific PDF writer to print to.

       

      There is an alternative:  The FileMaker server at the client runs on a Mac.  I could setup a script to run on the filemaker server that regularly scans for submitted PO's, prints them to PDFs and then emails them to the people wanting notification.  This would remove the ambiguity from the local machines and potential differences between mac and win.

       

      Anyway the questions are:

       

      1) How can I print a layout to a PDF from a script and specify where to save the PDF to as part of the script so email script action can send it?

      2) What will be needed to make this work on the server?  I'm thinking this is probably my safest route.

       

      I can't use the export to PDF as that just seems to do a record set.  I need the formatted layout.

       

      Any suggestions would be welcome!  And thank you in advance!

        • 1. Re: Print layout to PDF (mac/win)
          philmodjunk

          Don't use Print use Save as PDF.

          Generate the needed file name and file path (to the temp folder) by using something like:

           

          Set Variable [$Path ; Get ( TemporaryPath ) & "YourFileNameHere.PDF" ]

           

          You can then specify $Path as the location to which you are saving the PDF in the Save as PDF step and as the path to the attached file in a Send Mail script step to send out an email to your recipients with the PDF as an attachment.

           

          This is then fully cross platform. It'll work on both Mac and Windows systems.

          2 of 2 people found this helpful
          • 2. Re: Print layout to PDF (mac/win)
            marksystech

            Thank you so much phil.  I searched but did not find the save command.  I will work on it this weekend.

            • 3. Re: Print layout to PDF (mac/win)
              philmodjunk

              As a script step, it's called "save records as PDF". In the new scripts workspace you can simply type in "save" and it will appear in a menu of other matches. In the earlier versions' script editor, you can find it in the Records category.

               

              As a Menu Option, it's in the File menu and labeled: "Save/Send Records as..." with "pdf" as an option that appears in a sub menu.

              • 4. Re: Print layout to PDF (mac/win)
                CarstenLevin

                Hi Mark,

                 

                The best thing will probably be to have the PDF generated and let it be sent from a central function. From the server, with a server schedule.

                 

                Sending via email client has some important disadvantages:

                • The solution will not know if the message was really sent. If the user canceled.
                • When doing it from the client computer the sender (from) may not be well controlled.
                • When sending from a client computer you may find that smtp or other tech. problems make the sending fail.

                So you se, I find this to be create a situation with many open ends.

                 

                The easiest would be to let the server create the PDF and send the email. But here the problem is that FMS 15 can not create emails. This is one of the most "asked for" features form the community.

                 

                So: Let a client create the pdf and store it in a container field. And then let a server schedule export the pdf and send the email.

                You could also have a central robot creating and sending the pdf.

                 

                Best regards

                 

                Carsten

                • 5. Re: Print layout to PDF (mac/win)
                  psijmons

                  Test your PDF layouts when generated on both platforms. They may need some tweaking or design two layouts, one for each platform and let the script go to layout based on Abs ( Get(systemplatform) ) = 1, go to mac layout, =2 go to windows layout