I have a 180mb PDF which I am trying to pull the base64 data from. This method works for other PDFs but on this one I get an out of memory error during util.stringFromStream. Is there a way to stream this instead of pulling all at once? I eventually need to send this data out via hostContainer.postMessage. Here is the code.
var documentStream = Collab.documentToStream(this);
var encodedStream = Net.streamEncode(documentStream,"base64");
var utfencodedStream = util.stringFromStream(encodedStream); <- this line causes the error for large PDF
You don't need to go through the host. You can just use...
... to send the entire PDF to your server application. I've never seen it fail due to file size. If you absolutely need base64, you can encode it on the server.
This PDF is being embedded via a webpage. I actually do use submitForm as you suggested. submitForm works perfect...until you reach large files. I have a post referencing this issue here. https://forums.adobe.com/message/9453189#9453189
Check you server configuration. It might have a file upload limit.