Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html iframe中的Base64 Pdf未在Chrome中显示_Html_Google Chrome_Pdf_Base64_Apex - Fatal编程技术网

Html iframe中的Base64 Pdf未在Chrome中显示

Html iframe中的Base64 Pdf未在Chrome中显示,html,google-chrome,pdf,base64,apex,Html,Google Chrome,Pdf,Base64,Apex,我正在尝试显示base64编码的pdf。在FF和Safari中,下面的代码在查看器中显示pdf,但在Chrome页面加载时,为iframe创建了空间,但iframe不显示 <apex:page controller="SomeController"> <apex:iframe src="data:application/pdf;base64,{!pdf}"></apex:iframe> </apex:page> 我已经验证了我确实可以

我正在尝试显示base64编码的pdf。在FF和Safari中,下面的代码在查看器中显示pdf,但在Chrome页面加载时,为iframe创建了空间,但iframe不显示

<apex:page controller="SomeController">
    <apex:iframe src="data:application/pdf;base64,{!pdf}"></apex:iframe>
</apex:page>


我已经验证了我确实可以在其他网页上查看Chrome中的PDF文件,并且Chrome PDF Viewer插件已启用。

这最终起到了作用,尽管我们的开发团队发誓,在最初尝试时,它不起作用:

<apex:page controller="SomeController">
    <object>
        <embed src="data:application/pdf;base64,{!pdf}" height="800" width="1200"/>
    </object>
</apex:page>


当然,还有一个问题是早期版本的IE不支持object,但至少现在它可以在chrome中使用。

这对我使用angular js很有效

<embed ng-src="{{NewDocumentData_PDF}}" height="800px;" width="100%;" />


您真的需要在此处包装对象标记吗?不应该只是嵌入标签吗?@R2D2在我们的例子中,是的,我们这样做了。我们仍然不确定为什么这是必要的,所以我不能评论这是一个好的做法。它将与它一起工作,而不是没有它。我不知道这是APEX的一些奇怪的人工制品,还是其他未知的问题。如果没有对象标记,它在FF和Safari中也可以工作。