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

function callActionFunction(){
    var test= document.getElementById("{!$Component.descriptionTxt}");
    return true;

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

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

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


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 . Sep 22, 2017 at 5:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .