Ramblings of the constant presence of Gates in my life RSS 2.0
 Wednesday, June 25, 2008

Well, as my previous post lamented, I had to do some clever CSS/HTML/JavaScript work arounds in a solution I am building to prevent undesirable user interaction with my site. And, it worked pretty well. Unfortunately, the PDF Viewer control I was using in there didn't!

Actually, let me be fair, it worked, just not completely for what I needed it to do. I need the users to laod a PDF into the IFrame by selecting the document in the list box right? No problem, that works. Now, if the user then selects the Save button in the PDF window, it needs to actually show the PDF file name in the Save text box on that window. This is where the 3rd party viewer tool and I completely disagree on things. It wants to ONLY use the base file name in the SRC property of the IFrame. This would be just fine and dandy if I were using static PDF files, but I am most certainly NOT. I have to render these PDF files out from a Database (by the way, this system is WAY cool). So, what happens is that the Save As shows my ASPX page name in the Save As text box. Not good. I don't want users seeing my page names unless I put them on that page myself. And, again to be fair, it isn't the controls fault, it is actually the Adobe Reader.

The solution: throw away that 3rd party tool, write my own HttpHandler, register the handler to cover all PDF files, and then fake the SRC tag of the iframe to point to a bogus PDF file with the name I want to show in the Save As box.

This solution gets my issue resolved, but it also gives me the ability to do SO much more. Now I can do all kinds of cool stuff with parameters on a PDF file that wouldn't have really been possible without that HttpHandler. And the best part: those handlers are a breeze to write. I will share some of that later.

Wednesday, June 25, 2008 9:08:09 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Posted By: Mark Wall
Blog Categories: .NET Dev
Advertisements
Archive
<June 2008>
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

Blogroll
Statistics
Total Posts: 27
This Year: 0
This Month: 0
This Week: 0
Comments: 3
Themes
Pick a theme:
All Content © 2012, Mark Wall