2 Replies Latest reply on Nov 10, 2009 7:23 AM by gkaiseril

    How do I show page numbers using code?

    Jim Lomax Level 1

      I have an application that creates a PDF document in code from a Word document (using the Adobe PDF printer).   it then add a "signature page" using a pre-existing pdf document with signature fields and adds a certifying signature, and then displays the document to the user in an embedded Acrobat 9.1 control so that the user can sign the document.   What i want is that the document displays (and prints) page numbers.    I know how to add them in a Footer using Acrobat, but that is not an option here since the document is already certified when the user sees it so is 'locked' and anyway I would not want to rely on the user to do this.    So what i need to know is how using the COM interface of JavaScript I can set page numbers to be displayed.   I have tried using the javascript setPageLabel but have not made it work.

      I have also tried showing the page number on the signature page template but though it shows on that page it does not apply to the rest of the document and the page numbering is wrong (it always says 1 of 1 even if there are 15 pages before it in the final document).

       

      I would be grateful for any help,

      thanks,

      Jim

        • 1. Re: How do I show page numbers using code?
          CésarCosta

          Hi Jim

           

          I have the same needs and I would like to know if you found the solution. If yes, can you please share the created code?

           

          thanks in advance,

           

          César

          • 2. Re: How do I show page numbers using code?
            gkaiseril MVP & Adobe Community Professional

            You will have to have an Acrobat JavaScript that creates a unique field on each page and inserts the number of the page into the created field's 'defaultValue' and 'value'. You are asking for quite a bit of work for free and not providing much information about how the final product has to look.

             

            You could also use the 'addWaterMarkFromText' method.

             

            There are examples of how to add fields, format Fields, in the Adobe Acrobat JS API Reference that covers creating scripts, adding fields, accessing page numbers, setting values, setting field formats by script.