CodingSome CFML Stuffs Me Do

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  Ken (SHIELDSIT)  
 To:  ALL
38447.1 

Peter. I have a few CF questions if you don't mind!

 

1. This one is probably more html or javascript, but is there a snippit of code that lets you print the page? Like put a "print this page" button on the site and let it print instead of having to hit Ctrl-P?

 

2. How can I remove the URL from a printed page?

 

ta you handsome man!



0/0
 Reply   Quote More 

 From:  Ken (SHIELDSIT)  
 To:  Peter (BOUGHTONP)     
38447.2 In reply to 38447.1 
This was too you, but I'm too dumb to pick you from a list!


0/0
 Reply   Quote More 

 From:  steve  
 To:  Ken (SHIELDSIT)     
38447.3 In reply to 38447.1 
javascript code:
window.print();


Will tell the browser to start the printing process; it'll usually bring up the print dialogue as if you have pressed CTRL+P. I don't think there's a way to just send a page to the printer without user invention, at least, I hope there isn't. Troll sites would be even more annoying.

You could, for instance, have an image (saying 'print this page!! :C') -

html code:
<img src="http://miffle.com/image.jpg" onClick="window.print();" />


Clicking that would start things. You're correct in saying this is all Javascript.

Regarding not printing the URL on the page, that's browser dependant. I came up against this making invoices for Rowdydow more automated: Chrome currently has no options for configuring the printed URL, page title and page number.

Internet Explorer does, and will remember the settings. Before I had it properly automated with a C# application, I had the Chrome extension to open a page in an IE tab - and printed it from there (it would remember my previous settings and print no URL).

HTH :)

0/0
 Reply   Quote More 

 From:  Ken (SHIELDSIT)  
 To:  steve     
38447.4 In reply to 38447.3 
quote:
HTH


Indeed it does, thanks a bunch!


0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  Ken (SHIELDSIT)     
38447.5 In reply to 38447.1 
Bah, you don't have any CFML questions for me, and Steve answered the ones you did ask... though not properly. :@

html code:
<img
    src="http://miffle.com/image.jpg"
    alt="print" 
    title="Click to print this page!"
    style="cursor:pointer"
    onclick="window.print();"
/>


* All image tags should have an alt tag, even if empty.
* Title is a good idea for anything which does something.
* As is setting the cursor to a pointer (though that should be in a class, not an inline style, really).
* The onclick attribute should be all lowercase, because I said so (it works either way).


If you really need to get rid of the URL, you'll have to look into generating PDFs, which browsers don't add their garbage to.
0/0
 Reply   Quote More 

 From:  steve  
 To:  Peter (BOUGHTONP)     
38447.6 In reply to 38447.5 
At least I remembered the slash at the end :$ The HTML for Rowdydow would make you cry.

0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  steve     
38447.7 In reply to 38447.6 
Please don't make me cry!

I'm already sad enough because I'm having to faff about generating XML so I can transfer data from one database to another because the stupid software doesn't have a real importer that would just let me map the appropriate columns directly, nor does it have a decent API (otherwise I'd create that importer myself), and it's all just a big faffing pain.


Oh, and closing slashes are starting to go out of fashion again now, with people finding out that HTML5 doesn't require them to write as XHTML.

I still prefer them, even though I don't otherwise use XML style, because it makes things more readable when scanning through a bunch of tags.
0/0
 Reply   Quote More 

 From:  Ken (SHIELDSIT)  
 To:  Peter (BOUGHTONP)     
38447.8 In reply to 38447.5 

Sorry, you were too late and Steve was on the ball!

 

I did figure out how to export my reports to Excel AND PDF files! It's turning into a nice project and the people at work who see it are really excited how it's turning out.

 

Never fear - I'm certain to have more questions for you!

 

Oh - I remember when I used to be really into CF (back in the olden days :)) There were places that would offer you free hosting for developers. Do you supposed you could offer free and/or paid hosting using Railo? Or is it against their TOS?



0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  Ken (SHIELDSIT)     
38447.9 In reply to 38447.8 
Whuh? Railo doesn't have ToS.

It's Open Source, and more specifically it's LGPL which explicitly enforces your freedom to do pretty much whatever you want with it.

There's already several hosting companies... Vivio and Alurium are two major ones, and for free hosting HostMedia offer free US-based hosting (£1 setup fee to deter scammers), and CFML Developer does the same in the UK.

Of course, with all the "cloud" stuff these days, a lot of Railo users are preferring to use Amazon EC2 and similar.
0/0
 Reply   Quote More 

 From:  Ken (SHIELDSIT)  
 To:  Peter (BOUGHTONP)     
38447.10 In reply to 38447.9 

Sorry I didn't mean ToS, but you understood what I was asking.

 

That would be a good idea to supplement some income for you. Then you could afford a bed!



0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Ken (SHIELDSIT)     
38447.11 In reply to 38447.10 
And a decent internet connection.
0/0
 Reply   Quote More 

 From:  Ken (SHIELDSIT)  
 To:  ANT_THOMAS     
38447.12 In reply to 38447.11 
Oh yeah, good point. Get rid of that shitty phone connection Peter!


0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  Ken (SHIELDSIT)     
38447.13 In reply to 38447.10 
Been there, done that. Too much effort for very little reward, so makes more sense to leave it to the guys that are already established.

I don't need to afford a bed. I use that one... *gestures* ...over there... oh... and I should probably see about doing so now, since I just realised it's 3:20am. Poo. :(
0/0
 Reply   Quote More 

 From:  Ken (SHIELDSIT)  
 To:  Peter (BOUGHTONP)     
38447.14 In reply to 38447.13 

:) There are a few of you on here that keep some late hours!

 

You are probably right, I can imagine it's a huge pain in the ass trying to make everyone happy and making sure things are secure enough when dealing with multiple customers on the same server.



0/0
 Reply   Quote More 

 From:  af (CAER)  
 To:  steve     
38447.15 In reply to 38447.3 
quote:
I don't think there's a way to just send a page to the printer without user invention, at least, I hope there isn't. Troll sites would be even more annoying.
That's exactly why no such way exists.

quote:
Regarding not printing the URL on the page, that's browser dependant.
In practice, true, but CSS3 has methods for controlling stuff like that:

http://www.w3.org/TR/2004/CR-css3-page-20040225/

Not that any browser really supports it yet.
0/0
 Reply   Quote More 

 From:  Ken (SHIELDSIT)  
 To:  ALL
38447.16 In reply to 38447.15 
You guys are the shit. I just got around to putting the print info on my site and it's working great! Thanks!


0/0
 Reply   Quote More 

 From:  Ken (SHIELDSIT)  
 To:  steve     
38447.17 In reply to 38447.16 

Hey is there a way to do this?

 

After I click an image and make the page print, make it automatically load a different page?



0/0
 Reply   Quote More 

 From:  af (CAER)  
 To:  Ken (SHIELDSIT)     
38447.18 In reply to 38447.17 
Surely that's just a case of
JavaScript code:
...
window.print();
window.location = "http://new.url.com";
0/0
 Reply   Quote More 

 From:  Ken (SHIELDSIT)  
 To:  af (CAER)     
38447.19 In reply to 38447.18 
I will let you know if you win or not! Just one second please!


0/0
 Reply   Quote More 

 From:  af (CAER)  
 To:  Ken (SHIELDSIT)     
38447.20 In reply to 38447.19 
I suspect the window.print() function returns immediately btw, so the page may well change straight away, rather than after the user clicks OK in the Print dialog.
0/0
 Reply   Quote More 

Reply to All  
 

1–20  21–40  …  61–75

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats