How to send data to the printer

Is there any function to fetch some content from the Cakephp controller side and send it to a file, which then opens a Print dialog to send it to the printer in Cakephp or JQuery?

+2
cakephp


source to share


1 answer


First, you might want to use a print style sheet. This will allow you to hide certain things from your layout when users print your pages, such as navigation, search box, footer, etc.

  • List: Articles: CSS Design: Moving to Print
  • Printing styles - css-discuss

Second, you can use jQuery to subtly insert a "Print this page" javascript link that will be activated by the browser's "Print" dialog on the user's screen upon activation.



  • JavaScript Unobtrusive Print Link (with jQuery) | Trevor Davis
  • Progressive extension with jQuery "MakeMineATriple

Since this is a client-side thing, there is no real CakePHP solution for this problem. The only thing you can do is disable or change the layout used in the controller like this:

  • $this->layout = false;

  • $this->layout = 'print';

+4


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics