473,385 Members | 1,347 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,385 software developers and data experts.

Printing seems way too hard...

Is there an easy way to send a "Hello World" to the printer???
-- Dave
Jul 17 '05 #1
5 2195
"Dave D" <dd@ddnet.com> tried to express:
Is there an easy way to send a "Hello World" to the printer???


echo "Hello World" | lpr
Jul 17 '05 #2
I mean using Java!

-- Dave

"Wiseguy" <no***@celeron.local> wrote in message
news:40********@127.0.0.1...
"Dave D" <dd@ddnet.com> tried to express:
Is there an easy way to send a "Hello World" to the printer???


echo "Hello World" | lpr

Jul 17 '05 #3

"Dave D" <dd@ddnet.com> wrote in message
news:p2a3c.214730$uV3.826726@attbi_s51...
I mean using Java!

-- Dave

"Wiseguy" <no***@celeron.local> wrote in message
news:40********@127.0.0.1...
"Dave D" <dd@ddnet.com> tried to express:
Is there an easy way to send a "Hello World" to the printer???


echo "Hello World" | lpr



Dave,

Printers are controlled as graphical devices which means that simply
printing a piece of text has no direct support. It is very easy to get the
stuff you paint on a graphical component on a printer, but is is also not
trivial to print "hello world" on a graphical component.

Silvio Bierman
Jul 17 '05 #4
Runtime.getRuntime().exec("bash -c \"echo 'Hello World' | lpr\"");

;)

"Dave D" <dd@ddnet.com> wrote in message
news:p2a3c.214730$uV3.826726@attbi_s51...
I mean using Java!

-- Dave

"Wiseguy" <no***@celeron.local> wrote in message
news:40********@127.0.0.1...
"Dave D" <dd@ddnet.com> tried to express:
Is there an easy way to send a "Hello World" to the printer???


echo "Hello World" | lpr


Jul 17 '05 #5
I think Java's printing API pretty much sucks, too. If you're using
version 1.4.1 or above, you can use the PrintService class, which
makes printing certain types of documents easier:

http://java.sun.com/j2se/1.4.2/docs/...ntService.html

Most of the document types had not been implemented the last time I
looked at it, though.

If this doesn't work for you (which didn't in my case), you have to
manually pagenate your content and then draw it on a graphics pane:

http://java.sun.com/docs/books/tutorial/2d/printing/

Good luck.

-Nathan

"Dave D" <dd@ddnet.com> wrote in message news:<p2a3c.214730$uV3.826726@attbi_s51>...
I mean using Java!

-- Dave

"Wiseguy" <no***@celeron.local> wrote in message
news:40********@127.0.0.1...
"Dave D" <dd@ddnet.com> tried to express:
Is there an easy way to send a "Hello World" to the printer???


echo "Hello World" | lpr

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Mario | last post by:
Hello all, I'm trying hard to make possible to print some simple text from python to the default printer using wxPython, after days of internet searches I found this page:...
7
by: Dennis C. Drumm | last post by:
I was wondering if someone could suggest were/how I could get started with setting up printing of a collection of text that includes tables from a grid and other supporting information about the...
1
by: G.Esmeijer | last post by:
Friends, I'm (a bit) dissapointed about the printing possibilities in c#. It could also be lack of knowedge. I would like to align a text on the right side of the paper when printing. For...
2
by: orekin | last post by:
Hi There When printing in C#, it seems that the printer 'shifts' the print area down and to the right. So, even if the print document's DefaultPrintSettings margins are set to 0, the printed...
2
by: balaji r via .NET 247 | last post by:
I am right now involved in a vb to vb.net migration. Can you help me in giving me hints/tips in converting statements like: Printer.CurrentX = (Printer.ScaleWidth - Printer.TextWidth(strTmp) -...
7
by: DazedAndConfused | last post by:
I have a 8.5 x 11 landscape document with about 1/4 inch of space on the left and right where there is no print. The document displays perfect in print preview, but when I print it, about 1/2 inch...
12
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but...
4
by: Steve JORDI | last post by:
Hi, I'm using fpdf to create a report in PDF. Now the problem is that I want to print it directly to the client's default printer, with no intervention from the user. Is this possible? ...
8
by: Frank Rizzo | last post by:
I am trying to print huge images (much bigger than target paper). I try and use e.PageSettings.HardMarginX and e.PageSettings.HardMarginY in the PrintDocument's PrintPage event to try and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.