Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Limit on lines of code?
  FAQ FAQ  Forum Search   Register Register  Login Login


Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Limit on lines of code?

 Post Reply Post Reply
Author
morrison View Drop Down
New Member
New Member
Avatar

Joined: 26 Jan 2015
Points: 32
Post Options Post Options   Quote morrison Quote  Post ReplyReply Direct Link To This Post Topic: Limit on lines of code?
    Posted: 10 Jul 2015 at 3:56pm
Hey, all.

 Do any of you know if there is a limit on the number of lines of JavaScript a PDF can support?
Web searches haven't turned up anything useful.

By the time I'm done with this behemoth, it will be comprised of just over 39,000 lines.  Shocked
Yes, ludicrous.  We warned the client...

Thanks,
morrison
Back to Top
Sponsored Links


Back to Top
gkaiseril View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Location: USA
Points: 4106
Post Options Post Options   Quote gkaiseril Quote  Post ReplyReply Direct Link To This Post Posted: 10 Jul 2015 at 8:29pm
There is a limit to how many lines of code an editor can hold. Many have hit that limit with the built-in editor and is one reason why many switch to an optional external text editor.
Back to Top
morrison View Drop Down
New Member
New Member
Avatar

Joined: 26 Jan 2015
Points: 32
Post Options Post Options   Quote morrison Quote  Post ReplyReply Direct Link To This Post Posted: 10 Jul 2015 at 9:12pm
Oh yes.  I don't even use the built-in editor because our interactive forms generally exceed its limitations.

Forgive me, I should have been more clear.  What I was looking to learn was whether there is a limit on just how much JavaScript can be on one, 1-page fillable PDF, regardless of which editor is used.  Do we ever hit maximum capacity?  Is there a point where Acrobat just pukes all over itself and freezes up the way it does sometimes when one edits large, fillable PDFs?

My concern is that there are two functions, each containing 1600 case statements, driving which sections -- each comprised of 4 to 12 text fields, check boxes and combo boxes -- get populated.  Furthermore, whether a function is called at all (and which one) is conditionally-driven based on several combinations of factors.
We also have 4 conditionally-hidden radio button widgets, conditionally-required radio buttons, and 2 reset form actions covering either 1 or 36 fields.
Then, for each section, there are multiple conditions governing which fields are required (for the times when we don't call one of the functions and the sections need to be manually completed).
All of this will come to approximately 39,000 lines of code.

There's just a whole lot going on here, and I'm concerned that I'll get halfway through the 3200 case statements and find that Acrobat won't play nicely anymore, making it a colossal waste of time.

Am hoping the fact that I can't find information on a ceiling means there is none.  ;-)  :-)

morrison

Back to Top
try67 View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Points: 628
Post Options Post Options   Quote try67 Quote  Post ReplyReply Direct Link To This Post Posted: 11 Jul 2015 at 8:33am
I'm not aware of any limit to the amount of code that you can have in a file.
- Acrobat Expert - Contact me personally at try6767@gmail.com
Check out my custom-made scripts website: http://try67.blogspot.com
Back to Top
gkaiseril View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Location: USA
Points: 4106
Post Options Post Options   Quote gkaiseril Quote  Post ReplyReply Direct Link To This Post Posted: 12 Jul 2015 at 4:56pm
Are you sure you need that much code. There maybe many opportunities to use functions to preform repetitive tasks for actions where only one or more parameters change. For example, one can write function to multiply the value of 2 fields and insert the result in a field and instead of by only calling the functions and using the field names a parameters so one does not need to repeat writing the code to get each field and perform the math. If one is computing several averages this type of coding can reduce the number of lines significantly.
Back to Top
morrison View Drop Down
New Member
New Member
Avatar

Joined: 26 Jan 2015
Points: 32
Post Options Post Options   Quote morrison Quote  Post ReplyReply Direct Link To This Post Posted: 13 Oct 2015 at 5:54pm
Thank you.  No, being a novice, I am not sure we need that much code, but I don't know how else to do it.
This is a situation where we are comparing against several thousand possible package code combinations, then stuffing data based on the most recent package code submitted and whether or not the user indicated a certain response on another form.

We receive a spreadsheet listing all partners.  Each partner has a code, name, id, indicator, and a top-level corresponding with one of the rows (levels) of fields on the PDF.

So if the user has package code "ABCDE123" and the user is contracting as "Entity" (as indicated on a different form), we populate all the fields on three specific rows of the form with predetermined data provided on the spreadsheet as well as data coming from our database:
-- Partner ABCDE's information, provided on the spreadsheet, goes in all fields of a row at whatever level is indicated on the spreadsheet for that partner.  Plus, we check a box corresponding with that level.
-- The user's entity information (provided on another form and pulled from the database) goes in all the fields of a row corresponding to the level indicated by the package code.  In this example it's "123".  We also check the box corresponding with that level.
-- The user's personal information (provided at login and on forms, pulled from the database) goes in al the fields on a level determined by the client's business rules.  And, yes, we check the box corresponding with that level.

If contracting as an individual, we only complete two rows:
-- Partner ABCDE's information, provided on the spreadsheet, goes in all fields of a row at whatever level is indicated on the spreadsheet for that partner.  Plus, we check a box corresponding with that level.
-- The user's personal information (provided at login and on forms, pulled from the database) goes in all the fields of a row corresponding to the level indicated by the package code.  In this example it's "123".  We also check the box corresponding with that level.

What we're employing is two different functions -- one for if contracting personally and another if contracting as an entity.  At page open, I'm looking to see which contracting option was selected on a different form (stored on this form as readonly, hidden radio button) and dictating which function to run.  Each function contains a series of case statements corresponding with each package code and sets certain values based on the spreadsheet provided by the client.

Here's a little snippet of the function which runs when the user is contracting as an entity:

function popFieldsEntity()
{
var populate = this.getField("current_package").value

switch (populate){
case "ABCDE111":

  getField("level119_name").value = "Partner ABCDE"
  getField("level119_id").value = "9999999999"
  getField("level119_id_ind").value = "Entity"
  getField("level119_cb").value = "X"

  getField("level111_name").value = getField("entity_name").value
  getField("level111_id").value = getField("entity_id").valueAsString
  getField("level111_id_ind").value = "Entity"
  getField("level111_cb").value = "X"

  getField("level000_name").value = getField("name_first").value + " " + getField("name_last").value
  getField("level000_id").value = getField("personal_id").valueAsString
  getField("level000_id_ind").value = "Individual"
  getField("level000_cb").value = "X"
break


case "ABCD112":

  getField("level119_name").value = "Partner ABCDE"
  getField("level119_id").value = "9999999999"
  getField("level119_id_ind").value = "Entity"
  getField("level119_cb").value = "X"

  getField("level112name").value = getField("entity_name").value
  getField("level112id").value = getField("entity_id").valueAsString
  getField("level112_id_ind").value = "Entity"
  getField("level112cb").value = "X"

  getField("level000_name").value = getField("name_first").value + " " + getField("name_last").value
  getField("level000_id").value = getField("personal_id").valueAsString
  getField("level000_id_ind").value = "Individual"
  getField("level000_cb").value = "X"
break


// etc., etc., ad nauseam
}
}

gkaiseril, if you can suggest a more streamlined way to do this, I am ALL EARS (eyes)!!  Tongue
This puppy grows every time the client adds a partner or expands the packages available to a partner.  We have hit the point where I don't dare open the editor for either document-level function.  I edit from within the general editor (external) because it can take 40 seconds to open the smaller of the two document-level functions.

We're going to need a bigger boat.  ;-)

~morrison

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.031 seconds.