24 Replies Latest reply on Jun 14, 2016 12:33 PM by sargums46564804

    How do you Return string as multi line text?

    sargums46564804 Level 1

      I am trying to display a returned string as a multi liner instead of single liner to be displayed on a page in Adobe Acrobat. Var str = "" returns one line obviously. please advise.

        • 1. Re: How do you Return string as multi line text?
          maxwyss Level 4

          You add "\r" for linebreaks.

           

          (if that does not lead to the desired result, use "\n" instead).

           

          Hope this can help.

          • 2. Re: How do you Return string as multi line text?
            gkaiseril MVP & Adobe Community Professional

            One has to use the custom JavaScript calculation option.

             

            Since you use the term "return" are you using a defined function to create the string?

             

            One only needs to concatenate the line feed or carriage return to the string at the place where one wants the line break to appear.

             

            JavaScript Control Characters in MDN JavaScript Reference.

             

            We mostly use "\r" for carriage return and "\n" for a new line. These are non-printable control codes. There is additional codes for horizontal tab

            • 3. Re: How do you Return string as multi line text?
              sargums46564804 Level 1

              Hi,

               

              Thank you for your response.  I am trying to execute this but the changes are not saved for some reason.  I may have to post on this forum regarding this problem.  I will keep trying and let you know if it works.

              S

              • 4. Re: How do you Return string as multi line text?
                sargums46564804 Level 1

                Hi,

                 

                I have a form where a user is entering information in a box.  I want whatever the user is entering to then be outputted on the pdf page in multiple lines instead of one line. after they hit ok.  Thx for your help.

                 

                S

                • 5. Re: How do you Return string as multi line text?
                  Bernd Alheit Adobe Community Professional & MVP

                  Use the option "Multi-line" in the text field.

                  • 6. Re: How do you Return string as multi line text?
                    gkaiseril MVP & Adobe Community Professional

                    See Concatenate Fields for a working example for combining a number of fields into on line and multiple line fields.

                    • 7. Re: How do you Return string as multi line text?
                      sargums46564804 Level 1

                      How does one add a "multi-line" option in the text field.  I am a newbie.

                      • 8. Re: How do you Return string as multi line text?
                        Karl Heinz Kremer Adobe Community Professional

                        Bring up the field's properties dialog, then go to the "Options" tab and select "Multi-line":

                         

                        2016-06-13_15-19-28.png

                        • 9. Re: How do you Return string as multi line text?
                          sargums46564804 Level 1

                          Oh, I see what you mean.  However, the form is not in the pdf itself.  It is part of an action wizard (https://acrobatusers.com/assets/uploads/actions/Document_Numbering_Action.pdf) where the user inputs the content for the exhibit label.  I may have improperly called this a form.  My apologies.  I am referring to the window which is generated when the action is triggered to allow the user to enter content for the exhibit label which will then be displayed on the pdf itself.  I am just building off the java script in this action wizard.  If you look at https://acrobatusers.com/assets/uploads/actions/Document_Numbering_Action.pdf, it may become more clear what it is I am trying to do.  I just want the output to show as a multi not single line Exhibit on the pdf.  Thanks.

                          • 10. Re: How do you Return string as multi line text?
                            Bernd Alheit Adobe Community Professional & MVP

                            Use "\n" between the text strings.

                            • 11. Re: How do you Return string as multi line text?
                              sargums46564804 Level 1

                              Tried:

                               

                              {

                                                                                          type: "edit_text",

                                                                                          item_id: "LPfx",

                                                                                          variable_Name: "strLabelPrefix",

                                                                                          width: 129,

                                                                                          height: 43                                                                                                                                                                                                       char_width: 8,

                                                                                          multiline: "true",

                                                                                      },

                               

                              but it only returns 2 lines instead of 3 and there is an unwanted return between line 1 and line 2.  Any advise?

                              • 12. Re: How do you Return string as multi line text?
                                Skemicle Level 3

                                you could use a do while loop do return the string x number of times..

                                 

                                var n = 0

                                do while (n < x)

                                 

                                 

                                 

                                n = n++

                                loop

                                 

                                I'm not sure if this is what you want but it is a possibility.

                                • 13. Re: How do you Return string as multi line text?
                                  George_Johnson MVP & Adobe Community Professional

                                  This line:

                                   

                                                            multiline: "true",

                                   

                                   

                                  Should be changed to this:

                                   

                                                            multiline: true,

                                  • 14. Re: How do you Return string as multi line text?
                                    sargums46564804 Level 1

                                    oK, so multiline: true, worked such that the code reads:

                                     

                                                                                           {

                                                                                                type: "edit_text",

                                                                                                item_id: "LPfx",

                                                                                                variable_Name: "strLabelPrefix",

                                                                                                width: 129,

                                                                                                height: 43                                                                                                                                                                                char_width: 8,

                                                                                                multiline: true,

                                                                                            },

                                     

                                    Note, I also have strLabelPrefix:"\n", before the code above. (I tried strLabelPrefix:"\r" too).

                                     

                                    However, if I enter:

                                     

                                    "Company XYZ

                                    FEI XYZ

                                    5/2/16 to 5/6/16"

                                     

                                    It outputs the following on the pdf:

                                     

                                    "Company XYZ

                                     

                                    FEI XYZ"

                                     

                                    Notice, line 3 is not there at all.  Also, there is an undesired return between line 1 and 2.

                                     

                                    Getting closer...thanks.

                                    • 15. Re: How do you Return string as multi line text?
                                      George_Johnson MVP & Adobe Community Professional

                                      Can you show the code that retrieves that value of the field of the custom dialog? What you've show just shows how the field is set up.

                                       

                                      What is the intended purpose of the following line?:

                                       

                                      variable_Name: "strLabelPrefix",

                                       

                                      I don't see how it would have any effect.

                                       

                                      Also, what OS are you testing this with? Note that you will see \r as the carriage return/new line character on the Mac and the \r\n combination on Windows. So what you probably need to do is convert "\r\n" to just "\r" when you use the value that you retrieve from the custom dialog field.

                                       

                                       

                                      • 16. Re: How do you Return string as multi line text?
                                        sargums46564804 Level 1

                                        Hi George,

                                         

                                        Here is an excerpt from the code:

                                         

                                        //</CodeAbove>

                                            global.DocNumAction =

                                            {

                                                result:"cancel",

                                                DoDialog: function(){return app.execDialog(this);},

                                                strHorzPos:"PosR",

                                                nMarginX:"0.5",

                                                strVertPos:"PosT",

                                                nMarginY:"0.5",

                                                strLTyp:"",

                                                strBackgroundCol:["Transparent"],

                                                strExmp:"",

                                                strLabelPrefix:"\n",

                                                bIncludeDocNum:false,

                                                strInitDocNum:"1",

                                                bIncludePageNum:false,

                                                strPageNumPrefix:"",

                                                bPageNumPostfix:false,

                                                strBoxStateSel:"Unlk",

                                                strPgRangeSel:"rAll",

                                                strStrtPg:"",

                                                strEndPg:"",

                                                bSaveWPostFx:true,

                                                strSavePrefix:"",

                                                strDocNumInName:"None",

                                                strSavePostfix:"",

                                                strSvFl:"",

                                                GetRadioSel:function(oRslts,aCtrls){

                                                  for(var strRtn=aCtrls[0];aCtrls.length>0;strRtn=aCtrls.pop()){

                                                    if(oRslts[strRtn] == true)

                                                      return strRtn;

                                                  }

                                                  return "";

                                                },

                                                SetListSel:function(list,path){if(path.length == 0) return;

                                                eval("list[\""+ ((typeof path.join != "function")?path:path.join("\"][\"")) + "\"] = 1")},

                                                GetListSel:function(oLstRslts,path){

                                                   for(var item in oLstRslts){

                                                      if( ((typeof oLstRslts[item]=="number")&&(oLstRslts[item]>0))

                                                         || this.GetListSel(oLstRslts[item],path) )

                                                       {path.push(item);return true;}

                                                   }

                                                   return false;

                                                },

                                                nCurPage:0,

                                                nNumPages:1,

                                                bHidden:true,

                                                SetDocNumber:DoSetDocNumberFn,

                                                SetFileName:DoSetFileName,

                                                strFileName:"Test.pdf",

                                                oDocNumParams:oDocNumTypes,

                                                initialize: function(dialog)

                                         

                                        The intended purpose of strLabelPrefix:"\n" is to store the information entered by user on what they want the label text to be on the pdf (i.e., "Company XYZ***" as stated below.  I just noticed that entering

                                         

                                        "Company XYZ

                                        FEI XYZ

                                        5/2/16 to 5/6/16"

                                         

                                        actually does output all lines on the pdf but you have to open up the text box to see it all. I am now trying to figure out how to have this text box default to a larger height.

                                         

                                        I noticed there was code for label width but not label height so I added var nLabHeight = 100; //, as shown below

                                         

                                        // Width of label

                                        var nLabWidth = 2000;  //

                                        var nLabHeight = 100; //

                                         

                                        but I don't know how to incorporate nLabHeight into the rest of the code with nLabWidth, as shown below.

                                         

                                        var rcRot = [];

                                                var nAlign;

                                                var nMargX = Number(global.DocNumAction.nMarginX) * 72;

                                                switch(global.DocNumAction.strHorzPos)

                                                {

                                                   case"PosL":

                                                     strAlign = "left"; // Left Aligned Text

                                                     rcRot[0] = nMargX;

                                                     rcRot[2] = nMargX + nLabWidth;

                                                     break;

                                                   case"PosC":

                                                     strAlign = "center"; // Left Aligned Text

                                                     rcRot[0] = rcPage[2]/2 - nLabWidth/2;

                                                     rcRot[2] = rcPage[2]/2 + nLabWidth/2;

                                                     break;

                                                   case"PosR":

                                                     strAlign = "right"; // Left Aligned Text

                                                     rcRot[0] = rcPage[2] - nMargX - nLabWidth;

                                                     rcRot[2] = rcPage[2] - nMargX;

                                                     break;

                                                }Capture2.PNGCapture1.PNG

                                        • 17. Re: How do you Return string as multi line text?
                                          George_Johnson MVP & Adobe Community Professional

                                          OK, so it looks like the code is used to prompt the user for some information and then create a text comment, is that right? Can you show a screen shot of the custom dialog that prompts you to enter the data? I think the key to making this work is to do what I mentioned earlier, replace any "\r\n" combinations with just "\r" when setting that value of the text comment. If you show the part of the code that creates the text comment, we could suggest the specific code to do this.

                                          • 19. Re: How do you Return string as multi line text?
                                            sargums46564804 Level 1

                                            I believe the part of the code about text entry is strLabelPrefix:"\n",

                                             

                                            I tried \r but nothing diff. came out of it.

                                            • 20. Re: How do you Return string as multi line text?
                                              George_Johnson MVP & Adobe Community Professional

                                              Changing that line isn't what you need to do. You need to modify that code that's used to create the text annotation. Without seeing that part of the code, or at least the code that retrieves that values from the custom dialog, it's difficult to suggest a specific modification.

                                              • 21. Re: How do you Return string as multi line text?
                                                sargums46564804 Level 1

                                                I was just trying to modify a code out there that already exists ((https://acrobatusers.com/assets/uploads/actions/Document_Numbering_Action.pdf) .  It is not giving me what I want though.  I want it to show:

                                                 

                                                "Company XYZ

                                                FEI XYZ

                                                5/2/16 to 5/6/16

                                                Exhibit 1 pg 1 of n"

                                                 

                                                on the pdf without spaces.  Eventually, I also want to remove the option for the outputted label to be left unlocked.  I always want it flattened.  I don't want to give the user a choice at all.

                                                 

                                                Thank you for your help.  Here is the entire code with a few modifications I have already made to the original action wizard:

                                                 

                                                /////////////////////////////////////////////////////////////////////////

                                                //

                                                //   Document Numbering (i.e. Labeling) Batch Processing (Actions) script

                                                //   by Thom Parker, WindJack Solutions, Inc.  October 2010

                                                //      www.windjack.com, www.pdfscripting.com

                                                //   For Adobe Systems Inc., www.adobe.com

                                                //

                                                //         NOTE: This JavaScript code is intended soley for use in an

                                                //               Action (Batch Sequence)script.  It will not operate

                                                //               within a document/form field script or as a folder level script.

                                                //  

                                                //   This script displays a custom popup dialog for each file operated on by the Action

                                                //   The user enters information on the how the Document numbers should be applied to the

                                                //   document pages, i.e., position, content, etc.  As well as information on whether or not

                                                //   the script should save the file and/or extract the labeled pages into a separte document

                                                //   These parameters are maintained for the entire Acrobat Session.

                                                //

                                                //   Included in the parameters is a document number. This number is incremented each time

                                                //   a file is operated on.

                                                //

                                                //   Options are included for skipping the current document and for aborting the Action sequence

                                                //     

                                                //   Custom dialog created with AcroDialogs from WindJack Solutions, Inc.

                                                //

                                                //   Version 1.3 - 11/2/2010

                                                //

                                                 

                                                 

                                                 

                                                 

                                                // Width of label

                                                var nLabWidth = 2000;  //

                                                 

                                                 

                                                // Line Height

                                                var nLabLineHeight = 8; //

                                                 

                                                 

                                                 

                                                 

                                                if(typeof(global.DocNumAction) == "undefined")

                                                {

                                                    //Acrobat JavaScript Dialog

                                                    //Created by DialogDesigner from WindJack Solutions

                                                    //<CodeAbove>

                                                    var oDocNumTypes = {

                                                                  "Exhibit 1-Line":{Prefix:"Exhibit ", UseDocNum:true,UsePgNum:true,PagePrefix:" - Page "},

                                                                  "Attachment 1-Line":{Prefix:"Attachment ", UseDocNum:true,UsePgNum:true,PagePrefix:" - Page "},

                                                                      };

                                                   

                                                   

                                                    function DoSetDocNumberFn(dialog, oDlg)

                                                    {

                                                               var oRslt = dialog.store();

                                                               var strExample = oRslt["LPfx"];

                                                               if(oRslt["DocN"])

                                                                 strExample += oRslt["DNum"];

                                                           

                                                               if(oRslt["PgNm"])

                                                               {

                                                                 strExample += eval("'" + oRslt["PPfx"] + "'") + (oDlg.nCurPage + 1).toString();

                                                           

                                                                 if(oRslt["PPsf"])

                                                                   strExample += " of " + oDlg.nNumPages;

                                                               }

                                                               dialog.load({"Exmp":strExample});

                                                               DoSetFileName(dialog,oDlg);

                                                    }

                                                   

                                                    function DoSetFileName(dialog, oDlg)

                                                    {

                                                          var oRslt = dialog.store();

                                                          var strFileName = "";

                                                   

                                                          if(oRslt["SPst"])

                                                          {

                                                              // Add Document Number

                                                               if(oRslt["DnPr"])

                                                              {

                                                                  strFileName += oRslt["LPfx"];

                                                                  if(oRslt["DocN"])

                                                                      strFileName += oRslt["DNum"];

                                                               }

                                                   

                                                               // Add Prefix

                                                               strFileName += oRslt["SvPr"];

                                                           

                                                              // Add File Name

                                                           strFileName += oDlg.strFileName.replace(/\.pdf/,"");

                                                   

                                                               // Add Postfix

                                                               strFileName += oRslt["SvPs"];

                                                   

                                                              // Add Document Number

                                                               if(oRslt["DnFx"])

                                                              {

                                                                  strFileName += oRslt["LPfx"];

                                                                  if(oRslt["DocN"])

                                                                  strFileName += oRslt["DNum"];

                                                               }

                                                               strFileName += ".pdf";

                                                          }

                                                          dialog.load({"SvFl":strFileName});

                                                    }

                                                    //</CodeAbove>

                                                    global.DocNumAction =

                                                    {

                                                        result:"cancel",

                                                        DoDialog: function(){return app.execDialog(this);},

                                                        strHorzPos:"PosR",

                                                        nMarginX:"0.5",

                                                        strVertPos:"PosT",

                                                        nMarginY:"0.5",

                                                        strLTyp:"",

                                                        strBackgroundCol:["Transparent"],

                                                        strExmp:"",

                                                        strLabelPrefix:"\r",

                                                        bIncludeDocNum:false,

                                                        strInitDocNum:"1",

                                                        bIncludePageNum:false,

                                                        strPageNumPrefix:"",

                                                        bPageNumPostfix:false,

                                                        strBoxStateSel:"Unlk",

                                                        strPgRangeSel:"rAll",

                                                        strStrtPg:"",

                                                        strEndPg:"",

                                                        bSaveWPostFx:true,

                                                        strSavePrefix:"",

                                                        strDocNumInName:"None",

                                                        strSavePostfix:"",

                                                        strSvFl:"",

                                                        GetRadioSel:function(oRslts,aCtrls){

                                                          for(var strRtn=aCtrls[0];aCtrls.length>0;strRtn=aCtrls.pop()){

                                                            if(oRslts[strRtn] == true)

                                                              return strRtn;

                                                          }

                                                          return "";

                                                        },

                                                        SetListSel:function(list,path){if(path.length == 0) return;

                                                        eval("list[\""+ ((typeof path.join != "function")?path:path.join("\"][\"")) + "\"] = 1")},

                                                        GetListSel:function(oLstRslts,path){

                                                           for(var item in oLstRslts){

                                                              if( ((typeof oLstRslts[item]=="number")&&(oLstRslts[item]>0))

                                                                 || this.GetListSel(oLstRslts[item],path) )

                                                               {path.push(item);return true;}

                                                           }

                                                           return false;

                                                        },

                                                        nCurPage:0,

                                                        nNumPages:1,

                                                        bHidden:true,

                                                        SetDocNumber:DoSetDocNumberFn,

                                                        SetFileName:DoSetFileName,

                                                        strFileName:"Test.pdf",

                                                        oDocNumParams:oDocNumTypes,

                                                        initialize: function(dialog)

                                                        {

                                                            var listLTyp = new Object();

                                                            this.SetListSel(listLTyp, this.strLTyp);

                                                   

                                                            var listBkgd =

                                                            {

                                                            "Transparent": -1,

                                                                "Yellow": -1,

                                                                "Green": -1,

                                                                "Blue": -1,

                                                                "Grey": -1,

                                                            };

                                                            this.SetListSel(listBkgd, this.strBackgroundCol);

                                                   

                                                            var dlgInit =

                                                            {

                                                            "MrgH": this.nMarginX,

                                                                "MrgV": this.nMarginY,

                                                                "Bkgd": listBkgd,

                                                                "DNum": this.strInitDocNum,

                                                                "LbPR": "The Document Number is added to pages as a text annotation.  If locked, the user cannot move or edit it. \r\n If flattened it becomes part of the regular form content.",

                                                                "LSav": "If this option is not selected then the file is saved according to the rules of the Action.  \r\nIf option is set then the action should be setup to not save the file.",

                                                                "SPst": this.bSaveWPostFx,

                                                                    "Exmp": this.strExmp,

                                                                    "LPfx": this.strLabelPrefix,

                                                                    "DocN": this.bIncludeDocNum,

                                                                    "PgNm": this.bIncludePageNum,

                                                                    "PPfx": this.strPageNumPrefix,

                                                                    "PPsf": this.bPageNumPostfix,

                                                                    "tFPg": this.strStrtPg,

                                                                    "tTPg": this.strEndPg,

                                                                    "SvPr": this.strSavePrefix,

                                                                    "SvPs": this.strSavePostfix,

                                                                    "SvFl": this.strSvFl,

                                                            };

                                                            dlgInit[this.strHorzPos] = true;

                                                            dlgInit[this.strVertPos] = true;

                                                            dlgInit[this.strBoxStateSel] = true;

                                                            dlgInit[this.strPgRangeSel] = true;

                                                            dlgInit[this.strDocNumInName] = true;

                                                            dialog.load(dlgInit);

                                                            dialog.enable(

                                                                {

                                                                    "tTPg": false,

                                                                    "tFPg": false,

                                                                    "PPfx": false,

                                                                    "DNum": false,

                                                                }

                                                        );

                                                            var typeInit = {};

                                                           

                                                            for(xx in this.oDocNumParams)

                                                               typeInit[xx] = -1;

                                                           

                                                            if( (this.strStrtPg == "")|| isNaN(this.strStrtPg) || (Number(this.strStrtPg) > this.nNumPages) )

                                                            {

                                                               if(this.bHidden)

                                                                   this.strStrtPg = "1";

                                                               else

                                                                   this.strStrtPg = (this.nCurPage+1).toString();

                                                            }

                                                           

                                                            if((this.strEndPg == "") || isNaN(this.strEndPg) || (Number(this.strEndPg) > this.nNumPages) )

                                                               this.strEndPg = this.nNumPages.toString();

                                                           

                                                           

                                                            var exInit ={"LTyp":typeInit,"tFPg": this.strStrtPg,"tTPg":this.strEndPg, "sOfN":"of (" + this.nNumPages+")",

                                                                                "FlNm":"Current File: " + this.strFileName};

                                                            if(this.bHidden && this.strPgRangeSel == "rCur")

                                                            {  

                                                                  this.strPgRangeSel = "rAll";

                                                                  exInit["rCur"] = false;

                                                                  exInit[this.strPgRangeSel] = true;

                                                            }

                                                            

                                                            dialog.load(exInit);

                                                           

                                                            var exInit = {"ExPg":this.strPgRangeSel =="rFro", "DNum":this.bIncludeDocNum, "PPfx":this.bIncludePageNum,

                                                                                   "PPsf":this.bIncludePageNum,  "MrgH":this.strHorzPos!="PosC", "MrgV":this.strVertPos!="PosM",

                                                                                   "SvPs":this.bSaveWPostFx ,"SvDn":this.bSaveWPostFx,

                                                                                    "tFPg":this.strPgRangeSel =="rFro", "tTPg":this.strPgRangeSel == "rFro", "rCur":!this.bHidden};

                                                           

                                                            dialog.enable(exInit);

                                                            this.SetDocNumber(dialog, this);

                                                        },

                                                        validate: function(dialog)

                                                        {

                                                            var oRslt = dialog.store();

                                                            if(oRslt["DocN"] && ( (oRslt["DNum"] == null) || (oRslt["DNum"] == "")  || isNaN(oRslt["DNum"]) ) )

                                                            {

                                                                app.alert("If selected, the initial Value for Doc Number must be filled out with a valid integer");

                                                                return false;

                                                            }

                                                           

                                                            if( ( /^\s*$/).test(oRslt["LPfx"]) && !oRslt["DocN"] && !oRslt["PgNm"])

                                                            {

                                                                app.alert("Not Enough Label Parameters have been selected");

                                                                return false;

                                                            }

                                                           

                                                           

                                                            if(oRslt["rFro"])

                                                            {

                                                               if( (oRslt["tFPg"] == "")  || isNaN(oRslt["tFPg"])  || (oRslt["tTPg"] == "")  || isNaN(oRslt["tTPg"]) )

                                                               {

                                                                  app.alert("If selected, the Page range values must be filled out with valid integers");

                                                                  return false;

                                                               }

                                                               if(Number(oRslt["tFPg"])  > Number(oRslt["tTPg"]) )

                                                               {

                                                                 app.alert("If selected, the From page number must be less than the To page Number");

                                                                 return false;

                                                               }

                                                               if( (Number(oRslt["tFPg"])  > this.nNumPages) || (Number(oRslt["tTPg"])  > this.nNumPages)  )

                                                               {

                                                                 app.alert("If selected, the From and To page numbers must be less than the number of pages");

                                                                 return false;

                                                               }

                                                           

                                                            }

                                                           

                                                            return true;

                                                        },

                                                        commit: function(dialog)

                                                        {

                                                            var oRslt = dialog.store();

                                                            this.strHorzPos = this.GetRadioSel(oRslt,["PosL","PosC","PosR"]);

                                                            this.nMarginX = oRslt["MrgH"];

                                                            this.strVertPos = this.GetRadioSel(oRslt,["PosT","PosM","PosB"]);

                                                            this.nMarginY = oRslt["MrgV"];

                                                            var path = new Array();

                                                            this.strLTyp = (this.GetListSel(oRslt["LTyp"],path))?path.reverse():"";

                                                            var path = new Array();

                                                            this.strBackgroundCol = (this.GetListSel(oRslt["Bkgd"],path))?path.reverse():"";

                                                            this.strExmp = oRslt["Exmp"];

                                                            this.strLabelPrefix = oRslt["LPfx"];

                                                            this.bIncludeDocNum = oRslt["DocN"];

                                                            this.strInitDocNum = oRslt["DNum"];

                                                            this.bIncludePageNum = oRslt["PgNm"];

                                                            this.strPageNumPrefix = oRslt["PPfx"];

                                                            this.bPageNumPostfix = oRslt["PPsf"];

                                                            this.strBoxStateSel = this.GetRadioSel(oRslt,["Unlk","Lckd","Fltn"]);

                                                            this.strPgRangeSel = this.GetRadioSel(oRslt,["rAll","rCur","rFro"]);

                                                            this.strStrtPg = oRslt["tFPg"];

                                                            this.strEndPg = oRslt["tTPg"];

                                                            this.bSaveWPostFx = oRslt["SPst"];

                                                            this.strSavePrefix = oRslt["SvPr"];

                                                            this.strDocNumInName = this.GetRadioSel(oRslt,["None","DnPr","DnFx"]);

                                                            this.strSavePostfix = oRslt["SvPs"];

                                                            this.strSvFl = oRslt["SvFl"];

                                                        },

                                                        "Abrt": function(dialog)

                                                        {

                                                            dialog.end("Abrt");

                                                        },

                                                        "Skip": function(dialog)

                                                        {

                                                            dialog.end("Skip");

                                                        },

                                                        "SvPs": function(dialog)

                                                        {

                                                            this.SetFileName(dialog,this);

                                                        },

                                                        "DnFx": function(dialog)

                                                        {

                                                            this.SetFileName(dialog,this);

                                                        },

                                                        "DnPr": function(dialog)

                                                        {

                                                            this.SetFileName(dialog,this);

                                                        },

                                                        "None": function(dialog)

                                                        {

                                                            this.SetFileName(dialog,this);

                                                        },

                                                        "SvPr": function(dialog)

                                                        {

                                                            this.SetFileName(dialog,this);

                                                        },

                                                        "SPst": function(dialog)

                                                        {

                                                            var bOn = dialog.store()["SPst"];

                                                            dialog.enable({"SvPs":bOn ,"SvDn":bOn });

                                                            this.SetFileName(dialog,this);

                                                        },

                                                        "tTPg": function(dialog)

                                                        {

                                                            var x;

                                                           

                                                           

                                                           

                                                           

                                                        },

                                                        "rFro": function(dialog)

                                                        {

                                                            dialog.enable({tFPg:true, tTPg:true, "ExPg":true});

                                                           

                                                           

                                                        },

                                                        "rCur": function(dialog)

                                                        {

                                                            dialog.enable({tFPg:false, tTPg:false,"ExPg":false});

                                                           

                                                           

                                                        },

                                                        "rAll": function(dialog)

                                                        {

                                                            dialog.enable({tFPg:false, tTPg:false, "ExPg":false});

                                                           

                                                           

                                                        },

                                                        "Fltn": function(dialog)

                                                        {

                                                            app.alert("Caution:  Flattening will destroy all existing form fields and annotations on the Document.",1);

                                                        },

                                                        "PPsf": function(dialog)

                                                        {

                                                            this.SetDocNumber(dialog,this);

                                                           

                                                        },

                                                        "PPfx": function(dialog)

                                                        {

                                                            this.SetDocNumber(dialog,this);

                                                           

                                                        },

                                                        "PgNm": function(dialog)

                                                        {

                                                            var bIsOn = dialog.store()["PgNm"];

                                                            dialog.enable({"PPfx":bIsOn,"PPsf":bIsOn});

                                                           

                                                            this.SetDocNumber(dialog,this);

                                                           

                                                        },

                                                        "DNum": function(dialog)

                                                        {

                                                            this.SetDocNumber(dialog,this);

                                                           

                                                        },

                                                        "DocN": function(dialog)

                                                        {

                                                            dialog.enable({"DNum":dialog.store()["DocN"]});

                                                           

                                                            this.SetDocNumber(dialog,this);

                                                           

                                                        },

                                                        "LPfx": function(dialog)

                                                        {

                                                            this.SetDocNumber(dialog,this);

                                                           

                                                        },

                                                        "LTyp": function(dialog)

                                                        {

                                                            var oRslt = dialog.store();

                                                            var path = [];

                                                            var cSel = ((this.GetListSel(oRslt["LTyp"],path))?path.reverse():"").toString();

                                                            var oLabInfo = this.oDocNumParams[cSel];

                                                           

                                                            if(!oRslt["DNum"] || (oRslt["DNum"] == "") || isNaN(oRslt["DNum"]))

                                                              dialog.load({"DNum":"1"});

                                                           

                                                            if(oLabInfo)

                                                            {

                                                               dialog.load({"LPfx":oLabInfo.Prefix, "DocN":oLabInfo.UseDocNum, "PgNm":oLabInfo.UsePgNum, "PPfx":oLabInfo.PagePrefix});

                                                               dialog.enable({"DNum":oLabInfo.UseDocNum, "PPfx":oLabInfo.UsePgNum, "PPsf":oLabInfo.UsePgNum});

                                                               this.SetDocNumber(dialog,this);

                                                            }

                                                           

                                                           

                                                        },

                                                        "PosB": function(dialog)

                                                        {

                                                            dialog.enable({"MrgV":true});

                                                        },

                                                        "PosM": function(dialog)

                                                        {

                                                            dialog.enable({"MrgV":false});

                                                        },

                                                        "PosT": function(dialog)

                                                        {

                                                            dialog.enable({"MrgV":true});

                                                        },

                                                        "PosR": function(dialog)

                                                        {

                                                            dialog.enable({"MrgH":true});

                                                        },

                                                        "PosC": function(dialog)

                                                        {

                                                            dialog.enable({"MrgH":false});

                                                        },

                                                        "PosL": function(dialog)

                                                        {

                                                            dialog.enable({"MrgH":true});

                                                        },

                                                        description:

                                                        {

                                                            name: "Document Numbering Info",

                                                            elements:

                                                            [

                                                                {

                                                                    type: "view",

                                                                    elements:

                                                                    [

                                                                        {

                                                                            type: "view",

                                                                            alignment: "align_fill",

                                                                            elements:

                                                                            [

                                                                                {

                                                                                    type: "view",

                                                                                    height: 14,

                                                                                    align_children: "align_top",

                                                                                    elements:

                                                                                    [

                                                                                        {

                                                                                            type: "static_text",

                                                                                            item_id: "FlNm",

                                                                                            name: "Please enter the information for applying document numbering labels to:",

                                                                                            height: 14,

                                                                                            font: "palette",

                                                                                            bold: true,

                                                                                        },

                                                                                        {

                                                                                            type: "static_text",

                                                                                            item_id: "sta1",

                                                                                            name: "Version 1.3 - 11/2/2010",

                                                                                            height: 14,

                                                                                            alignment: "align_right",

                                                                                        },

                                                                                    ]

                                                                                },

                                                                                {

                                                                                    type: "cluster",

                                                                                    item_id: "cls1",

                                                                                    name: "Position",

                                                                                    width: 188,

                                                                                    height: 80,

                                                                                    char_width: 8,

                                                                                    char_height: 8,

                                                                                    elements:

                                                                                    [

                                                                                        {

                                                                                            type: "view",

                                                                                            align_children: "align_top",

                                                                                            elements:

                                                                                            [

                                                                                                {

                                                                                                    type: "radio",

                                                                                                    item_id: "PosL",

                                                                                                    group_id: "PosH",

                                                                                                    name: "Left",

                                                                                                    variable_Name: "strHorzPos",

                                                                                                },

                                                                                                {

                                                                                                    type: "radio",

                                                                                                    item_id: "PosC",

                                                                                                    group_id: "PosH",

                                                                                                    name: "Center",

                                                                                                },

                                                                                                {

                                                                                                    type: "radio",

                                                                                                    item_id: "PosR",

                                                                                                    group_id: "PosH",

                                                                                                    name: "Right ",

                                                                                                },

                                                                                                {

                                                                                                    type: "static_text",

                                                                                                    item_id: "sta2",

                                                                                                    name: " Margin (inches):",

                                                                                                },

                                                                                                {

                                                                                                    type: "edit_text",

                                                                                                    item_id: "MrgH",

                                                                                                    variable_Name: "nMarginX",

                                                                                                    char_width: 8,

                                                                                                },

                                                                                            ]

                                                                                        },

                                                                                        {

                                                                                            type: "view",

                                                                                            align_children: "align_top",

                                                                                            elements:

                                                                                            [

                                                                                                {

                                                                                                    type: "radio",

                                                                                                    item_id: "PosT",

                                                                                                    group_id: "PosV",

                                                                                                    name: "Top ",

                                                                                                    variable_Name: "strVertPos",

                                                                                                },

                                                                                                {

                                                                                                    type: "radio",

                                                                                                    item_id: "PosM",

                                                                                                    group_id: "PosV",

                                                                                                    name: "Middle",

                                                                                                },

                                                                                                {

                                                                                                    type: "radio",

                                                                                                    item_id: "PosB",

                                                                                                    group_id: "PosV",

                                                                                                    name: "Bottom",

                                                                                                },

                                                                                                {

                                                                                                    type: "static_text",

                                                                                                    item_id: "sta1",

                                                                                                    name: "Margin (inches):",

                                                                                                },

                                                                                                {

                                                                                                    type: "edit_text",

                                                                                                    item_id: "MrgV",

                                                                                                    variable_Name: "nMarginY",

                                                                                                    char_width: 8,

                                                                                                },

                                                                                            ]

                                                                                        },

                                                                                    ]

                                                                                },

                                                                                {

                                                                                    type: "cluster",

                                                                                    item_id: "cls2",

                                                                                    name: "Label Format",

                                                                                    elements:

                                                                                    [

                                                                                        {

                                                                                            type: "static_text",

                                                                                            item_id: "sta4",

                                                                                            name: "Note: Type selections are presets that can be changed",

                                                                                        },

                                                                                        {

                                                                                            type: "view",

                                                                                            align_children: "align_row",

                                                                                            elements:

                                                                                            [

                                                                                                {

                                                                                                    type: "static_text",

                                                                                                    item_id: "sta3",

                                                                                                    name: "Label Type:",

                                                                                                },

                                                                                                {

                                                                                                    type: "popup",

                                                                                                    item_id: "LTyp",

                                                                                                    width: 93,

                                                                                                    height: 23,

                                                                                                    char_width: 8,

                                                                                                },

                                                                                                {

                                                                                                    type: "gap",

                                                                                                    item_id: "gap2",

                                                                                                    char_width: 1,

                                                                                                    char_height: 4,

                                                                                                },

                                                                                                {

                                                                                                    type: "static_text",

                                                                                                    item_id: "sta1",

                                                                                                    name: "Background",

                                                                                                },

                                                                                                {

                                                                                                    type: "popup",

                                                                                                    item_id: "Bkgd",

                                                                                                    variable_Name: "strBackgroundCol",

                                                                                                    width: 86,

                                                                                                    height: 23,

                                                                                                    char_width: 8,

                                                                                                },

                                                                                                {

                                                                                                    type: "static_text",

                                                                                                    item_id: "sta8",

                                                                                                    name: "Example:",

                                                                                                    height: 20,

                                                                                                    font: "palette",

                                                                                                    bold: true,

                                                                                                },

                                                                                                {

                                                                                                    type: "edit_text",

                                                                                                    item_id: "Exmp",

                                                                                                    width: 129,

                                                                                                    height: 43,

                                                                                                    char_width: 8,

                                                                                                    multiline: "true",

                                                                                                    readonly: "true",

                                                                                                },

                                                                                            ]

                                                                                        },

                                                                                        {

                                                                                            type: "view",

                                                                                            align_children: "align_top",

                                                                                            elements:

                                                                                            [

                                                                                                {

                                                                                                    type: "view",

                                                                                                    elements:

                                                                                                    [

                                                                                                        {

                                                                                                            type: "static_text",

                                                                                                            item_id: "sta5",

                                                                                                            name: "Label Prefix",

                                                                                                            height: 15,

                                                                                                        },

                                                                                                        {

                                                                                                            type: "edit_text",

                                                                                                            item_id: "LPfx",

                                                                                                            variable_Name: "strLabelPrefix",

                                                                                                            width: 129,

                                                                                                            height: 43,

                                                                                                            multiline:true,                                                           

                                                                                                            char_width: 8,

                                                                                                        },

                                                                                                    ]

                                                                                                },

                                                                                                {

                                                                                                    type: "view",

                                                                                                    elements:

                                                                                                    [

                                                                                                        {

                                                                                                            type: "check_box",

                                                                                                            item_id: "DocN",

                                                                                                            name: "Include Doc#",

                                                                                                            variable_Name: "bIncludeDocNum",

                                                                                                            alignment: "align_center",

                                                                                                        },

                                                                                                        {

                                                                                                            type: "view",

                                                                                                            align_children: "align_top",

                                                                                                            elements:

                                                                                                            [

                                                                                                                {

                                                                                                                    type: "static_text",

                                                                                                                    item_id: "sta6",

                                                                                                                    name: "Initial Value:",

                                                                                                                },

                                                                                                                {

                                                                                                                    type: "edit_text",

                                                                                                                    item_id: "DNum",

                                                                                                                    variable_Name: "strInitDocNum",

                                                                                                                    char_width: 3,

                                                                                                                },

                                                                                                            ]

                                                                                                        },

                                                                                                    ]

                                                                                                },

                                                                                                {

                                                                                                    type: "view",

                                                                                                    elements:

                                                                                                    [

                                                                                                        {

                                                                                                            type: "check_box",

                                                                                                            item_id: "PgNm",

                                                                                                            name: "Include Page #",

                                                                                                            variable_Name: "bIncludePageNum",

                                                                                                            alignment: "align_center",

                                                                                                        },

                                                                                                        {

                                                                                                            type: "view",

                                                                                                            align_children: "align_row",

                                                                                                            elements:

                                                                                                            [

                                                                                                                {

                                                                                                                    type: "static_text",

                                                                                                                    item_id: "sta7",

                                                                                                                    name: "Prefix:",

                                                                                                                },

                                                                                                                {

                                                                                                                    type: "edit_text",

                                                                                                                    item_id: "PPfx",

                                                                                                                    variable_Name: "strPageNumPrefix",

                                                                                                                    char_width: 8,

                                                                                                                },

                                                                                                                {

                                                                                                                    type: "check_box",

                                                                                                                    item_id: "PPsf",

                                                                                                                    name: "Include \"of N\" pages",

                                                                                                                    variable_Name: "bPageNumPostfix",

                                                                                                                    alignment: "align_center",

                                                                                                                },

                                                                                                            ]

                                                                                                        },

                                                                                                    ]

                                                                                                },

                                                                                            ]

                                                                                        },

                                                                                        {

                                                                                            type: "static_text",

                                                                                            item_id: "LbPR",

                                                                                            name: "Static Text 2",

                                                                                            width: 478,

                                                                                            height: 29,

                                                                                            alignment: "align_fill",

                                                                                        },

                                                                                        {

                                                                                            type: "view",

                                                                                            align_children: "align_row",

                                                                                            elements:

                                                                                            [

                                                                                                {

                                                                                                    type: "radio",

                                                                                                    item_id: "Unlk",

                                                                                                    group_id: "BxSl",

                                                                                                    name: "Unlocked",

                                                                                                    variable_Name: "strBoxStateSel",

                                                                                                },

                                                                                                {

                                                                                                    type: "radio",

                                                                                                    item_id: "Lckd",

                                                                                                    group_id: "BxSl",

                                                                                                    name: "Locked",

                                                                                                },

                                                                                                {

                                                                                                    type: "radio",

                                                                                                    item_id: "Fltn",

                                                                                                    group_id: "BxSl",

                                                                                                    name: "Flattened in to page (permanent content)",

                                                                                                },

                                                                                            ]

                                                                                        },

                                                                                    ]

                                                                                },

                                                                                {

                                                                                    type: "cluster",

                                                                                    item_id: "cls3",

                                                                                    name: "Page range",

                                                                                    elements:

                                                                                    [

                                                                                        {

                                                                                            type: "view",

                                                                                            align_children: "align_row",

                                                                                            elements:

                                                                                            [

                                                                                                {

                                                                                                    type: "radio",

                                                                                                    item_id: "rAll",

                                                                                                    group_id: "GRP1",

                                                                                                    name: "All",

                                                                                                    variable_Name: "strPgRangeSel",

                                                                                                    height: 20,

                                                                                                },

                                                                                                {

                                                                                                    type: "radio",

                                                                                                    item_id: "rCur",

                                                                                                    group_id: "GRP1",

                                                                                                    name: "Current (Applies only to Open Document)",

                                                                                                    variable_Name: "strRange",

                                                                                                    height: 20,

                                                                                                },

                                                                                                {

                                                                                                    type: "radio",

                                                                                                    item_id: "rFro",

                                                                                                    group_id: "GRP1",

                                                                                                    name: "From:",

                                                                                                    width: 12,

                                                                                                    height: 24,

                                                                                                },

                                                                                                {

                                                                                                    type: "edit_text",

                                                                                                    item_id: "tFPg",

                                                                                                    variable_Name: "strStrtPg",

                                                                                                    height: 24,

                                                                                                    char_width: 6,

                                                                                                },

                                                                                                {

                                                                                                    type: "static_text",

                                                                                                    item_id: "sta1",

                                                                                                    name: "To:",

                                                                                                    height: 24,

                                                                                                },

                                                                                                {

                                                                                                    type: "edit_text",

                                                                                                    item_id: "tTPg",

                                                                                                    variable_Name: "strEndPg",

                                                                                                    height: 24,

                                                                                                    char_width: 6,

                                                                                                },

                                                                                                {

                                                                                                    type: "static_text",

                                                                                                    item_id: "sOfN",

                                                                                                    name: "of (N)          ",

                                                                                                    height: 24,

                                                                                                },

                                                                                            ]

                                                                                        },

                                                                                    ]

                                                                                },

                                                                            ]

                                                                        },

                                                                        {

                                                                            type: "cluster",

                                                                            item_id: "cls1",

                                                                            name: "Save Options",

                                                                            alignment: "align_fill",

                                                                            elements:

                                                                            [

                                                                                {

                                                                                    type: "static_text",

                                                                                    item_id: "LSav",

                                                                                    name: "If this option is not selected then extracted pages are left open in Acrobat",

                                                                                    width: 200,

                                                                                    height: 29,

                                                                                    alignment: "align_fill",

                                                                                },

                                                                                {

                                                                                    type: "view",

                                                                                    align_children: "align_top",

                                                                                    elements:

                                                                                    [

                                                                                        {

                                                                                            type: "check_box",

                                                                                            item_id: "SPst",

                                                                                            name: "Save File",

                                                                                            variable_Name: "bSaveWPostFx",

                                                                                        },

                                                                                        {

                                                                                            type: "static_text",

                                                                                            item_id: "sta9",

                                                                                            name: "Prefix:",

                                                                                        },

                                                                                        {

                                                                                            type: "edit_text",

                                                                                            item_id: "SvPr",

                                                                                            variable_Name: "strSavePrefix",

                                                                                            width: 73,

                                                                                            height: 23,

                                                                                            char_width: 8,

                                                                                            alignment: "align_fill",

                                                                                        },

                                                                                        {

                                                                                            type: "static_text",

                                                                                            item_id: "sta3",

                                                                                            name: "Doc Number as:",

                                                                                        },

                                                                                        {

                                                                                            type: "radio",

                                                                                            item_id: "None",

                                                                                            group_id: "SvDN",

                                                                                            name: "None",

                                                                                            variable_Name: "strDocNumInName",

                                                                                        },

                                                                                        {

                                                                                            type: "radio",

                                                                                            item_id: "DnPr",

                                                                                            group_id: "SvDN",

                                                                                            name: "Prefix",

                                                                                        },

                                                                                        {

                                                                                            type: "radio",

                                                                                            item_id: "DnFx",

                                                                                            group_id: "SvDN",

                                                                                            name: "Postfix",

                                                                                        },

                                                                                        {

                                                                                            type: "static_text",

                                                                                            item_id: "sta1",

                                                                                            name: "Postfix:",

                                                                                        },

                                                                                        {

                                                                                            type: "edit_text",

                                                                                            item_id: "SvPs",

                                                                                            variable_Name: "strSavePostfix",

                                                                                            width: 76,

                                                                                            height: 23,

                                                                                            char_width: 8,

                                                                                            alignment: "align_fill",

                                                                                        },

                                                                                    ]

                                                                                },

                                                                                {

                                                                                    type: "view",

                                                                                    align_children: "align_top",

                                                                                    alignment: "align_top",

                                                                                    elements:

                                                                                    [

                                                                                        {

                                                                                            type: "ok",

                                                                                            ok_name: "Apply Label",

                                                                                        },

                                                                                        {

                                                                                            type: "button",

                                                                                            item_id: "Skip",

                                                                                            name: "Skip this Doc",

                                                                                        },

                                                                                        {

                                                                                            type: "button",

                                                                                            item_id: "Abrt",

                                                                                            name: "Stop Action",

                                                                                        },

                                                                                        {

                                                                                            type: "static_text",

                                                                                            item_id: "sta1",

                                                                                            name: "    File Name:",

                                                                                            alignment: "align_right",

                                                                                        },

                                                                                        {

                                                                                            type: "edit_text",

                                                                                            item_id: "SvFl",

                                                                                            width: 295,

                                                                                            height: 23,

                                                                                            char_width: 8,

                                                                                            readonly: "true",

                                                                                        },

                                                                                    ]

                                                                                },

                                                                            ]

                                                                        },

                                                                    ]

                                                                },

                                                            ]

                                                        }

                                                    };

                                                   

                                                   

                                                   global.DoPlaceDocNumbers = app.trustedFunction(function(oOrigDoc)

                                                   {

                                                     app.beginPriv();

                                                  

                                                     // Setup starting parameters

                                                     var oTrgDoc = oOrigDoc;

                                                     var nPgStart, nPgEnd, nPgTrgStart;

                                                 

                                                 

                                                     var cBkCol = ["T"];

                                                     switch(global.DocNumAction.strBackgroundCol.toString())

                                                     {

                                                       case "Transparent":

                                                         cBkCol = ["T"];

                                                         break;

                                                       case "Yellow":

                                                         cBkCol = ["RGB",1,1,0];

                                                         break;

                                                       case "Green":

                                                         cBkCol = ["RGB",0,1,0];

                                                         break;

                                                       case "Blue":

                                                         cBkCol = ["RGB",0,0,1];

                                                         break;

                                                       case "Grey":

                                                         cBkCol = ["RGB",.7,.7,.7];

                                                         break;

                                                       case "White":

                                                         cBkCol = ["RGB",1,1,1];

                                                         break;

                                                     }

                                                  

                                                     switch(global.DocNumAction.strPgRangeSel)

                                                     {

                                                       case "rAll":

                                                         nPgTrgStart = nPgStart = 0;

                                                         nPgEnd = oOrigDoc.numPages -1;

                                                         break;

                                                       case "rCur":

                                                         nPgTrgStart = nPgEnd = nPgStart = oOrigDoc.hidden?0:oOrigDoc.pageNum;

                                                         break;

                                                       case "rFro":

                                                         nPgTrgStart = nPgStart = Number(global.DocNumAction.strStrtPg)-1;

                                                         if(nPgTrgStart > (oOrigDoc.numPages -1))

                                                           nPgTrgStart = oOrigDoc.numPages -1;

                                                  

                                                         nPgEnd = Number(global.DocNumAction.strEndPg)-1;

                                                         if(nPgEnd > (oOrigDoc.numPages -1))

                                                           nPgEnd = oOrigDoc.numPages -1;

                                                         break;

                                                     }

                                                  

                                                  

                                                     // Start Labeling Loop

                                                     var nNumPages = nPgEnd - nPgStart + 1;

                                                     var nCurPgNum = nPgStart;

                                                  

                                                     for(var nPg=0;nPg<nNumPages;nPg++,nCurPgNum++,nPgTrgStart++)

                                                     {

                                                        // Create text Label

                                                        var strExample = global.DocNumAction.strLabelPrefix;

                                                        if(global.DocNumAction.bIncludeDocNum)

                                                           strExample += global.DocNumAction.nCurrentDocNum;

                                                  

                                                        if(global.DocNumAction.bIncludePageNum)

                                                        {

                                                           strExample += eval("'" + global.DocNumAction.strPageNumPrefix + "'") + (nCurPgNum + 1).toString();

                                                  

                                                        if(global.DocNumAction.bPageNumPostfix)

                                                          strExample += " of " + oOrigDoc.numPages;

                                                        }

                                                  

                                                        // Find Placement location on Page

                                                        // get basic params

                                                        var rcPage = oOrigDoc.getPageBox("Crop",nCurPgNum);

                                                        var mxToDefaultCoords = (new Matrix2D()).fromRotated(oOrigDoc,nCurPgNum);

                                                        var nPgRot = oOrigDoc.getPageRotation(nCurPgNum);

                                                  

                                                        var rcRot = [];

                                                        var nAlign;

                                                        var nMargX = Number(global.DocNumAction.nMarginX) * 72;

                                                        switch(global.DocNumAction.strHorzPos)

                                                        {

                                                           case"PosL":

                                                             strAlign = "left"; // Left Aligned Text

                                                             rcRot[0] = nMargX;

                                                             rcRot[2] = nMargX + nLabWidth;

                                                             break;

                                                           case"PosC":

                                                             strAlign = "center"; // Left Aligned Text

                                                             rcRot[0] = rcPage[2]/2 - nLabWidth/2;

                                                             rcRot[2] = rcPage[2]/2 + nLabWidth/2;

                                                             break;

                                                           case"PosR":

                                                             strAlign = "right"; // Left Aligned Text

                                                             rcRot[0] = rcPage[2] - nMargX - nLabWidth;

                                                             rcRot[2] = rcPage[2] - nMargX;

                                                             break;

                                                        }

                                                  

                                                        // Find number of lines

                                                        var nMargY = Number(global.DocNumAction.nMarginY) * 72;

                                                        var nLines = 1;

                                                        var oMtch = strExample.match(/(\n)/g);

                                                        if(oMtch)

                                                          nLines += oMtch.length;

                                                  

                                                        var bxHght = nLines * (nLabLineHeight + 1);

                                                  

                                                        switch(global.DocNumAction.strVertPos)

                                                        {

                                                           case"PosT":

                                                             rcRot[1] = rcPage[1] - nMargY - bxHght;

                                                             rcRot[3] = rcPage[1] - nMargY;

                                                             break;

                                                           case"PosM":

                                                             rcRot[1] = (rcPage[1] - bxHght)/2;

                                                             rcRot[3] = (rcPage[1] + bxHght)/2;

                                                             break;

                                                           case"PosB":

                                                             rcRot[1] = nMargY;

                                                             rcRot[3] = nMargY + bxHght;

                                                             break;

                                                        }

                                                  

                                                        var rectAnnot = mxToDefaultCoords.transform(rcRot);

                                                  

                                                       // Look for an existing annot and delete if it exists

                                                       var annot = oTrgDoc.getAnnot(nPgTrgStart,"DocNumberLabel");

                                                       if(annot)

                                                         annot.destroy();

                                                  

                                                       //  Create annotation

                                                       strExample = strExample.replace(/\n/g,"\r");

                                                       oTrgDoc.addAnnot({type:"FreeText",page:nPgTrgStart, rect:rectAnnot,

                                                                         rotate:nPgRot, width:0, fillColor:cBkCol,

                                                                         readOnly:global.DocNumAction.strBoxStateSel == "Lckd",

                                                                         richContents:[{textColor:["RGB",0,0,0],textSize:nLabLineHeight,

                                                                                        alignment:strAlign, text:strExample}],

                                                                         name:"DocNumberLabel"

                                                                      });

                                                  

                                                     }  

                                                  

                                                     // If selected then Flatten

                                                     if(global.DocNumAction.strBoxStateSel == "Fltn")

                                                       oTrgDoc.flattenPages();

                                                  

                                                     // Save File

                                                     if(global.DocNumAction.bSaveWPostFx)

                                                     {

                                                         var cSavePath = oOrigDoc.path.replace(/\/[^\/]+$/,"/");

                                                 

                                                 

                                                         var cDocPrefix;

                                                         cDocPrefix = global.DocNumAction.strLabelPrefix;

                                                 

                                                 

                                                        //Document number as prefix

                                                        if(global.DocNumAction.strDocNumInName == "DnPr")

                                                        {

                                                           cSavePath += global.DocNumAction.strLabelPrefix

                                                           if(global.DocNumAction.bIncludeDocNum)

                                                             cSavePath += global.DocNumAction.nCurrentDocNum;

                                                        }

                                                 

                                                 

                                                        cSavePath += global.DocNumAction.strSavePrefix;

                                                        cSavePath += oOrigDoc.documentFileName.replace(/\.pdf/,"");

                                                        cSavePath += global.DocNumAction.strSavePostfix;

                                                 

                                                 

                                                        //Document number as prostfix

                                                        if(global.DocNumAction.strDocNumInName == "DnFx")

                                                        {

                                                           cSavePath += global.DocNumAction.strLabelPrefix

                                                           if(global.DocNumAction.bIncludeDocNum)

                                                             cSavePath += global.DocNumAction.nCurrentDocNum;

                                                        }

                                                 

                                                 

                                                        cSavePath += ".pdf";

                                                 

                                                 

                                                        oTrgDoc.saveAs(cSavePath);

                                                     }

                                                 

                                                 

                                                     app.endPriv();

                                                 

                                                 

                                                  });

                                                       

                                                 

                                                 

                                                 

                                                 

                                                var DoNumActionDlg = app.trustedFunction(function()

                                                {

                                                   app.beginPriv();

                                                   return app.execDialog(global.DocNumAction);

                                                   app.endPriv();

                                                });

                                                 

                                                 

                                                    // Setup

                                                var oDoc = event.target;

                                                if(oDoc.xfa)

                                                {

                                                   if(3 == app.alert(oDoc.documentFileName + ": is a LiveCycle Form, which cannot be labeled\n\n Do you want to continue processing files? (Pressing No will Abort the file processing)",1,2))

                                                     event.rc = false;

                                                }

                                                else

                                                {  

                                                    global.DocNumAction.bHidden = oDoc.hidden;

                                                    if(!oDoc.hidden)

                                                       global.DocNumAction.nCurPage = oDoc.pageNum;

                                                    else

                                                       global.DocNumAction.nCurPage = 0;

                                                 

                                                 

                                                    global.DocNumAction.nNumPages = oDoc.numPages;

                                                   

                                                    global.DocNumAction.strFileName = oDoc.documentFileName;

                                                 

                                                 

                                                   var cRtn = DoNumActionDlg();

                                                   if("ok" == cRtn)

                                                   {

                                                       // Setup Initial Doc Number

                                                       if(global.DocNumAction.bIncludePageNum)

                                                          global.DocNumAction.nCurrentDocNum = Number(global.DocNumAction.strInitDocNum);

                                                console.println("Do " + oDoc.documentFileName);

                                                 

                                                 

                                                       global.DoPlaceDocNumbers(oDoc);

                                                 

                                                 

                                                      // Increment Doc Number if applicable

                                                      if(global.DocNumAction.bIncludeDocNum)

                                                      {

                                                          global.DocNumAction.nCurrentDocNum++;

                                                          global.DocNumAction.strInitDocNum = global.DocNumAction.nCurrentDocNum.toString();

                                                      }

                                                  }

                                                  else if("Abrt" == cRtn)

                                                     event.rc  = false;

                                                }

                                                • 22. Re: How do you Return string as multi line text?
                                                  George_Johnson MVP & Adobe Community Professional

                                                  OK, you'll see this code:

                                                   

                                                         //  Create annotation

                                                         strExample = strExample.replace(/\n/g,"\r");

                                                   

                                                   

                                                  Try changing that one line to:

                                                   

                                                         //  Create annotation

                                                         strExample = strExample.replace(/\r\n/g,"\r");

                                                  1 person found this helpful
                                                  • 23. Re: How do you Return string as multi line text?
                                                    sargums46564804 Level 1

                                                    That totally worked.  I would never have figured that out.  TY so much!!!  I guess I was missing quite a bit but of understanding of the code.

                                                    • 24. Re: How do you Return string as multi line text?
                                                      sargums46564804 Level 1

                                                      BTW, I figured out how to get rid of radio buttons and default to flattening the annotation.  Thx again for your help!