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 ?
In C++, printing is handled by the operating system and thus platform specific. In general here are the following choices:
- Print to console, have OS redirect console output to printer.
- Print to file, then use OS to print to the file.
- Print to printer using printer name as filename
- 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.
Depends on which platform. For Linux I would look at: http://www.cups.org/
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.
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
精彩评论