6 Replies Latest reply on Nov 3, 2012 12:46 PM by RickWhitelaw

    Creating/storing pdf files on the fly...

    pauhana658

      Title

      Creating/storing pdf files on the fly...

      Post

           Another day, another wall, another bloody nose...someday, I'll get a handle on Filemaker Pro's impressive scripting capabilities, but alas, I'm still thinking in 4D code, a 20-year habit that is proving tougher to kick than my 8-shots-a-day espresso habit. 

           Today's wall is built of pdf bricks. Every time I print or email an invoice, I save a pdf of it to the hard drive. I can then drag this into a container field. But this is tedious and fraught with the potential for errors, such as dragging the wrong pdf or simply forgetting to drag the pdf file after printing/emailing. 

           Is there some way to automate this process so that when an invoice is printed or emailed, a new record is created in the "pdf files" table and the pdf is saved to the "pdf" field?

           (And speaking of dragging and dropping, I'm not sure if this topic has been broached before, but if I can drag and drop a file into a container field, why can't I drag and drop a file into a text field to capture the entire file path in the field? Or can I and I just haven't set the right checkbox for doing so? This was a terrifically useful feature in the Billings Pro invoicing program I was using before.)

           Thanks!

        • 1. Re: Creating/storing pdf files on the fly...
          pauhana658

               Related to the above, is it possible to click on a container field and have the contents displayed in a separate window in order to show the entire pdf in readable size? Or click on the container field and have the pdf (or word file) open in an appropriate program? I'm also storing Word documents in a container field to help keep track of work associated with each invoice. It would solve all kinds of organizational problems for me if I could have a list of files (each in a separate record, of course) and simply click the field to open the file.

               Thanks!

          • 2. Re: Creating/storing pdf files on the fly...
            JimMac

                 Create a script to Export the invoice to a "Tempory folder" or directory with a unique name.  Then import that pdf file into a container field to "embed' the file in your database.  If you are FMP12 you can elect to not embed the pdf but store the file path in the container field.

                 But.... 

                 I ask why do that unless the pdf is being changed, like a client signiture has been added to the pdf.  You can always display the layout that generated the pdf, with non modifiable fields, which is faster and doesn't slow down an embedded pdf shifts during sorts.

                 It sounds like you want a "snapshot" of the invoice for easy reference or proof.  Remember a pdf file is just a useful file type like jpg, mov, png...etc. and FMP contains the information in re-usable form.

                 Drag and drops depends on the computer platform you are using.

                 Jim...

            • 3. Re: Creating/storing pdf files on the fly...
              pauhana658
                   

              It sounds like you want a "snapshot" of the invoice for easy reference or proof.  Remember a pdf file is just a useful file type like jpg, mov, png...etc. and FMP contains the information in re-usable form.

              Yep, that's exactly what I'm trying to accomplish. Many of my clients often request changes to invoices -- sometimes multiple times -- in everything from contact person to due date to line-item descriptions, and I want to keep track of all changes. I understand that FMP provides "current" information, but I also need historical information for tracking purposes. I thought a list of pdf files would be the easiest to implement and browse, but it appears not to be the case. I'll just continue to drag and drop the files into FMP. But thanks for the suggestion!

              • 4. Re: Creating/storing pdf files on the fly...
                JimMac

                     I have had to do that same thing.  The way i did it is to make a new Table that contains the fields required to produce your invoice, plus a timestamp and sequence number linked back to that client.

                Thus....

                     You are historically saving the data and time you produced the original pdf invoice.  You then can recall each variation of the pdf invoice for a client and review any or all changes chronilogically or reproduce it without actuall saving the pdf file.  At the end of a record keeping period, I then easily purge or delete the timestamp'd data from each client too.

                But...

                     You can still do it  your original way. In a script....

                     Export the pdf [for email....etc]

                     Select the Container in your pdf historical table

                     Import into that Container the newly created pdf file [immeditately]

                Done....

                     When doing this change the exported pdf file name needs to be unique to avoid overwriting a file.

                     _____

                     Drag/Drop a URL to a container will save the URL path into that Container...  on my Mac.

                     Jim...

                • 5. Re: Creating/storing pdf files on the fly...
                  PeteTheFreeze

                       Hey Pauhana,

                       I think you do not need to drag and drop if you use the solution suggested by Jim.

                       Save the file to the temporary folder.

                       Go to Field["container field"] (make a new record in the table pdf-saves if you want and make sure it is on the current layout)

                       Insert file[temp folder & "file name.pdf"]

                       Or am I missing something?

                        

                  • 6. Re: Creating/storing pdf files on the fly...
                    RickWhitelaw

                         If considering saving to Temporary Path, keep in mind all contents of the folder are purged when exiting FileMaker. Then any reference to the content stored in a container field is no longer valid.