Foxit Quick PDF Library

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>!");'

This article refers to a deprecated product. If you are looking for support for Foxit PDF SDK, please click here.

Updated on May 16, 2022

Was this article helpful?
Thanks for your feedback. If you have a comment on how to improve the article, you can write it here: