Looking at the js API for global object methods there's a vague note under setPersistent() "For Acrobat 6.0 or later, there is a 2-4 KB limit on the size of this file. Any data added to the string after this limit is dropped."
Is this enforced in PDF-XChange or is there some other limit?
On my computer GlobData is already over 2k, and I'm wondering if I can use it to store some data for javascript tools that would definitely put it over 4k (without clobbering data from other tools) - or is there another way to store data for javascript that can be accessed between documents? There's util.readFileInterStream() but I don't see any equivalent writeStreamIntoFile()...
[javascript] Limit on size of global object? SOLVED
Moderators: Daniel - PDF-XChange, PDF-XChange Support, Vasyl - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
-
- User
- Posts: 567
- Joined: Thu Jun 19, 2014 7:30 pm
[javascript] Limit on size of global object?
Last edited by Mathew on Wed Jun 12, 2024 11:33 pm, edited 2 times in total.
-
- Site Admin
- Posts: 332
- Joined: Sun Nov 21, 2004 3:19 pm
Re: [javascript] Limit on size of global object? SOLVED
Hi Mathew,
The Editor does not explicitly limit GlobData file size but limits the number of persistent properties by 65536.
As of an alternative to persistent global properties, you can consider Doc.createDataObject, Doc.exportDataObject, Doc.importDataObject and related API.
The Editor does not explicitly limit GlobData file size but limits the number of persistent properties by 65536.
As of an alternative to persistent global properties, you can consider Doc.createDataObject, Doc.exportDataObject, Doc.importDataObject and related API.
-
- User
- Posts: 567
- Joined: Thu Jun 19, 2014 7:30 pm
Re: [javascript] Limit on size of global object?
Thank you Roman. I'll do some noodling with those, but it's good to know that there's no arbitrary limit on the persistent global properties themselves.Roman - Tracker Supp wrote: ↑Wed Jun 12, 2024 10:48 pm As of an alternative to persistent global properties, you can consider Doc.createDataObject, Doc.exportDataObject, Doc.importDataObject and related API.
The doc.exportDataObject() function looks like it's been made to not work for a script's storage. Seems I'm bumping up against a very intentional effort to not allow scripts to write to a user's hard drive:
I'm thinking one could use use an empty pdf for storage as app.openDoc(), doc.saveAs() allows writing to a safe path; maybe that's my route.Beginning with Acrobat 6.0, if the parameter cDIPath is non-null, a NotAllowedError (see Error object) exception is thrown and the method fails.
Thanks again.
-
- Site Admin
- Posts: 11009
- Joined: Wed Jan 03, 2018 6:52 pm
Re: [javascript] Limit on size of global object?
Hello, Mathew
I hope one of those options works out for your needs. If you have further questions, just let us know
Kind regards,
I hope one of those options works out for your needs. If you have further questions, just let us know

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com