on 03-16-2005 12:52 PM
Surfing SDN is really slow from my place of work.
The network guys blame the SDN server but I don't think this is so as I surf with no problem from home. What I do is print weblogs at home and take it to wotk to try out. The problem I face is that the code is always cut off as it only prints displayed in the window and not the code further down. Is it possible to make the print button on the weblogs print the code on subsequent pages.
Thanks
Faaiez
The best thing would be to change SDN to print properly from all browsers. I must admit that I haven't needed to print from SDN since I've changed jobs so perhaps it does work now. Thanks Guys.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Faaiez, Don't forget to reward points. Craig and I spent some time in giving you possible solutions. Thanks for the understanding.
Eddy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually, this sort of problem IMHO ought to be solved with a specialized stylesheet for the printing.
I investigated it a bit more today, but only got the solution working on IE , not firefox (go figure
What must be done is
1. Add a media="screen" to the existing style sheet
2. Add a new stylesheet with media="print" (I'tested by including the same and overwriting the what I needed)
3. In this new stylesheet make the textareas overflow
<!--Existing stylesheet changed slightly-->
<link rel="STYLESHEET" media="screen" type="text/css" href="https://weblogs.sdn.sap.com/css/csin.css" />
<link rel="STYLESHEET" media="screen" type="text/css" href="https://weblogs.sdn.sap.com/css/csin.css" />
<!--"Overwritten" styles. Should be in the file above instead-->
<style media="print">
textarea { overflow: visible;}
</style>
Including this makes it work in IE, but obviously firefox doesn't implement overflow in the same way (the CSS specs say that the user-agent might allow the content to overflow)
I've tried various other hacks in firefox (such as the content:before and after), but they all failed. My thought was that perhaps I could subsitute the textarea element with another, but I don't think it is possible with CSS (at least not what is implemented in current browsers). Which leaves us with the javascript solution (and I wasn't able to call the javascript only when I rendering the print version).
A solution is to set the css height property for the print stylesheet for the textarea element, but then all the elements have the same size (eventhough the text is alot shorter).
Any thoughts on how to make this work in firefox ?
My initial comment when starting my question was that logging onto SDN from work is a problem. I keep geeting timeouts etc I tried a million times since Thursday to thank you guys and reward you but to no avail. Hopefully this one will go through now. Thank you very much for your contribution.
You mean because of the textarea's? Perhaps some fany JavaScript could alter the textarea command to pre tag or something or maybe the wizards at SDN have a solution already?
For example if you use FireFox or Maxthon or one of the various other browser wrappers you can create a samll plugin that would accomplish something like that similiar to this: http://web.tampabay.rr.com/bmerkey/examples/print-endnotes.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just playing around a bit I came up with this. You just then have to modify your favorite browser (which allows this type of thing)
<style type="text/css">
body {color: black; background-color: white;}
#endnotes {
margin-top: 4em;
border-top: double medium #6666cc;
}
#endnotes h3 {
letter-spacing: 2pt;
font-variant: small-caps;
margin: 5pt 0;
}
#intro h3 {color: #6666cc}
sup {cursor: help; color: #6666cc}
li {margin-left: -1em;}
</style>
<style type="text/css" media="print">
body {font-family: Garamond, Georgia, serif;}
div#intro {display: none;}
</style>
<script type="text/javascript">
function window.onbeforeprint() {
/*Assume all TEXTAREA elements are endnotes.*/
var collNotes = document.getElementsByTagName("TEXTAREA");
var sHTML = "<div id='endnotes'><h3>Code Samples</h3><br>";
for (var idx=0; idx < collNotes.length; idx++) {
oNote = collNotes[idx];
// Add all footnotes to the inserted HTML string
sHTML += "<pre><code>"+ oNote.innerHTML + "</code></pre>";
}
sHTML += "</div>";
document.body.insertAdjacentHTML("beforeEnd", sHTML);
}
function window.onafterprint() {
endnotes.outerHTML = "";
}
</script>
Just adding that small bit of code to a page and hitting print and you'll see the nice code examples all at the end of the document in their entirety. You can also think about replace the current Textareas to show a reference to the new printout at the end.
Or perhaps SDN can add it to the print function they already have in place????
Hi,
I've also being playing around.
Remember my weblog for printing forum threads in Firefox (/people/eddy.declercq/blog/2005/01/31/how-to-print-an-sdn-forum-thread-in-firefox-in-a-nice-and-easy-way)? Well I've made something simular for this problem. It works fine in Firefox & co.
Sometimes you get an uncaught exception: permission denied, due to the fact that you can't do cross domain stuff. Then retrieve the weblog with
https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/pub/wlg/
instead of
http://sdn.sap.com/sdn/weblogs.sdn?blog=/pub/wlg/
Just copy/paste it in the URL bar after loading the weblog you want to print. Here is the code:
javascript:id=document.getElementById(%22iframecontent%22).contentWindow;ta=id.document.getElementsByTagName(%22TEXTAREA%22);for (i=0; i<ta.length;i+) {cr=1; idx=0;while ( true ) {idx = ta<i>.value.indexOf("\n", idx1);cr ++;if ( idx == -1 ) break;}ta<i>.rows=cr;}id.print();
I'll try to make a weblog on it in order to explain the code, but for now you can print textareas in full length;-)
Eddy
User | Count |
---|---|
3 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.