473,394 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to print With C/C++ to printer?

1,059 1GB
Hi,
I need some documentation about controlling printer in order to print text/image or what ever i need to printer using C/C++.
Os: Linux(Open Suse/ Cent OS)

Please suggest me some link

Best Regards,
Johny
Dec 1 '10 #1
9 6198
Oralloy
988 Expert 512MB
johny10151981,

You really don't want to directly drive printers, if you don't have to.

Also, binding yourself to a vendor specific I/O libraray is probably unwise in the long run.

I'd suggest that you generate .PDF (Adobe Acrobat) files, and use one of the standard printer drivers to handle the conversions. Also, I've not had to do a lot of prettyprinting under Linux recently, so there may be technologies that I'm not familiar with - google/yahoo is your friend....

Good Luck - this sounds like a lot of fun.

Please let us know what you come up with.

Cheers!
Oralloy
Dec 1 '10 #2
johny10151981
1,059 1GB
Oralloy,
Thanks for your reply.
In fact I have done all reports with PDF. But problem is there is some lazy users for whom i have to think this way.

The fact is Most of the issue is solved. But PDF is not helping in few issues. Like paper size. According to Adobe Acrobat documentation I tried to fix the paper size. But It is not working at all. Not getting any help either. Now I need to print some data in some specific Paper position. The software is being developed as web application (No external interaction). All printers are internal. The users are so lazy that they are not interested to fix the paper size before printing(And this is not their fault). So my evil plan is to make a external library for PHP using which The required voucher will be printed directly from Server not from the user station. That is why I was looking for a solution. If the server was Windows then it would be easier for me. Cause There is some API library provided for printing without dealing with printer hardware details.

Or if there is a better plan please let me know
Dec 2 '10 #3
Oralloy
988 Expert 512MB
johny,

It seems to me that there are utilities for configuring Linux printers, but I'm familiar enough with them to help you.

If you've got your output being piped through lpr or a similar utility, perhaps you can extract the sizing and positioning information from the .PDF files and use that as parameters to the command?

Good Luck!
Oralloy
Dec 2 '10 #4
johny10151981
1,059 1GB
The printer server is a Windows machine(working for long time). Web server is a linux machine(Newly installed). But If Printing from command line is available in that case I will be able to print them cause. In that case I wont deal with PDF. Cause I have few lines and a circle to print that individual document And I know all the sizing and position. If you help me, it will be great. :)
Dec 2 '10 #5
Oralloy
988 Expert 512MB
Johny,

You can shell out command lines from your code using system() calls or a combination of fork() and exec().

Do you know how to use them?

Cheers!
Dec 2 '10 #6
johny10151981
1,059 1GB
Yes I know them. But I still need the documentation.:)
Dec 3 '10 #7
johny10151981
1,059 1GB
Orally,
Thanks for your reply. I will study them.

And the plan is changed. Right now I am developing an Desktop application using C++. Which will communicate with HTTP server. connect with it with authentication and then get required data from HTTP server and finally print will be generated from user station according to user choice. The development would be faster If I can simply use C# or old dumb Visual Basic 6. But C++ is the cheaper one
Dec 5 '10 #9
Oralloy
988 Expert 512MB
Johny,

Good luck with it. I know that C# and VB come with a lot of higher-functionality out of the box, however there is a huge C++ eco-system out there that you can tap into. I'm pretty sure most of what you need you can download good examples of.

Luck!
Oralloy
Dec 6 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mario | last post by:
Hello, I am a new Python entusiast, I am studing it since some weeks and I think it's a great language and I was very happy with it, but when I came to make a printer routine I really got...
0
by: KohlerTommy | last post by:
In my application I need to give the user the ability to print duplex if the selected printer supports duplex printing. Many of the printer options do not make much sense in my application, and...
16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
4
by: Suzanka | last post by:
Hello, I have an application written in C# on visual studio .NET. It is a web aplication. The application consists of many different forms, that users occassionaly want to print out for filing....
0
by: Tessa | last post by:
Is there any security reason why you cannot print to a network printer from ASP.NET under IIS6 on Windows 2003 server? I'm using ASP.NET code to print to a server print queue using...
4
by: Grahammer | last post by:
This is a stupid question, but the examples I've seen don't make sense to me... I simply want to print the contents of a textbox to a printer when the user clicks a button on my form. Printing...
4
by: Charlie | last post by:
I need to print using the VB.net printing classes to a tractor feed printer. My client loaned me a Panasonic kx-p2123 to set up the job. I was able to print from Notepad using the Generic/Text...
3
by: Mika M | last post by:
Hi all! I have made an application for printing simple barcode labels using PrintDocument object, and it's working fine. Barcode printer that I use is attached to the computer, and this...
5
by: Raman | last post by:
Hello friends, I want to print an ID card. I have one Windows Form that contains front and back side. The printer is printing both front and back side at a time. I am trying to send both sides...
18
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I create a report, using the .NET Framework printing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.