irsd
irsd

Reputation: 11

Program for printing

I want to write a program for printing stuff on a paper, roughly what commands or classes do i need to use in c++ or php to get me started ?

Upvotes: 1

Views: 208

Answers (4)

Thomas Matthews
Thomas Matthews

Reputation: 57718

In C++, printing is handled by the operating system and thus platform specific. In general here are the following choices:

  1. Print to console, have OS redirect console output to printer.
  2. Print to file, then use OS to print to the file.
  3. Print to printer using printer name as filename
  4. Use OS API to print.

There are many ways in C++ to send data outside of the program. The standard methods are to use streams (using << operator) and C-style streams (using FILE * and fprintf).

Please provide platform information so more detailed assistance may be given.

Upvotes: 1

Ashay
Ashay

Reputation: 685

To print on the paper using php generally developers prefer JavaScript for the same, provided you are running your page on browser. The following code can used to do so

<a href="#" onclick="window.print(); return false;">Print Me</a>

Same kind of topic is discussed in following thread

Click this

Upvotes: 0

Jani Hartikainen
Jani Hartikainen

Reputation: 43243

Since you mention PHP, the easiest way out in this case would be to simply output HTML and CSS, using a browser to print it.

Besides that, I'm not aware of any ways of accomplishing this with just PHP.

Upvotes: 0

doron
doron

Reputation: 28892

Depends on which platform. For Linux I would look at: http://www.cups.org/

Upvotes: 0

Related Questions