使用cfhttp抛出base64错误获取pdf

时间:2015-01-16 10:30:03

标签: coldfusion

嗨,我正在使用cfhttp调用pdf文件页面

<cfhttp url="#pdfurl#" method="get" throwOnError="Yes" resolveurl="true" redirect="true">
    <cfhttpparam type="cookie" name="#st_cookieName#" value="#st_cookievalue#">
</cfhttp>
<cfset binary = toBinary(cfhttp.filecontent)>
<cfset tmpFile = getTempFile(getTempDirectory(),"pdf")>
<cfset fileWrite(tmpFile, binary)>
<cfheader name="Content-disposition" value="inline;filename=new.pdf" />
<cfcontent type="application/pdf" file="#tmpFile#" deletefile="no">

我收到错误:

The parameter 1 of function ToBinary, which is now %PDF-1.4%âãÏÓ 9 0 obj<</Linearized 1/O 11/H [ 1576 228 ]/L 72394/E 71398/N 1/T 72171>>endobj xref9 590000000016 00000 n 0000001522 00000 n 0000001804 00000 n 0000002110 00000 n 0000002253 00000 n 0000002311 00000 n 0000002369 00000 n 0000004525 00000 n 0000004583 00000 n 0000004686 00000 n 0000004744 00000 n 0000004847 00000 n 0000005190 00000 n 0000005232 00000 n 0000005275 00000 n 0000005381 00000 n 0000005667 00000 n 0000006882 00000 n 0000007030 00000 n 0000007598 00000 n 0000007907 00000 n 0000008140 00000 n 0000011766 00000 n 0000011915 00000 n 0000012364 00000 n 0000012606 00000 n 0000012840 00000 n 0000015312 00000 n 0000015455 00000 n 0000016226 00000 n 0000016646 00000 n 0000016874 00000 n 0000022797 00000 n 0000044306 00000 n 0000046758 00000 n 0000047483 00000 n 0000047525 00000 n 0000047568 00000 n 0000047674 00000 n 0000047817 00000 n 0000048357 00000 n 0000048645 00000 n... must be a base-64 encoded string. 

pdf网址是这样的:

https://example.com/pdfs/file_102.89E-02.pdf 

以下是我尝试使用方法的屏幕:head

enter image description here

0 个答案:

没有答案