0

Internet Explorer VS Acrobat ActiveX Controls

ColdFusion
At the company I work for, we have a few apps that serve up PDF documents directly from a BLOB (binary large object) stored in the database.  "Luckily" for me, IE recently made changes to disable ActiveX controls in the browser.   Obviously, that change broke stuff in my apps.
(Have I ever mentioned how much I love IE?

The code that performed these functions was written way before I was hired on, and was actually an .asp file that did the querying for the binary object and embedding the PDF. 

The tasks I layed out to repair this issue:
  1. Create a 100% ColdFusion solution (ColdFusion is the goodness)
  2. Make it work in IE
I ended up with my getFile() method which takes the appropriate arguments and then calls some other appropriate methods, to ultimately serve my PDF document to the user  with no embedding issues.

The real meat of the solution comes from just a few simple lines of code that take the binary object and make it writeable as PDF.


<!---convert the binary object to a string with base64 encoding--->
<cfset theDocument = toString(tobase64(BinaryDataVariable)) />

<!---write the file to the server temporarily--->

<cffile action="write" output="#binaryDecode(theDocument,"base64")#" file="C:\SomePlaceOnTheServer\filename.pdf">

<!---serve it to IE no problems --->
<cfcontent type="application/pdf" file="C:\SomePlaceOnTheServer\filename.pdf" deletefile="true"> 

(Please forgive the line breaks)
tags:
ColdFusion
Jorrit said:
 
How does this work with two simultainious downloads? Will they overwrite each other?
Or do you need to use nameconflict="MAKEUNIQUE"
 
posted 1261 days ago
Add Comment Reply to: this comment OR this thread
 
 
Good question, in my implementation I appended a UUID to the filename.

Thanks,
Aaron
 
posted 1261 days ago
Add Comment Reply to: this comment OR this thread
 

Search

Fuelly