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

Generating and Image and printing

Hi,

I am trying to create a "print preview" window for a web site using asp.net.
I have got a long way down the road to the solution but the problem I have
now is that the text and lines on the printed page are fuzzy.

The following code sample will illustrate the point:

Start of page load code sample
'=========================
Dim objBitmap As New Bitmap(648, 978)
objBitmap.SetResolution(600, 600)

'Declare Graphics objects for painting graphics onto bitmap.
Dim objGraphics As Graphics = Graphics.FromImage(objBitmap)

'Set the background color to white
objGraphics.Clear(Color.White)

objGraphics.PageUnit = GraphicsUnit.Millimeter
objGraphics.TextRenderingHint =
Text.TextRenderingHint.AntiAliasGridFit
objGraphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
objGraphics.InterpolationMode =
Drawing2D.InterpolationMode.HighQualityBicubic
objGraphics.CompositingQuality =
Drawing2D.CompositingQuality.HighQuality

Dim mFont As New Font("Arial", 0.5, FontStyle.Regular,
GraphicsUnit.Millimeter)

Dim sf As StringFormat = New StringFormat
sf.FormatFlags = StringFormatFlags.LineLimit +
StringFormatFlags.FitBlackBox + StringFormatFlags.NoWrap

objGraphics.DrawString("This is some test text. When you print the
bitmap, the text will be distorted.", mFont, Brushes.Black, 5, 5, sf)

objBitmap.Save("c:\MDPageImages\test.bmp", ImageFormat.Bmp)

objGraphics.Dispose()
objBitmap.Dispose()
'====================================
'End of page load sample

Note I have imported:

Imports System.Threading
Imports System.Globalization
Imports System.Drawing
Imports System.drawing.Imaging
Imports System.IO
Imports System.Text

This code sample will create an image to a folder on your local disk (you
may need to grant everyone permission to the folder to get it to work). If
you open the image, it looks fine. When you print the image the text is not
sharp and clear. The font also looks a bit strange.

Can anyone help? this has been driving me mad!!

Mark
Nov 22 '05 #1
0 770

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

Similar topics

0
by: JF Turcotte | last post by:
Hi I'm unsuccessfully trying to print a form's image under VB.NET. To print under .NET is a real pain in the , I find it to be complex, lenghty, confusing, upsetting and ultimately not to be...
0
by: Gary | last post by:
Hi, I am getting this error within vb.net when i try and print to a printer... "Value cannot be null." the line "e.Graphics.DrawImage9me.PictireBox1.Image,0,0)" is highlighted. My code...
0
by: Mark | last post by:
Hi, I am trying to create a "print preview" window for a web site using asp.net. I have got a long way down the road to the solution but the problem I have now is that the text and lines on the...
7
by: Mark | last post by:
Hi, I am trying to create a "print preview" window for a web site using asp.net. I have got a long way down the road to the solution but the problem I have now is that the text and lines on the...
4
by: CG3000 | last post by:
I create a .PNG image ( in Macromedia Fireworks ) which has an gif in it in the top left corner and a lot of empty canvas space to the right. I use about 10 text boxes on a form to populate...
7
by: needin4mation | last post by:
Hi, I have an Access 2002 - 2003 database. I am using Access 2003. Whenever I link an image all it shows is the filename. Not the image. Other versions of Access can link the image just fine. ...
7
by: Ben | last post by:
Hi We are looking for a component that offers that offers the below for Tiff files: Image clean-up (deskew, despeckle) Printing capabilities from VB The ability to add text to image, e.g....
2
by: bizt | last post by:
Hi, Is it possible to obtain the width/ height of an image when that image is dyanically created using a PHP script and passing GET attributes. For example: <img...
3
by: deciacco | last post by:
I'm trying to write a label printing SDI app with a small preview on the main form itself. Every time I run the InvalidatePreview event on the preview control to redraw the preview I get the...
0
by: gnewsgroup | last post by:
In my asp.net 2.0 web application. I create chart images on the fly by getting the data from the database. These chart images all have fixed width, but the height is dynamic depending on the...
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:
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
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,...

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.