3 Replies Latest reply on May 9, 2017 3:09 AM by Bernd Alheit

    Page number added as a text field jumps when user clicks it

    aijazf8064518

      Hi,

       

      I have added a text field at the end of the pdf page (through a javascript) that adds page number to the pdf. I have made this text field read only. However, after the PDF is generated, whenever the user clicks on the page number, it jumps from its location. Is there a way to make it stable so that it doesn't jump on click? I tried using flattenpages(), but it disables the links. Is there any other solution?

       

      My code:

       

      var inch1 = 2570;

            for (var p = 1; p < doc.numPages; p++) {

            // put a rectangle at .2 inch, .2 inch

            var aRect4 = doc.getPageBox( {nPage: p} );

            aRect4[0] += .2*inch1;                  // from upper left corner of page

            aRect4[2] = aRect4[0]+.5*inch1;   // Make it .5 inch wide

            aRect4[1] -= .2*inch1;

            aRect4[3] = aRect4[1] - .2*inch1; // and .2 inch high          

            var f4 = doc.addField({

            cName:  "p."+p,

            cFieldType: "text",

            nPageNum: p,

            oCoords: aRect4 });

            f4.textSize = 8; 

            f4.textColor = color.black;     

            f4.strokeColor = color.white;

            f4.textFont = font.Helv;

            f4.value = String(p);                // page numbering is zero-based

            f4.readonly = true;

            f4.borderStyle = border.u;

      }