Convert Justified Paragraph To Image

Posted by rsrobbins on Stack Overflow See other posts from Stack Overflow or by rsrobbins
Published on 2010-04-26T13:56:13Z Indexed on 2010/05/30 4:22 UTC
Read the original article Hit count: 209

Filed under:
|
|

I need to convert a paragraph of text into an image. Converting the text into an image is no problem. I have the code to do that. But the text must be shown as a paragraph with each line centered. That is a problem!

Currently I can convert the text into a left justified paragraph because there are carriage returns in the text string. I suppose it could be center justified with spaces in the string but it would be hard to calculate the required spaces. There must be an easier way.

What I need is some way to format the text into a paragraph and then convert it back into a string, preserving spaces. This needs to be done in VB.NET for an ASP.NET web application.

Any ideas? I could get the paragraph justified in Rich Text Format but I don't know if it can be converted back into a string, preserving spaces. Creating a PDF is another possibility.

The image created from the text needs to be 300 DPI with a transparent background. I'm using the DrawString method of a Graphics object to create the image.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about ASP.NET