简体   繁体   English

PHP打印代码(打印到纸上)

[英]PHP Print code (print into paper)

Is there a PHP function to print something from a web page (inside the browser)? 是否有PHP函数可以从网页(在浏览器内部)打印内容?

I was searching in Google but the result is the print() function. 我在Google中搜索,但结果是print()函数。 Or any ideas, or any web programming language that you can share. 或您可以共享的任何想法或任何Web编程语言。 I need a code to print a list of subjects from my database. 我需要一个代码来打印数据库中的主题列表。 Sorry for this stupid question. 很抱歉这个愚蠢的问题。 I don't know if that is possible. 我不知道那是不可能的。

If you are talking about a web application, you can bring up the print dialog box with JavaScript using the window.print() function. 如果您正在谈论Web应用程序,则可以使用window.print()函数使用JavaScript打开打印对话框。

Without using activex or other such trickery, there is no way to automatically send something to the printer. 如果不使用Activex或其他此类欺骗手段,就无法自动将某些内容发送到打印机。

This is a good thing, imagine a malicious web site printing thousands of pages on your machine without your consent. 很好,想象一下一个恶意网站未经您的同意在您的计算机上打印了数千个页面。

If you are running a command line php that will depend on the operating system. 如果您运行的是命令行php,具体取决于操作系统。

尝试此操作,您需要添加php_printer.dll,然后启用该扩展名(在重新启动apache之后) http://in2.php.net/manual/en/function.printer-write.php

It's a little but unclear what you mean? 有点,但不清楚您的意思是什么? You can use a SQL query to get information from a database, and then use echo to print it out. 您可以使用SQL查询从数据库中获取信息,然后使用echo将其打印出来。 Is that what you mean? 你是这个意思吗?

If the intention is a print preview, where the user can click an “Print this” button and the server will print the document you can use CUPS if you use a Linux/Apple/BSD server. 如果要打印预览,则用户可以单击“打印此”按钮,并且服务器将打印文档,如果您使用Linux / Apple / BSD服务器,则可以使用CUPS。 http://www.cups.org/articles.php?L545+TNews+Q http://www.cups.org/articles.php?L545+TNews+Q

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM