Showing posts with label everywhere. Show all posts
Showing posts with label everywhere. Show all posts

Saturday, March 31, 2012

System.Drawing.Text font question

Hello,

I've looked for answer to this everywhere but with no luck..

I need to dynamically create graphic text from database values. I've got this working fine if I use arial as the font but I want to use another font.

Now - presumably I can use any font installed on the server? But it doesn't seem to work. I want to use a font called blurLight but it just outputs in arial (I think - it's a standard font anyway)

Is there anything else I need to do to make other fonts available to asp.net other than just installing them on the server???

Thank you.Post some code so we can have a looksie
Alright - I will

<%@. Page Language="VB" Debug="True" %>
<%@. Import Namespace="System.Drawing" %>
<%@. Import Namespace="System.Drawing.Imaging" %>
<%@. Import Namespace="System.Drawing.Text" %>
<%
' Declare Vars
Dim objBMP As System.Drawing.Bitmap
Dim objGraphics As System.Drawing.Graphics
Dim objFont As System.Drawing.Font

objBMP = New Bitmap(100, 30)

objGraphics = System.Drawing.Graphics.FromImage(objBMP)

objGraphics.Clear(Color.Green)

objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias

objFont = New Font("Arial", 16, FontStyle.Bold)

objGraphics.DrawString("Hello World", objFont, Brushes.White, 3, 3)

Response.ContentType = "image/GIF"
objBMP.Save(Response.OutputStream, ImageFormat.Gif)

objFont.Dispose()
objGraphics.Dispose()
objBMP.Dispose()
%

That code works fine but when I replace Arial with the font I want to use - it doesn't work..

Any ideas??

Monday, March 26, 2012

System.Net.Mail Error: Unable to read data from the transport connection: net_io_connectio

I've looked everywhere for an answer to this, but only a few people
seem to have encountered it.

The code is straightforward:

MailMessage mail = new MailMessage(from, to, subject, body);
SmtpClient client = new SmtpClient("localhost");
client.Send (mail);

The code works fine on my development machine (XP Pro). When moved to
staging (2003 Server), I get the "connection closed" error. I've
confirmed the following:

-- "localhost" resolves to 127.0.0.1 (also tried using the loopback
address with the same error)
-- SMTP service is running on port 25
-- service is configured to relay mail
-- another app (Community Server) is using the service to send email
without any problems.

I'm at wit's end

TIAAs usual, this problem was resolved out not long after posting this
message. The problem was how the SMTP service was set up.
Specifically, the service has been bound to a specific IP address (not
the webserver's; see the "IP Address" dropdown in the "General" tab).
Once this was set to "(All Unassigned)". Everything worked fine.
Hopefully this message will save someone the hours of aggravation I
endured.

nate.strules@.gmail.com wrote:

Quote:

Originally Posted by

I've looked everywhere for an answer to this, but only a few people
seem to have encountered it.
>
The code is straightforward:
>
MailMessage mail = new MailMessage(from, to, subject, body);
SmtpClient client = new SmtpClient("localhost");
client.Send (mail);
>
The code works fine on my development machine (XP Pro). When moved to
staging (2003 Server), I get the "connection closed" error. I've
confirmed the following:
>
-- "localhost" resolves to 127.0.0.1 (also tried using the loopback
address with the same error)
-- SMTP service is running on port 25
-- service is configured to relay mail
-- another app (Community Server) is using the service to send email
without any problems.
>
I'm at wit's end
>
TIA