コミュニティ

Unsupported image file format!

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());

この記事は役に立ちましたか?

0人中0人がこの記事が役に立ったと言っています

コメント

1件のコメント

  • Avatar
    Permanently deleted user

    I have sent you some general recommendations concerning this issue to your email.

    0

サインインしてコメントを残してください。