max lenght of URL supported by app.launchURL
I have a fillable PDF document with form fields and submit button.
Submit button originally calls a REST api end point:
submitForm({cURL: 'https://api.example.com,cSubmitAs: 'XFDF' });
However, the REST api requires basic authentication and doesn't support SSO.
So, I am looking for other options.
As a workaround, I am trying to export the form fields as a string and include it as a Query parameter and launch the application URL in the browser(see code snippet below). Application URL supports SSO and once user is authenticated successfully, I plan to use the data from the query parameter to invoke the REST api.
Issue: See code snippet below. When URL value with Query parameters stored in "finalAppURL" exceeds 2076 characters, it is getting truncated once the browser is launched. Using the PDF Javascript debugger to do a console.println of the variable "finalAppURL" , I verified that URL is generated correctly and app.launchURL seems to be the issue. I also used the "finalAppURL" value from the debugger ouput directly in the browser and it is not getting truncated in the browser/application.
Could app.launchURL be causing the issue?
This is my exposure to PDF scripting.
Is there any better way to address this use case/issue?
Thanks!
var cXFDF = this.exportAsXFDFStr();
var documentStream = Net.streamFromString(cXFDF);
var encodedStream = Net.streamEncode(documentStream,"base64");
var encodedcXFDF = Net.stringFromStream(encodedStream);
var appURL = 'https://example.com?formdata=';
//get rid of '=','+','/' in the Query paramaters that is base64 encoded
//as URL encode is not handling this
var encodedcXFDF = this.encodeURI(encodedcXFDF);
var regex = /\+/gi;
encodedcXFDF = encodedcXFDF.replace(regex,'.');
regex = /\//gi;
encodedcXFDF = encodedcXFDF.replace(regex,'_');
regex = /=/gi;
encodedcXFDF = encodedcXFDF.replace(regex,'-');
var finalAppURL = this.encodeURI(appURL) + encodedcXFDF;
app.launchURL(finalAppURL);
