shobhasana Posted April 4 Share Posted April 4 Hi guys, I have issue with connecting my printer Here is a scenario, I have a file called text.php from this php file i need to print output to printer which is connected to same network. Can u please me Quote Link to comment https://forums.phpfreaks.com/topic/319667-need-to-print-data-from-php-to-printer-which-is-connected-to-same-wifi/ Share on other sites More sharing options...
Barand Posted April 4 Share Posted April 4 Whenever I want to print, I write to a PDF file which then downloads to the browser for printing. Quote Link to comment https://forums.phpfreaks.com/topic/319667-need-to-print-data-from-php-to-printer-which-is-connected-to-same-wifi/#findComment-1620393 Share on other sites More sharing options...
gizmola Posted April 8 Share Posted April 8 The ability to print from a website is a local operating system capability, built into the browser. There is nothing special that PHP can do to help or hinder the process. Javascript can be used to invoke the built-in browser support for printing, but again, printing will always require the user to take action. For example, here is a simple button inside an anchor tag with some javascript. <a href="#" media="all" onclick="window.print();return false;"><button type="button">Print</button></a> You can use media queries in your css to style a page for printing by adding a style section like this: @media print { /* styles here */ } Typically people will hide things like menus, footers, nav, sidebars etc. You also might want to set a margin around the content, since typically printers have that constraint, so you might have something like this: @media print { header, footer { display: none; } } Here is a pretty good sitepoint article that goes into much more detail. Quote Link to comment https://forums.phpfreaks.com/topic/319667-need-to-print-data-from-php-to-printer-which-is-connected-to-same-wifi/#findComment-1620648 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.