user1269625
user1269625

Reputation: 3209

Codeigniter Print

I have an array of data and I have a print button, when someone hits the print button the print dialog box appears, can anyone suggest a tutorial to do this?

Thanks, J

Upvotes: 0

Views: 4619

Answers (2)

Brendan
Brendan

Reputation: 4565

window.print(); from JavaScript will open the print dialogue for the current page.

To print only your array, you'll need to do several things:

  1. Create a view which contains only the output of your array.
  2. Add the onload="window.print();" to the body tag of that view.
  3. Make the button link to this view, either via a popup or new page.

Upvotes: 2

John Conde
John Conde

Reputation: 219824

To make the print dialog you need JavaScript:

window.print();

Upvotes: 5

Related Questions