7 Replies Latest reply on Apr 30, 2009 8:25 AM by TSGal

    Naming a PDF



      Naming a PDF


      I want to save a record as a PDF, send it to a file path that is a folder on a share drive and give it the name of a field in the record. Please help. I just can't get the name of the record on the file.



        • 1. Re: Naming a PDF

          Hi Fratco,


          I take it you are running a script to save the record as a PDF?


          If so you want to set the file path and file name in a variable before teh Save Records as PDF step and then reference that step when saving the PDF.


          So the basic steps would be:


          Set Variable [ $FilePath; Value:"File:Network/File/Path/" & YourFileNameField & ".pdf" ] 
          Save Records as PDF [ File Name: “$FilePath”; Current record ]  


          I hope this helps 


          • 2. Re: Naming a PDF

            I am almost there, but am having trouble defining FilePath. I think I have the Value correct. The record is identified by the field "Company", the file (table) is "Sales" and the drive that I want to save it to is "P" on our server in a folder called "Payroll Quotes".


            Each time the sales team creates a quote I want to save it as a PDF so that if they make changes I have a copy of the previous record.


            Thanks again for your help.

            • 3. Re: Naming a PDF

              A good tip to help work out the exact file path is to click 'Specify output file' in the Save Records as PDF script step and click Add File in the dialog and navigate to where you want to store the file, make up a name and click 'Save'.


              This will then give you the full path, you just need to remove the file name and paste the whole thing into teh $FilePath Variable and then calculate your file name. 


              Does this help? 

              • 4. Re: Naming a PDF

                Still having problems  - I feel so close. Here is what my script looks like:


                Go to Layout ["Quote Records" (Sales)]

                Set Variable [$P; Value: "Filewin:/P:/Payroll Quotes/" & Sales::Company & ".pdf"]

                Save records as PDF [Restore; No Dialog; "PDF"; current record]


                The result is that is saves it to the P drive in the folder Payroll Quotes, but does not give the PDF the Company name as the name of the PDF.

                • 5. Re: Naming a PDF
                     Just to double check, are you specifying the variable name '$P' in the 'Specify output file' in the Save Records as PDF script step?
                  • 6. Re: Naming a PDF
                       When I do that I get an error message that says that the file can't be saved on this disk. When I have it the way I sent you, it works but does not save the file with the company name (the field).
                    • 7. Re: Naming a PDF



                      Thank you for your posts.


                      Create a folder on your local drive (C: drive?) named "Payroll Quotes".  Change your Set Variable command to use the C: drive instead of P: drive, leaving everything else alone.  If the file is created successfully on the C: drive, then there may be some permission issues on the P: drive.


                      Also, make sure your Sales::Company field has information in the field.  If so, make sure there are no slashes, return, or other characters that may interfere with the path name.


                      Create a new table (TEST) with one text field (INFO)  and one record (TEST).  Duplicate your original script, but change the Set Variable step to use this field.  Try it with the C: drive first, and then the P: drive.



                      FileMaker, Inc.