473,385 Members | 1,912 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.

graphics & printing

When I draw (using DrawString() and other Draw...() methods) directly
to the PrintDocument using the PrintDocument's PrintPageEventArgs e,
the print-out comes out nice and sharp. But when I direct my graphics
to memory first then using PrintDocument's PrintPageEventArgs
e.DrawImage(), I get the image printed with the right scale and
everything, but the characters and everything else is blurry, out of
focus and just generally very bad.

I adjust the units of the DrawString() and other Draw...() methods
when I paint to memory because, I believe, the smallest printer unit
is 1/100th of an inch while the memory's is 1/300th of an inch or
thereabouts. But that is neither here or there, I just wanted to
mention it to say that I am already aware of the difference in units.
At any rate, the picture is in the right size but the image is so darn
fuzzy. I tried painting the memory image to a form first before
sending it to the printer and it paints fuzzy on the form too.

I played with SmoothingMode, TextContrast and TextRenderingHint and
others, to no avail.

I searched for solutions on microsoft's site, also to no avail.

Does anyone know why I am getting such fuzzy images when I paint to
memory first?. Am I missing a trick or something? Your help is
greatly appreciated.
jake

Apr 15 '07 #1
1 3768
On Sun, 15 Apr 2007 16:09:55 -0700, jake <ja********@gmail.comwrote:
When I draw (using DrawString() and other Draw...() methods) directly
to the PrintDocument using the PrintDocument's PrintPageEventArgs e,
the print-out comes out nice and sharp. But when I direct my graphics
to memory first then using PrintDocument's PrintPageEventArgs
e.DrawImage(), I get the image printed with the right scale and
everything, but the characters and everything else is blurry, out of
focus and just generally very bad.
I don't think "fuzzy" is a precise enough description of what's going
wrong for anyone to say for sure what you need to fix.

However, I'll suggest a couple of things. First, modern printers have
resolutions *much* higher than 1/100th of an inch (that would be 100 dpi),
while screen resolution is generally fixed at much less than 1/300th of an
inch (that would be 300 dpi, whereas the default under Windows is 96 dpi,
though it's hard to make a perfect determination due to varying display
sizes and resolutions). Second, if you draw your image to memory first
then the resolution of the image is limited to the resolution of the
destination memory image (Bitmap in this case, I assume). If you simply
use the default resolution for a memory image, then the image is going to
be lower resolution when drawn to memory first.

If you feel that you need to draw your image to memory before printing,
there are a couple of ways you can avoid the loss of resolution. The
first would be to create a Bitmap that has the same resolution as the
destination printer. Of course, you need to get the printer resolution to
do this, and of course the memory required may be large, or even
prohibitive (depending on the resolution of the printer and the size of
the paper).

An alternative would be to draw to a Metafile first, instead of a Bitmap.
The basic mechanism is essentially the same, but rather than your drawing
being rasterized into a pixel-based bitmap, the actual drawing calls are
recorded into the metafile. This has two effects: one, the size can be
much smaller, because its the commands that are stored, not each
individual pixel; and two, since the original drawing calls are stored,
when they are played back (drawn) to the printer, the full resolution of
the printer is used.

The above may or may not be of use. Since your problem description is so
vague it's hard to know what exactly the problem is. But hopefully it's
relevant.

Pete
Apr 15 '07 #2

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

Similar topics

7
by: DotNetDeveloper | last post by:
Does anyone have any opinion about this book: ".NET Graphics and Printing" Peter G. Aitken ISBN 1931097043 http://www.amazon.com/exec/obidos/ASIN/1931097046/ Can someone new to both...
0
by: lubprog | last post by:
hi, I am printing jpg files which are on a disk. The file name is selected from a database and the file is located on the disk and then printed. I am able to print the file but it takes a long...
0
by: Mark Davison | last post by:
Hi, I hope someone can help, this has been driving me mad! I am trying to generate a graphic on the fly. This is then shown in the browser in a "print preview" type window. The user can click a...
2
by: ECVerify.com | last post by:
I have a Graphics object in a control that has an image I want to print...I want to print my already made Graphics object that I use in a control, I try this Private Sub pd_PrintPage(sender As...
7
by: Michael Galvin | last post by:
I am trying to use Python to send to the printer a calender filled with a mix of text and simple graphics. I want to draw on the printed page something like a table with 6 rows and 7 columns to...
0
by: Tom McL. | last post by:
I am trying to print a form using the following code, everything works fine but the margins are not acted upon. What I am I doing wrong? Private Sub CaptureScreen() Dim myGraphics As...
6
by: Chris Dunaway | last post by:
The method for printing documents in .Net can be confusing, especially for newer users. I would like to create a way to simplify this process. My idea would be implemented using a PrintDocument...
2
by: DaveRook | last post by:
Hi I am coding a windows app in C#. The user enters a part number, clicks the button and information about the part number is displayed on the page, including text and graphics (pictures of...
3
by: arunman | last post by:
Hi, Im writing a C# .Net application to print in zebra 2030 thermal receipt printer (Uses 80 mm wide paper). I'm using the windows Graphics object for printing. string text = "Line1\n ...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.