Creating and writing to a TIF file, how?

R

Robert Dufour

I need to create a tif file and write some simple text to it, about 4 or 5
lines, Just some thing like
"Hello this is mycompany"
"We will make a delivery between tomorrow 10 AM and tomorrow 10 PM"
I just want this to be in a fairly large font and centered, say in 14 point
Arial.

I've been googling for the last few days and find lots of stuff on Tif files
but nothing simple that seems to help me.

Can anyone point me to some sample code for doing the above?

Thanks for any help,

Bob
 
L

lord.zoltar

I need to create a tif file and write some simple text to it, about 4 or 5
lines, Just some thing like
"Hello this is mycompany"
"We will make a delivery between tomorrow 10 AM and tomorrow 10 PM"
I just want this to be in a fairly large font and centered, say in 14 point
Arial.

I've been googling for the last few days and find lots of stuff on Tif files
but nothing simple that seems to help me.

Can anyone point me to some sample code for doing the above?

Thanks for any help,

Bob

Hmm... TIFFs aren't simple! ;) Does it HAVE to be a TIFF? have you
considered other formats that might be easier to write to?
 
H

Herfried K. Wagner [MVP]

Robert Dufour said:
I need to create a tif file and write some simple text to it, about 4 or 5
lines, Just some thing like
"Hello this is mycompany"
"We will make a delivery between tomorrow 10 AM and tomorrow 10 PM"
I just want this to be in a fairly large font and centered, say in 14
point Arial.

Check out the 'System.Drawing' namespace, namely the 'Bitmap' and 'Graphics'
classes.
 
R

Robert Dufour

I have to end up with a Tif file, because I have to send it out as a fax and
the dialogic fax card I'm using only accepts txt and tif files.
I can send a txt file but the text is too small and the dialogic drivers
don't recognize embeddable tags for different font sizes. They only accept
pitch ar 10 or 17 char per inch. I could write to a PDF file (I have the C1
pdf component) and then convert it to tif with a converter to end up with a
Tif, but I would need to find a free or very unexpensive converter that I
can call from within code.
This is in a server app that runs unattended, so all the file converters
that I saw can't really be used, they all expect user interaction.

I need something that I can do automatically in code.

Bob
 
R

Robert Dufour

Thanks, I looked at that but it all seems to be conversions stuff, nothing
in it seems to allow one to create a tiff file from scratch. Maybe there is
but I could not see how.
Thanks,
Bob
 
I

ImageAnalyst

I need to create a tif file and write some simple text to it, about 4 or 5
lines, Just some thing like
"Hello this is mycompany"
"We will make a delivery between tomorrow 10 AM and tomorrow 10 PM"
I just want this to be in a fairly large font and centered, say in 14 point
Arial.

I've been googling for the last few days and find lots of stuff on Tif files
but nothing simple that seems to help me.

Can anyone point me to some sample code for doing the above?

Thanks for any help,

Bob

Bob:
You could try the LeadTools ocx.
http://www.leadtools.com/
It's not difficult to use.
Regards,
ImageAnalyst
 
W

William LaMartin

Here is some code to get you started. It will turn one line of text into a
Tif file. If you want more than one line you will have to add to it.

Dim MyFont As New Drawing.Font("Arial", 15, FontStyle.Regular)
Dim tempbmp As New Drawing.Bitmap(1, 1,
Drawing.Imaging.PixelFormat.Format24bppRgb) 'just to get the size of the
text string
Dim tempGraphic As Drawing.Graphics =
Drawing.Graphics.FromImage(tempbmp)
Dim TextSize As Drawing.SizeF
TextSize = tempGraphic.MeasureString(Me.txtMessage.Text, MyFont)
Dim MyBitmap As New Drawing.Bitmap(TextSize.Width, TextSize.Height,
Drawing.Imaging.PixelFormat.Format24bppRgb)
Dim MyGraphic As Drawing.Graphics =
Drawing.Graphics.FromImage(MyBitmap)
MyGraphic.Clear(System.Drawing.Color.White)
MyGraphic.DrawString(Me.txtMessage.Text, MyFont, New
Drawing.SolidBrush(Drawing.Color.Black), 0, 0)
MyBitmap.Save("C:\temp\texttographic.tif",
System.Drawing.Imaging.ImageFormat.Tiff)
 
E

ehsan m

hi , I'm in the same trouble as you , please help me in hurry if you have found anything useful . thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top