开发者

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:

  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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜