1

I want to store the image from canvas. I created a function to pass the data to Apex.

function callActionFunction(){
    sendEmailAF(document.getElementsByTagName('canvas')[0].toDataURL());
    var test= document.getElementById("{!$Component.descriptionTxt}");
    test.value='';
    return true;
}

<apex:actionFunction action="{!insertSnapShot}" name="sendEmailAF" rerender="thePanel" oncomplete="closePopUp('popup-x');" status="sts" >
    <apex:param assignTo="{!strImageBlob}" name="imageBlob" value=""/>
</apex:actionFunction>  

When code comes to sendEmailAF..It displays "View State exceeded" considering image data size. How can i fix this issue?

2

Instead of using visualforce tags use Javascript Remoting .

With Javascript remoting you will get a limit of 15MB and nothing is stored in the view State .

Because you aren’t using forms and there’s no view state associated with the request, you have to manage the state of the page yourself, on the client side.

1

Change your strImageBlob variable to transient. You can save the data in your apex code, and then it will be discarded from the view state:

public transient String strImageBlob { get; set; }
  • If this data needs to be managed as a state back and forth ,using transient might not be an option . – Mohith Shrivastava Sep 22 '17 at 5:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.