Forum Replies Created
- AuthorPosts
-
abctest483MemberDon’t do it that way. If you can’t generate unique IDs (or simply don’t want to) you should be doing it with CSS classes instead:
<a href="image.jpg" class="fancy"><img src="image_thumbnail.jpg"></a>with:
$(function() { $("a.fancy").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false }); });(from their usage page).
abctest483MemberProbably the best approach is to use the PDF.JS library. It’s a pure HTML5/JavaScript renderer for PDF documents without any third-party plugins.
Online demo:
https://mozilla.github.io/pdf.js/web/viewer.html
abctest483MemberTo stream the file to the browser, see Stack Overflow question How to stream a PDF file as binary to the browser using .NET 2.0 – note that, with minor variations, this should work whether you’re serving up a file from the file system or dynamically generated.
With that said, the referenced MSDN article takes a rather simplistic view of the world, so you may want to read Successfully Stream a PDF to browser through HTTPS as well for some of the headers you may need to supply.
Using that approach, an iframe is probably the best way to go. Have one webform that streams the file, and then put the iframe on another page with its
srcattribute set to the first form.
abctest483MemberFDView combines PDF2SWF (which itself is based on xpdf) with an SWF viewer so you can convert and embed PDF documents on the fly on your server.
xpdf is not a perfect PDF converter. If you need better results then Ghostview has some ability to convert PDF documents into other formats which you may be able to more easily build a Flash viewer for.
But for simple PDF documents, FDView should work reasonably well.
abctest483MemberNo offense, but it’s unclever to change class on-the-fly as it forces the CSS interpreter to recalculate the visual presentation of the entire web page.
The reason is that it is nearly impossible for the CSS interpreter to know if any inheritance or cascading could be changed, so the short answer is:
Never ever change className on-the-fly !-)
But usually you’ll only need to change a property or two, and that is easily implemented:
function highlight(elm){ elm.style.backgroundColor ="#345"; elm.style.color = "#fff"; }
abctest483MemberThis is easiest with a library like jQuery:
<input type="button" onClick="javascript:test_byid();" value="id='second'" /> <script> function test_byid() { $("#second").toggleClass("highlight"); } </script> - AuthorPosts