[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to Print to Printer from g++ program?



On Wednesday 11 February 2004 06:27, Thomas H. George wrote:
>
> If this question is regarded as wildly off target for this list, 

It probably is, and so, I'll not respond directly to your question, but 
rather ask a new one... :-)


> As a physicist I wrote large programs in Pascal before retiring in
> 1994 but nothing since until last week.  I thought of a problem I
> wanted to solve, read up on C++ and got my program working with only
> a few struggles with syntax

Great!

> but how to write directly to the printer has eluded me.  

I see. Well, I know very little about C++, but I also wrote a program 
some time ago in Pascal that produced pretty graphics on HP LJ 
III-series of printers. Nowadays, I think you would use a library that 
provides you with an abstraction layer to the printer. I have no 
experience there, but I think Qt has a print library, and it is written 
in C++.

However, are you sure that you are using the right tool for the job?

The nice thing about the Free Software community is that most problems 
are solved allready, the code is available, and it has undergone 
extensive though informal peer review. 

If it is a science problem, I would strongly recommend the R system. I 
used it for my thesis in astrophysics, and it is really very good. It 
has a very 1-to-1 correspondance between math and code, and makes any 
code you write easy to understand and it is very easy to get a good 
overview. It is really a statistics system, but as far as I'm 
concerned, it is good for any kind of science. It has a very strong 
community consisting of some of the main authorities in numerical 
statistics developing it. 

See http://www.r-project.org/

It is also packaged in Debian, just go apt-get install r-recommended. 

It has a large and improving graphics library that will let you make 
good graphs of your data. It also has bindings to C (and through that, 
C++) and FORTRAN, so you can reuse existing code within the R 
framework.

If it is not a science project, well, I find that programming at the 
relatively low level of C++ is usually quite painful and seldomly 
necessary. I tend to return to Perl programming whenever I need 
something done. 

There is a bunch of Postscript modules on CPAN:
http://search.cpan.org/search?query=postscript
They will probably assist you greatly, should you choose a Perl path. 


Best,

Kjetil
-- 
Kjetil Kjernsmo
Astrophysicist/IT Consultant/Skeptic/Ski-orienteer/Orienteer/Mountaineer
kjetil@kjernsmo.net  webmaster@skepsis.no  editor@learn-orienteering.org
Homepage: http://www.kjetil.kjernsmo.net/        OpenPGP KeyID: 6A6A0BBC



Reply to: