dotkpay Posted January 5, 2012 Share Posted January 5, 2012 Hello, I have an application that prints a message after processing but the problem is that the window.print function of js prints a whole web page and not a particular message for example something like "hello". Could anyone please show me how to print a specific message from a php script and not the web page. Another issue I have is the windows 7 dialog that comes up after js function window.print is activated. Is there a way I can make my application skip this dialog and print directly? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/254435-javascript-printing/ Share on other sites More sharing options...
Labradoodle-360 Posted January 6, 2012 Share Posted January 6, 2012 Are you looking for something like echo ''; or print(); ? If not, in JavaScript, something like alert();? Quote Link to comment https://forums.phpfreaks.com/topic/254435-javascript-printing/#findComment-1304702 Share on other sites More sharing options...
scootstah Posted January 6, 2012 Share Posted January 6, 2012 Are you using an AJAX response? If so, you need to only be outputting the specific message from the PHP script and not the entire HTML layout. Quote Link to comment https://forums.phpfreaks.com/topic/254435-javascript-printing/#findComment-1304731 Share on other sites More sharing options...
dotkpay Posted January 6, 2012 Author Share Posted January 6, 2012 In this case I mean physical printing on paper and not just printing to a screen like echo or document.write. The message to be printed is as a result of ajax because the page is not reloaded whereas the message comes form a php processing file Quote Link to comment https://forums.phpfreaks.com/topic/254435-javascript-printing/#findComment-1304794 Share on other sites More sharing options...
Adam Posted January 6, 2012 Share Posted January 6, 2012 You need to use a "print" media stylesheet to hide any elements you don't want printed to paper, and to style how the page should look. Quote Link to comment https://forums.phpfreaks.com/topic/254435-javascript-printing/#findComment-1304826 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.