Skip to main content
Participating Frequently
April 13, 2017
Question

util.stringFromStream out of memory large PDF

  • April 13, 2017
  • 1 reply
  • 947 views

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

This topic has been closed for replies.

1 reply

Joel Geraci
Community Expert
Community Expert
April 13, 2017

You don't need to go through the host. You can just use...

this.submitForm({cSubmitAs: "PDF"})

... 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.

jojoshuaAuthor
Participating Frequently
April 13, 2017

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

Joel Geraci
Community Expert
Community Expert
April 13, 2017

Check you server configuration. It might have a file upload limit.