I have a requirement where I have to take a screenshot of multiple pages and store them in documents on the click of a button. I have everything working perfectly on a windows machine. But when I try it on a mac I get a REEGEX too complicated error when trying to screenshot a specific page. I am using HTML2CANVAS to take the screenshot, and then pass the blob value to my controller.
Here is the relevant controller code.
transient public string strImageBlob {get;set;}
transient public string strImagename {get;set;}
public void captureImage()
{
folderId = [SELECT ID
FROM Folder
WHERE NAME = 'DOC Folder'].Id;
Document d = new Document();
d.Name = strImagename+'.png';
d.Body = EncodingUtil.base64Decode(strImageBlob.replaceFirst('data:image/png;base64,',''));
//Error occurs on the above line ^^^^^^^
d.ContentType = 'image/png';
d.FolderId = folderId;
d.IsPublic = true;
insert d;
RelateListSnapCntrl.saveRecIdinCookie(d.Id);
system.debug('\n--d---'+d);
}
The error occurs in the line indicated above. It seems to occur only in a Mac (or possibly in computers with higher resolution monitors). Is there a way I can handle this error?
Error: