10 Replies Latest reply on Jan 18, 2011 2:18 PM by FentonJones

    Print PDF from multiple tables



      Print PDF from multiple tables


      I need to print out an invoice and attach all receipts to it. So far my method sort of works:

      1) Make a PDF of the invoice and count the number of pages (so page numbers are correct)

      2) Make a PDF of the receipts and attach to the invoice

      3) Show the PDF in a webviewer for double checking

      4) Ask the user to cancel (return to the invoice form) or continue (assume they printed from the webviewer, save another copy of the PDF with the invoice number, and mark the invoice as being printed)

      is there a better way to do this?

        • 1. Re: Print PDF from multiple tables

          Not sure what you mean by "attach all reciepts to it"

          • 2. Re: Print PDF from multiple tables

            I have lineItems for the invoice. One of the fields is a container for scanned receipts. What I would ultimately like (and can achieve in the cluncky way above) is a PDF with the invoice and then scanned receipts. Does that make more sense?

            • 3. Re: Print PDF from multiple tables

              In later versions of FileMaker you can "append" a PDF to an existing PDF file. So you can do the Invoice first, then append the Receipts. I believe it starts a new page with the appended.

              The mechanism to do the above automatically would be to calculate a valid file path, as an absolute path, using FileMaker syntax, set it into a local script Variable, Save As PDF [$path]. Then go to the other layout, Save As PDF [$path, Append] (a checkbox on the left of the dialog). Calculation for the $path Variable (result Text, Storage, [x] Do not store)

              Let ( [
              prefix = Case ( Abs ( Get(SystemPlatform)) = 1; "filemac:"; "filewin:")
              folder_path = Get (DesktopPath);
              file_name = "some field name.pdf" // however you want to do it, without overwriting existing?
              prefix & folder_path & file_name

              • 4. Re: Print PDF from multiple tables

                P.S. The OS Web Viewer syntax (on a Mac) looks like:
                file://Macintosh HD/Users/fej/Desktop/Screenshot.pdf
                file:///Users/fej/Desktop/Screenshot.pdf  // but the above is closer to a FileMaker syntax path

                • 5. Re: Print PDF from multiple tables

                  Absolutely - that's how I did it. The question now that I have the"full" PDF is how to show it to the user before printing? I've donw this at the moment through the webviewer pointing to the pdf exactly how you describe. The PDF shows up beautifully in the viewer and the user can print it from in there but there is no way to know that. I've set up two buttons "cancel" and "continue" which assume that the user did not and did, respectively, print the report. This seems clumsy to me. Is there a better way?


                  Thanks for you help!

                  • 6. Re: Print PDF from multiple tables

                    In what way do you consider it clunky? The user must click a button, in order to tell you for sure that they did it (printed? sent the PDF?). But you would need to make sure that they could not leave the "viewing" layout by some other means.

                    • 7. Re: Print PDF from multiple tables

                      I think it's clunky because the user could choose not to print the PDF (from the browser) and still click "continue"(or vice versa). I would prefer the solution to "know" if the PDF was printed rather than the user having to "tell" it. I'm just not sure there's a way to do this...

                      • 8. Re: Print PDF from multiple tables

                        You could Print without dialog, or you can capture a "Cancel" of a Print Dialog, if you Set Error Capture ["On"]. But other than that...

                        • 9. Re: Print PDF from multiple tables

                          But the print command comes from within the WebViewer - how can I access the PDF viewer commands in the solution? I'm confused - the "print" script will not print the PDF as if the user printed it from the webviewer's PDF viewer. Does that make sense?

                          • 10. Re: Print PDF from multiple tables

                            I supposed you could print the Web Viewer itself. But I have no idea what quality you'd get out of that; and there is a 111 inch layout length limit. Also, you'd have to write to the WV to change the default alignment to top instead of center.

                            On a Mac I would just print the file directly, using AppleScript with the Unix "lpr" command, which prints directly to the default printer, or to whichever printer you specify.

                            Or you could just redo the PDF, but check the [x] open file option. Then they could just Print from whatever app opened the PDF. Since they'd already clicked the button to say they were going to print it, that would be OK.