[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 397
  • Last Modified:

Coldfusion Convert URL to PDF

I am trying to convert a URL to PDF using the below code. However I am not able to open the PDF file. Any help is appreciated.

<cfhttp url="http://www.cnn.com"
        method="get"
        getAsBinary="yes"
        path="C:/test/"
        file="testFile.pdf"/>

<cfheader name="Content-Disposition" value="attachment; filename=myFile.pdf" />
<cfcontent type="application/pdf" file="C:/test/testFile.pdf" />
0
Errol Farro
Asked:
Errol Farro
1 Solution
 
_agx_Commented:
Edit:  CFHTTP just grabs the url "as is". So despite saving it as .pdf, the content is still html.  That's why the pdf won't open.

You're thinking of the cfdocument tag:

    <cfdocument src="http://www.cnn.com" format="pdf" />
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now