views:

18

answers:

1

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.

A: 

I do not have a specific answer, but if I were trying to solve the same problem, i would utilize the following resource:

View the Captions with Paragraphs section of the following imagemagick page: http://www.imagemagick.org/Usage/text/

below that on the page is information on centering text.

hamlin11