2016-08-23 5 views
0

iframe 또는 다른 대체 방법을 사용하여 Visualforce 페이지에서 BLOB 응답을 다운로드하거나 렌더링하는 데 문제가 있습니다. 그러나 나는 그들 중 누구에게도 운이 없다. 어느 누구도이 페이지에서 Visualforce 페이지에서 blob 응답을 pdf로 렌더링/다운로드하도록 제안 할 수 있습니까? BLOB 응답을 받고 아래와 같이 String으로 파싱했습니다.Salesforce의 Visualforce 페이지에서 pdf로 웹 서비스 응답 (BLOB)을 표시/다운로드하십시오.

  <apex:page doctype="html-5.0" controller="ViewDocument" id="thePage" > 

     <apex:outputPanel id="benefit" rendered="{!showDocument}"> 

      <iframe src="data:application/pdf;base64,{!pdf}" id="theFrame1" width="0%" height ="0%" border="0" scrolling="no" frameborder="0"/> 

    </apex:outputPanel> 

    </apex:page> 
+0

그럴 것 같습니다. https : //help.salesforce.com/apex/HTViewSolution? id = 000044612 & language = en_US IE8과 같은 일부 브라우저에서는 지원되지 않습니다. 우리는 이것을 할 방법이 없습니다. – Egor

답변

0

대신 EncodingUtil.Base64Encode(pdfContent)Blob.toPDF(pdfContent)을 시도 :

HttpResponse res = http.send(r); 
    pdfContent = res.getBodyAsBlob(); //Blob property 
    pdf = EncodingUtil.Base64Encode(pdfContent);//String property 

는 아래없이 VisualForce 코드입니다.