开发者

Convert Justified Paragraph To Image

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 th开发者_高级运维at. 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜