Getting error: Unsupported image file format...Posting the code...Kindly Help!
String url = 'http://cloud.ocrsdk.com/processImage?language=english&exportformat=pdfSearchable';
String appId='';
String pwd='';
String toEncode=appId+':' + pwd;
Blob beforeblob = Blob.valueOf(toEncode);
string paramvalue = EncodingUtil.base64Encode(beforeblob);
Attachment att = new Attachment();
att = [SELECT ID,Body,ContentType FROM Attachment where ContentType='image/jpeg' and ID='00P2800000KuwQf' LIMIT 1];
String strImg=EncodingUtil.base64Encode(att.body);
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setMethod('POST');
req.setHeader( 'Authorization', 'Basic ' + paramvalue);
req.setHeader('Content-Type', 'image/jpeg');
req.setBody(imgBlob);
req.setBody(strImg);
req.setHeader('Content-Length', String.valueOf(strImg.length()));
HTTPResponse res = h.send(req);
System.debug(res.getBody());
コメント
1件のコメント
I have sent you some general recommendations concerning this issue to your email.
サインインしてコメントを残してください。