473,786 Members | 2,771 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Text on Image Resolution

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 that empty space with
text.
I then print the image ( from a picture box on my form) on a UPS
Thermal Printer ( label printer)
Problem is the resolution of the text is blurry.
I tried changing the image resolution but that made it print very
small.
I dont know if I should try a differnt image type other then .png.
The PC that prints the label is running XP. The below code is what
creates the image and prints it:
Private Sub btnMakeLabel_Cl ick(ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles Button1.Click
Dim imageName As String = "C:\Projects\Vi tex\VPG_Small_3 .png"
Dim i As Image = Image.FromFile( imageName)
Dim g As Graphics = Graphics.FromIm age(i)
Dim sf As StringFormat =
CType(StringFor mat.GenericTypo graphic.Clone() , StringFormat)
sf.Alignment = StringAlignment .Center
sf.LineAlignmen t = StringAlignment .Center
Dim dt As Date =
Date.Parse(Me.M onthCalendar1.S electionRange.S tart)
Dim lblMonth As Integer = dt.Month
Dim lblDay As Integer = dt.Day
'g.TextRenderin gHint =
Drawing.Text.Te xtRenderingHint .AntiAliasGridF it
g.DrawString(lb lMonth.ToString () + " " + lblDay.ToString (), New

Font("Helvetica ", 9, GraphicsUnit.Pi xel), Brushes.Black, New
RectangleF(65, 49, 50, 25), sf)
'g.DrawString(" Set # ", New Font("Helvetica ", 7,
GraphicsUnit.Po int), Brushes.Black, New RectangleF(50, 34, 50, 25), sf)

g.DrawString(Me .txtSet.Text + "", New Font("Helvetica ", 9,
GraphicsUnit.Pi xel), Brushes.Black, New RectangleF(48, 49, 50, 25), sf)

g.DrawString(Me .txtBackroll.Te xt, New Font("Helvetica ", 9,
GraphicsUnit.Pi xel), Brushes.Black, New RectangleF(38, 49, 50, 25), sf)

g.DrawString("O p: " + Me.txtOperatorI nitls.Text, New
Font("Helvetica ", 9, GraphicsUnit.Pi xel), Brushes.Black, New
RectangleF(5, 50, 50, 25), sf)
g.DrawString("C ode: " + Me.txtCode.Text , New Font("Helvetica ",
9, GraphicsUnit.Pi xel), Brushes.Black, New RectangleF(38, 2, 100, 25),
sf)
g.DrawString("S O: " + Me.txtS0.Text, New Font("Helvetica ", 9,
GraphicsUnit.Pi xel), Brushes.Black, New RectangleF(155, 1, 60, 25), sf)

g.DrawString("D esc:" + Me.txtDescript1 .Text, New
Font("Helvetica ", 9, GraphicsUnit.Pi xel), Brushes.Black, New
RectangleF(40, 12, 120, 25), sf)
g.DrawString(Me .txtDescript2.T ext, New Font("Helvetica ", 9,
GraphicsUnit.Pi xel), Brushes.Black, New RectangleF(49, 22, 120, 25),
sf)
g.DrawString("P O: " + Me.txtPurchOrd. Text, New
Font("Helvetica ", 9, GraphicsUnit.Pi xel), Brushes.Black, New
RectangleF(38, 34, 80, 25), sf)
g.DrawString("Q ty: " + Me.txtPressRepe ats.Text, New
Font("Helvetica ", 9, GraphicsUnit.Pi xel), Brushes.Black, New
RectangleF(127, 17, 90, 60), sf)
g.DrawString("R oll # 1", New Font("Helvetica ", 9,
GraphicsUnit.Pi xel), Brushes.Black, New RectangleF(107, 30, 120, 60),
sf)
g.Dispose()
Me.PictureBox1. Image = i
End Sub
Private Sub btnPrintLabels_ Click(ByVal sender As System.Object, ByVal e

As System.EventArg s) Handles Button2.Click
Try
'If you do not specify a printer it uses the default
'Me.PrntDoc_Img .PrinterSetting s.PrinterName = "Canon
MF3110"
Me.PrntDoc_Img. DocumentName = "Vitex Label"
AddHandler PrntDoc_Img.Pri ntPage, AddressOf Me.pd_PrintPage

PrntDoc_Img.Pri nt()
Catch ex As Exception
MessageBox.Show ("An error occurred while printing", _
ex.ToString())
End Try
End Sub
' Specifies what happens when the PrintPage event is raised.
Private Sub pd_PrintPage(By Val sender As Object, ByVal ev As
System.Drawing. Printing.PrintP ageEventArgs)
' Draw a picture.
'ev.Graphics.
ev.Graphics.Dra wImage(Me.Pictu reBox1.Image, _
ev.Graphics.Vis ibleClipBounds. Location)
' Indicate that this is the last page to print.
ev.HasMorePages = False
End Sub
End Class
Anything I can do to increase the text quality.

Mar 16 '06 #1
4 2136
Sounds like you're adding the text to the image and then printing the image.
You should probably send the image and then the text to the printer. The
printer driver will then render the text at the full resolution of the
printer.
"CG3000" <ca************ *@yahoo.com> wrote in message
news:11******** **************@ u72g2000cwu.goo glegroups.com.. .
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 that empty space with
text.
I then print the image ( from a picture box on my form) on a UPS
Thermal Printer ( label printer)
Problem is the resolution of the text is blurry.
I tried changing the image resolution but that made it print very
small.
I dont know if I should try a differnt image type other then .png.
The PC that prints the label is running XP. The below code is what
creates the image and prints it:
Private Sub btnMakeLabel_Cl ick(ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles Button1.Click
Dim imageName As String = "C:\Projects\Vi tex\VPG_Small_3 .png"
Dim i As Image = Image.FromFile( imageName)
Dim g As Graphics = Graphics.FromIm age(i)
Dim sf As StringFormat =
CType(StringFor mat.GenericTypo graphic.Clone() , StringFormat)
sf.Alignment = StringAlignment .Center
sf.LineAlignmen t = StringAlignment .Center
Dim dt As Date =
Date.Parse(Me.M onthCalendar1.S electionRange.S tart)
Dim lblMonth As Integer = dt.Month
Dim lblDay As Integer = dt.Day
'g.TextRenderin gHint =
Drawing.Text.Te xtRenderingHint .AntiAliasGridF it
g.DrawString(lb lMonth.ToString () + " " + lblDay.ToString (), New

Font("Helvetica ", 9, GraphicsUnit.Pi xel), Brushes.Black, New
RectangleF(65, 49, 50, 25), sf)
'g.DrawString(" Set # ", New Font("Helvetica ", 7,
GraphicsUnit.Po int), Brushes.Black, New RectangleF(50, 34, 50, 25), sf)

g.DrawString(Me .txtSet.Text + "", New Font("Helvetica ", 9,
GraphicsUnit.Pi xel), Brushes.Black, New RectangleF(48, 49, 50, 25), sf)

g.DrawString(Me .txtBackroll.Te xt, New Font("Helvetica ", 9,
GraphicsUnit.Pi xel), Brushes.Black, New RectangleF(38, 49, 50, 25), sf)

g.DrawString("O p: " + Me.txtOperatorI nitls.Text, New
Font("Helvetica ", 9, GraphicsUnit.Pi xel), Brushes.Black, New
RectangleF(5, 50, 50, 25), sf)
g.DrawString("C ode: " + Me.txtCode.Text , New Font("Helvetica ",
9, GraphicsUnit.Pi xel), Brushes.Black, New RectangleF(38, 2, 100, 25),
sf)
g.DrawString("S O: " + Me.txtS0.Text, New Font("Helvetica ", 9,
GraphicsUnit.Pi xel), Brushes.Black, New RectangleF(155, 1, 60, 25), sf)

g.DrawString("D esc:" + Me.txtDescript1 .Text, New
Font("Helvetica ", 9, GraphicsUnit.Pi xel), Brushes.Black, New
RectangleF(40, 12, 120, 25), sf)
g.DrawString(Me .txtDescript2.T ext, New Font("Helvetica ", 9,
GraphicsUnit.Pi xel), Brushes.Black, New RectangleF(49, 22, 120, 25),
sf)
g.DrawString("P O: " + Me.txtPurchOrd. Text, New
Font("Helvetica ", 9, GraphicsUnit.Pi xel), Brushes.Black, New
RectangleF(38, 34, 80, 25), sf)
g.DrawString("Q ty: " + Me.txtPressRepe ats.Text, New
Font("Helvetica ", 9, GraphicsUnit.Pi xel), Brushes.Black, New
RectangleF(127, 17, 90, 60), sf)
g.DrawString("R oll # 1", New Font("Helvetica ", 9,
GraphicsUnit.Pi xel), Brushes.Black, New RectangleF(107, 30, 120, 60),
sf)
g.Dispose()
Me.PictureBox1. Image = i
End Sub
Private Sub btnPrintLabels_ Click(ByVal sender As System.Object, ByVal e

As System.EventArg s) Handles Button2.Click
Try
'If you do not specify a printer it uses the default
'Me.PrntDoc_Img .PrinterSetting s.PrinterName = "Canon
MF3110"
Me.PrntDoc_Img. DocumentName = "Vitex Label"
AddHandler PrntDoc_Img.Pri ntPage, AddressOf Me.pd_PrintPage

PrntDoc_Img.Pri nt()
Catch ex As Exception
MessageBox.Show ("An error occurred while printing", _
ex.ToString())
End Try
End Sub
' Specifies what happens when the PrintPage event is raised.
Private Sub pd_PrintPage(By Val sender As Object, ByVal ev As
System.Drawing. Printing.PrintP ageEventArgs)
' Draw a picture.
'ev.Graphics.
ev.Graphics.Dra wImage(Me.Pictu reBox1.Image, _
ev.Graphics.Vis ibleClipBounds. Location)
' Indicate that this is the last page to print.
ev.HasMorePages = False
End Sub
End Class
Anything I can do to increase the text quality.

Mar 16 '06 #2
I am adding the text to the image and then printing it.

How do you send the image and the text separate?

Ill be honest and see I know how to print ONE document at a time. Not
send a document in "pieces"

Mar 16 '06 #3
I use VB6 and have only used dot net a couple of times (don't even have it
installed at work yet). But I would assume that after you send the image to
the printer with:

ev.Graphics.Dra wImage(Me.Pictu reBox1.Image,
ev.Graphics.Vis ibleClipBounds. Location)

You could then send the text.

ev.Graphics.Dra wString(Me.txtS et.Text + "", New Font("Helvetica ",
9,GraphicsUnit. Pixel), Brushes.Black, New RectangleF(48, 49, 50, 25), sf)

You will probably need to adjust the sizes of the font, and the rectangle as
you are now working with the printer units, not the image units. I think in
VB6 by default each inch = 1440 pixels... not sure what it is in dot net.
Hopefully this will point you in the right direction as I can't test it
here.

"CG3000" <ca************ *@yahoo.com> wrote in message
news:11******** **************@ z34g2000cwc.goo glegroups.com.. .
I am adding the text to the image and then printing it.

How do you send the image and the text separate?

Ill be honest and see I know how to print ONE document at a time. Not
send a document in "pieces"

Mar 16 '06 #4
Enfor thank you. I think you are right.

I did what you said in a small test and it worked.

I dont understand GDI+ to a greath depth but I read this has something
to do with the text resolution being separate from the PCs resolution.

Ill let you know after I add all my text box values. I initially tried
one text box value and I saw a HUGE diff in the resolution.

Mar 17 '06 #5

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

Similar topics

8
2454
by: Chris Beall | last post by:
I'm struggling with how to handle, on a web page, images that contain text that the user must be able to read. Examples: tombstone photos, photos or scans of historic documents (handwritten or typed), a map with place names, route numbers, etc. (An appropriate alternative for audio UAs would be provided and is not a part of my concern). I see two ways to handle these images: 1. Dynamic scaling, with the source image containing enough...
2
2183
by: Ben Amada | last post by:
Hi group. I'm going to display a low resolution image in an HTML page. On the web server, I have a high resolution version of that image. If I display the high resolution image in the browser for the visitor to print, won't the DPI of the image be reduced to 72 dpi and lose resolution when the visitor goes to print the image? If this is wrong, please let me know. If this is correct, is there a way in JavaScript to be able to send the...
3
2766
by: UJ | last post by:
My client wants to have some text scale appropriately depending on the resolution of the screen. This is very much like the way that flash works in that as the area being displayed gets bigger, the font gets bigger, smaller - it gets smaller. Trying to write flash is turning out to have some problems and it sorta works (I found a library by ComponentOne which does most of the stuff but not everything.) One thing to make it a bit easier...
14
4033
by: Roger Withnell | last post by:
How to I find out what size text the browser is set to? Thanks in anticipation.
0
1661
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 that empty space with text. I then print the image ( from a picture box on my form) on a UPS Thermal Printer ( label printer) Problem is the resolution of the text is blurry.
3
2599
by: Andy Baxter | last post by:
I have an image scrolling in a viewport for a panoramic image viewer. The viewport can be resized to several set resolutions so people can adjust the size according to their bandwidth. There are hotspots on the image which have been defined using an image map. This map is generated in javascript using the following code (in the object 'tour.'): makeImageMap: function() { // creates an HTML nodeset which is an imagemap for the current...
3
2529
by: =?Utf-8?B?SlIx?= | last post by:
I would like to add text to an image. I have tried to use DrawString and it works on some images but on others it is very very small. I am pretty sure it has something to do with the size of the image but I have had varying results on multiple images. Is there anyway to make the text a fixed size on the image. Similar to putting a date on a photograph.
6
7526
by: bradyounie | last post by:
I'm writing a program that displays a user-supplied Bitmap and then writes text fields to it. These "text fields" are things that the user can move around on the image, but to render them efficiently, I draw the text directly to the image. It's faster that way. The problem is that right now I have to redraw the original (unwritten-to) bitmap and redraw the text whenever the user moves the text because I haven't figured out how to properly...
0
9655
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9497
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10169
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.