1. Home
  2. Foxit Quick PDF Library
  3. Working around the Delphi character limit for JavaScript strings

Working around the Delphi character limit for JavaScript strings

Problems can arise when working with longer JavaScript strings using Foxit Quick PDF Library. Essentially, these issues occur due to the nature of Delphi, the programming language in which Foxit Quick PDF Library is written. Delphi has a hard 255-character limit for string constants, which means that longer strings can’t be used in the standard way. The easiest workaround for this problem when inserting JavaScript into a PDF with the FormFieldJavaScriptAction function is to break the long string into multiple, shorter strings. An example of this is provided here:

LongString := 'app.alert("This is a Long message window ' +
  'which can be displayed because the string Literal is ' +
  'bigger than 255 characters long <spacefiller><spacefiller>' +
  '<spacefiller><spacefiller><spacefiller><spacefiller>' +
  '<spacefiller><spacefiller><spacefiller><spacefiller>' +
  '<spacefiller><spacefiller><spacefiller>!");'
Updated on April 9, 2017

Was this article helpful?

Related Articles

Ready to try Foxit PDF SDK?
Click the link below to download your trial
Free Trial