473,324 Members | 2,214 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,324 software developers and data experts.

How to Print?

I am writing a program using Visual C++ Express Edition. This program
collects data from the user in a "Form".

What I would like to do is to print that data, in appropriate places, with
the text overlaying an image (.TIF,.gif,...) which is an 8.5 x 11 of the
boilerplate desired on the printed page.

My question is: Is there a *simple* way to accomplish this?

Everything I've been able to find in the "Help System" seems to indicate the
necessity for learning XML which is, at this time, a too trying task for me
to accomplish.
Aug 14 '08 #1
4 1581
On Aug 14, 7:24*pm, Steve Behman
<SteveBeh...@discussions.microsoft.comwrote:
I am writing a program using Visual C++ Express Edition. This program
collects data from the user in a "Form".

What I would like to do is to print that data, in appropriate places, with
the text overlaying an image (.TIF,.gif,...) which is an 8.5 x 11 of the
boilerplate desired on the printed page.

My question is: Is there a *simple* way to accomplish this?

Everything I've been able to find in the "Help System" seems to indicate the
necessity for learning XML which is, at this time, a too trying task for me
to accomplish.
No, you don't need XML for that sort of thing. Judging by your
description, you use Windows Forms for your GUI; if that is indeed the
case, you should read the docs on PrintDialog, PrintDocument, and
PrintPreviewControl classes. You only really need PrintDocument, and
specifically its PrintPage event - in it, you get a Graphics object
for the current page, and use the standard APIs from System.Graphics
to draw whatever you want on it.

On a side note, printing a raster image (.tif & .gif are both that) to
a printer is usually not a good idea - it will look blurry when scaled
to printer's DPI. Consider using a vector image (e.g. .wmf/.emf)
instead, or, if it's a simple frame, just drawing it directly from
your code.
Aug 14 '08 #2
Pavel, thanks again for the help.

Fortuitously the image has precisely the same resolution as the target
printer, so I don't think that the image will be blurred in any way when
printed.

As concerns "PrintDocument" I have searched everywhere I can think of for
C++ examples of its use -- with no success. The documentation has numerous
examples for everything but C++.

The use of this class seems sufficiently complicated that I am lost without
an example.

Pardon my naïveté, but would you please point me to an example written for
Visual C++?
"Pavel Minaev" wrote:
On Aug 14, 7:24 pm, Steve Behman
<SteveBeh...@discussions.microsoft.comwrote:
I am writing a program using Visual C++ Express Edition. This program
collects data from the user in a "Form".

What I would like to do is to print that data, in appropriate places, with
the text overlaying an image (.TIF,.gif,...) which is an 8.5 x 11 of the
boilerplate desired on the printed page.

My question is: Is there a *simple* way to accomplish this?

Everything I've been able to find in the "Help System" seems to indicate the
necessity for learning XML which is, at this time, a too trying task for me
to accomplish.

No, you don't need XML for that sort of thing. Judging by your
description, you use Windows Forms for your GUI; if that is indeed the
case, you should read the docs on PrintDialog, PrintDocument, and
PrintPreviewControl classes. You only really need PrintDocument, and
specifically its PrintPage event - in it, you get a Graphics object
for the current page, and use the standard APIs from System.Graphics
to draw whatever you want on it.

On a side note, printing a raster image (.tif & .gif are both that) to
a printer is usually not a good idea - it will look blurry when scaled
to printer's DPI. Consider using a vector image (e.g. .wmf/.emf)
instead, or, if it's a simple frame, just drawing it directly from
your code.
Aug 14 '08 #3
On Aug 15, 1:15*am, Steve Behman
<SteveBeh...@discussions.microsoft.comwrote:
Pavel, thanks again for the help.

Fortuitously the image has precisely the same resolution as the target
printer, so I don't think that the image will be blurred in any way when
printed.

As concerns "PrintDocument" I have searched everywhere I can think of for
C++ examples of its use -- with no success. The documentation has numerous
examples for everything but C++.

The use of this class seems sufficiently complicated that I am lost without
an example.

Pardon my naïveté, but would you please point me to an example written for
Visual C++?
MSDN mostly covers all 3 languages (C#, VB, C++/CLI) in its examples.
Have a look:

http://msdn.microsoft.com/en-us/libr...tdocument.aspx

The C++/CLI example is the third from the top - just make sure that
you have the "Language Filter" on the top of the page not set to hide C
++.
Aug 15 '08 #4
"Steve Behman" <St*********@discussions.microsoft.comwrote in message
news:98**********************************@microsof t.com...
Pavel, thanks again for the help.

Fortuitously the image has precisely the same resolution as the target
printer, so I don't think that the image will be blurred in any way when
printed.

As concerns "PrintDocument" I have searched everywhere I can think of for
C++ examples of its use -- with no success. The documentation has numerous
examples for everything but C++.

The use of this class seems sufficiently complicated that I am lost
without
an example.

Pardon my naïveté, but would you please point me to an example written for
Visual C++?

In addition to Pavel's reply...

when there's no C++ sample code in the docs, the C# code is pretty much
identical to what you need to do in C++ except for the obvious differences
in the dispose pattern, the scope resolution operator ("::" vs "."), and the
member access operator ("->" vs ".").

Mark
Aug 15 '08 #5

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

Similar topics

12
by: Michael Foord | last post by:
Here's a little oddity with 'print' being a reserved word... >>> class thing: pass >>> something = thing() >>> something.print = 3 SyntaxError: invalid syntax >>> print something.__dict__...
14
by: Marcin Ciura | last post by:
Here is a pre-PEP about print that I wrote recently. Please let me know what is the community's opinion on it. Cheers, Marcin PEP: XXX Title: Print Without Intervening Space Version:...
0
by: bearophileHUGS | last post by:
There is/was a long discussion about the replacement for print in Python 3.0 (I don't know if this discussion is finished): http://mail.python.org/pipermail/python-dev/2005-September/055968.html ...
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
1
by: Steff | last post by:
I am wandering if my code is making sense... I use a lot the print function. Is it weird in this case where I have to display an array ? I thought it would be better to have the entire array in php...
3
by: James J. Besemer | last post by:
I would like to champion a proposed enhancement to Python. I describe the basic idea below, in order to gage community interest. Right now, it's only an idea, and I'm sure there's room for...
69
by: Edward K Ream | last post by:
The pros and cons of making 'print' a function in Python 3.x are well discussed at: http://mail.python.org/pipermail/python-dev/2005-September/056154.html Alas, it appears that the effect of...
2
by: Brad Pears | last post by:
I have some sample code that uses the print dialog, print preview and a print direct options. If I select print preview and then click the printer icon from that, the document prints. If I...
7
by: samslists | last post by:
Am I the only one that thinks this would be useful? :) I'd really like to be able to use python 3.0's print statement in 2.x. Is this at least being considered as an option for 2.6? It seems...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.