在C中通过网络打印 [英] printing over a network in C

查看:56
本文介绍了在C中通过网络打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的桌面直接打印到网络打印机.在哪里可以找到示例?我已经做过一段时间了,但是不记得了.谢谢.



甚至还不到一半.我实际上需要对pcl代码进行硬编码,以将一些数据发送到具有预打印表格的printonix打印机,在该表格中,我必须将数据准确地放置在某些位置.现在,我只希望能够直接打印到网络上的打印机.我知道Windows有一些允许用户选择打印机的api,但是如果我要直接访问打印机,我想知道是否需要使用套接字.

解决方案

查看或多或少的高级文本编辑器,图形编辑器,Web浏览器或IDE.他们是否有使用网络打印机进行打印的特殊功能?我会说,永远不会.他们只是使用用户选择的打印机进行打印,首先建议使用默认打印机(任何可用的打印机).您也应该这样做,除非您想通过一种或另一种特殊功能来吓users用户.

—SA


您需要安装打印机驱动程序,很可能会在这里找到它:
http://www.printronix.com/products/drivers.aspx#2147483655 [ ^ ]

安装并配置了打印机驱动程序后,您可以使用 ^ ]函数.

您可以使用 EnumPrinters 来获取可用打印机的列表. a> [ ^ ]


您可以使用 WritePrinter [ ^ ]功能直接将数据发送到打印机,但是使用 ^ ]或GDI +.

最好的问候
Espen Harlinn


谢谢Espen.我很感谢Windows API的反馈,这是我需要的事情之一,我终于找到了我7年前编写的应用程序,但这很好,非常感谢.打印机已经投入生产,并且这是由大型机完成的,该大型机将一些文件发送到放置区,而进行打印的人员会捡起该文件并将其发送给打印机本身.他们只是想替换大型机,直到预格式化的页面用完,然后他们将移动到其他打印机,并且如果我们使用Java,可能会使用Adobe Live Cycle或jasper之类的东西.


I would like to print directly to a network printer from my desktop. Where can i find examples? I have done this a while back but cannot recall. Thank you.

[EDIT — moved from "solution" — SA]

That''s not even the half of it. I will need to actually hardcode the pcl codes to send some data to a printonix printer with forms preprinted where i have to place the data exactly in certain locations. Right now, i just want to be able to print directly to a printer on the network. I know windows had some api''s that allowed a user to select the printer, but if i am going to directly access the printer i wonder if i need to use sockets.

解决方案

Look at any more or less advanced text editor, graphic editor, Web browser or IDE. Do they ever have anything special to print using a network printer? I would say, never. They just print using a printer selected by the user, suggesting the default printer first, it any is available. You should do this, too, unless you want to scare off your users by one or another kind of ad-hoc functionality.

—SA


You need to install the printer driver, and it''s likely you''ll find it here:
http://www.printronix.com/products/drivers.aspx#2147483655[^]

Once you have installed and configured the driver for your printer you can get a handle to the printer using the OpenPrinter[^] function.

You can get a list of available printers using the EnumPrinters[^]


You can use the WritePrinter[^] function to send data directly to the printer, but it''s usually easier to use GDI[^] or GDI+.

Best regards
Espen Harlinn


Thank you Espen. I appreciate the feedback on the windows APIs, that''s one of the things i need, i finally found an application i wrote 7 years ago but this is great, thanks a lot. The printer is already in production and this was being done by a mainframe which sent some file to a dropzone and the people doing the printing would pick it up and send it to the printer itself. They just want to replace the mainframe until the pre-formatted pages run out then they will move to some other printer and probably will use something like adobe live cycle or jasper if we go with java.


这篇关于在C中通过网络打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆