5 Replies Latest reply on Aug 17, 2012 4:51 AM by disabled_nvanhaastrecht

    Inserting PDF in container field

      In an invoicing database I have a script for creating a pdf of the invoice, store it on my harddisk and insert this pdf into a container field.

      In FMP9 this works but in FMP12 the inserting of the pdf file script step fails. I will appreciate any help on this.


      I use a script $variable for storing the filename, including path, using local path reference. Same $variable is used for both script steps.


      I use the following script steps:


      1. Save records as PDF
      2. Insert PDF
        • 1. Re: Inserting PDF in container field

          I do this in v12 without any problem.  Can you post the script so we can see it?  I'm sure we can help you figure out what is happening.

          • 2. Re: Inserting PDF in container field


            Commit Records/Requests

            [ No dialog ]
            Allow User Abort [ Off ]
            Set Variable [ $Factuur; Value:Facturen::InvoicePDFfilename ] If [ Factuurartikelen::factuurnummer ]

            Go to Related Record [ From table: “Factuurartikelen”; Using layout: “Factuur” (Factuurartikelen) ] [ Show only related records; New window ]

            Sort Records [ Keep records in sorted order; Specified Sort Order: Factuurartikelen::factuurnummer; ascending Factuurartikelen::huidige week; ascending
            Factuurartikelen::productnaam; ascending ]
            Restore; No dialog ]

            Show Custom Dialog
            [ Title: "Alert"; Message: "There are no line items to display."; Default Button: “OK”, Commit:

            “Yes” ] Exit Script [ ]

            End If
            Print Setup
            [ Orientation: Portrait; Paper size: 8.26" x 11.69" ]

            [ Restore; No dialog ]
            If [ not Facturen::InvoicePDF ]

            Save Records as PDF [ File Name: “$Factuur”; Records being browsed ]
            Document - Title: "Factuur " & Facturen::factuurnummer; Subject: "Facturering"; Author: "Creative Engineer";

            Compatibility: Acrobat 5 and later ]
            Pages - Number Pages From: 1; Include: All pages ]
            Security - Printing: High Resolution; Editing: Any except extracting pages; Enable copying; Enable Screen

            Reader ]
            Initial View - Show: Pages Panel and Page; Page Layout: Single Page; Magnification: 100% ]

            [ Restore; No dialog ]
            Close Window [ Current Window ] Insert PDF [ “$Factuur” ]


            Close Window [ Current Window ]

            Show Custom Dialog [ Title: "File already saved"; Message: "This PDF file for "& $Factuur&" has already been saved. If you want to save a new version first delete the previous file from this window below."; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]

            End If



            The pdf file is created but not inserted in the container.

            • 3. Re: Inserting PDF in container field

              Maybe add a Go To Field script step that points to the container field placed before the Insert PDF step so that FileMaker can determine where to put the PDF. From the script its not clear where the PDF should go.

              1 of 1 people found this helpful
              • 4. Re: Inserting PDF in container field

                Can you debug this and give me the value of $Factuur?  And also what OS are you using?

                • 5. Re: Inserting PDF in container field

                  Thanks everybody,


                  Togther you have brought me to the answer.


                  In FMP9 I worked with the insert file script step and I worked with the "file:..." pathname structure.


                  In FMP12 you have other containertypes dependant how you configure them on your layout. The insert scriptstep must correspond to this configuration. If your container is not configured as PDF than the insert PDF scipt step does not work.


                  Also for "Insert PDF" you must use the "image:..." filepath structure.


                  The other thing I had to add was the "go to field" scriptstep.


                  Many thanks