【发布时间】:2019-07-12 18:35:00
【问题描述】:
我曾经通过 url 打开我的 pdf 并让浏览器处理 pdf 呈现,但自从上次更新到 android 和 ios 后,这种方式不再适用于移动设备。
我决定使用 coldfusion 本身来处理这个问题,使用 cfpdf 函数并使用 cfcontent 将二进制文件外部化,效果很好,但是我在页面上有一个 google analytics 代码,并且 cfcontent 呈现整个页面,所以我丢失了我的分析代码的引用。
我暂时通过 iframe 调用我的 cfpdf 生成的此内容的解决方案,但是当通过 base64 使用 iframe 时,某些 pdf 的 base64 没有加载,已经作为一个普通的 url 使用了,我回到了无法在移动设备上工作的最初问题。
基本上我需要将我的分析标签插入到我的cfcontent的生成html中,但我无法手动操作源,因为内容来自cfpdf
<cfhtmlhead text='
<script async src="https://www.googletagmanager.com/gtag/js?id=#Key#"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag("js", new Date());
gtag("config", "#Key#");
</script>'>
<cfpdf action="read" name="RawFile" source="#RawUrl#" />
<cfcontent variable="#toBinary(RawFile)#" type="application/pdf" />
【问题讨论】:
标签: coldfusion base64 coldfusion-11 cfpdf