4 Replies Latest reply on Mar 5, 2015 7:16 AM by philmodjunk

    How can create table of contents of PDF File?

    happyho

      Title

      How can create table of contents of PDF File?

      Post

      Hi All,

      I am new in FM, Now I am using FM 13 Trial.

      I am  trying to create Table of Contents or Index pages before I export PDF file. I read one post on the internet. It shows me the code: 

      Show All Records 
      Loop 
              Enter Preview Mode 
              Go to Record/Request/Page [ Last ] 
              Set Field [ Products::gPage; Get ( PageNumber ) ] 
              Enter Browse Mode 
              Go to Record/Request/Page [ Last ] 
              Set Field [ Products::Page; Products::gPage ] 
              Omit Record 
              Exit Loop If [  not Get ( FoundCount ) ] 
      End Loop 
      Show All Records

      but I am afraid it will take long time to do because the found set nearly 100 records. In that way, I have to omit one by one, It is not good when the found set is large.

      Is the any different way to do?

      Many thanks

       

        • 1. Re: How can create table of contents of PDF File?
          bigtom

          The script you have showing just seems to be updating page number from the back to front and dropping of records as they are updated.

          Either way, Filemaker is fast and 100 records with a loop and a few fields set is nothing that should take much time at all. I did something similar just today with 300 records and it took all of 3 seconds to complete. This may be the limit of your computer if it is taking a very long time.

          • 2. Re: How can create table of contents of PDF File?
            philmodjunk

            Entering Preview mode 100 times to render a 100 page report will definitely take a while.

            Sometimes other methods can be used, sometimes not.

            Are there any sliding fields in your layout?

            If you don't have fields set to slide up/ reduce enclosing part, each record takes up the same amount of space in your report and you may then be able to calculate each record's page number from its record number without having to preview the report first.

            • 3. Re: How can create table of contents of PDF File?
              happyho

              To PhilModJunk,

               

              I have fields set to slide up/ reduce enclosing part. What will I do in that case?

               

              Thanks

              • 4. Re: How can create table of contents of PDF File?
                philmodjunk

                Then I see no alternative but to preview your layout repeatedly in order to identify the page numbers associated with each record. sad

                Hmmm, but sometimes the morning caffeine is slow to kick in....

                That still may be your only practical option, but at least in theory, it IS possible to compute the number of lines of text that "fit" inside a sliding field via a script. This also uses preview mode and sliding fields so it might not save you any time and might take even more, but if you have a variety of report layouts where you need this and only a few sliding fields, you might use this method to determine the number of lines for just that one (or a few) fields at the time that new data in this field is committed via a script. Then, it might still be possible to compute page numbers from a record's record number. This is not a simple approach and basically combines two of the more awful Filemaker Kludges around but, on paper at least, it might just work for you.