0

I am converting NSString into UIImage, my string in dynamic so content will be less or more. When i see my string in Log it shows string format properly but when it converts it into UIImage, formatting did not remain proper. Below is my string.

new delhi

new delhi

India

99XXXXXXXXX

2012-06-20 13:55:11

Order Id:291

Item Count:4

1 x Burger $5.00

Cheese                         $0.10

Modifier Item 1                $2.00

Modifier Item 3                $0.50

Modifier Item 4                $0.60

Amount                         $8.20

1 x Modifier Item 3 $2.00

Amount                         $2.00

1 x Modifier Item 4 $2.00

Amount                         $2.00

1 x Custom Price 78 $2.70

A a a a a a a a a a a a a a a a a a a a a a a a a a a a ma a a a a a a a a a a a a a a a a a. Aa aa a a. A anvhvhvhvb.  Hbghghvhvhmvjhvhjvhjftysfjhv.  

Amount                         $2.70

Subtotal:$14.90

Tax:$1.49

Grand Total:$16.39

Payment Type:Cash

Amount Paid:$16.39

I am not able to post image here. Please create image from this string so you will find that formatting is not proper.

user885314
  • 11
  • 4
  • In the first sentence you say that you are converting the string into an image. Following that, you say that the text in the image is not formatted properly. What code are you using to create this UIImage? Are you actually creating a UIImage or are you looking to display the text above formatted in a UILabel but are having trouble preserving the formatting of the text in the string? Show the code you are using to convert an NSString to a UIImage and users might be able to debug it to display as you would like. Also consider uploading the image somewhere (e.g. imgur.com) and posting a link. – Mat Kelly Jun 21 '12 at 20:53

1 Answers1

0

As far as I know, you cannot convert a NSString object into an UIImageObject. They represent very different things.

From what I understand, you would like to generate an image based on a text generated by your app. If so, try this Converting Text to Image

Community
  • 1
  • 1
BBog
  • 3,630
  • 5
  • 33
  • 64
  • Thanks to everyone, i have found the solution actually, i was sending this string to print in a printer and that printer supports raster printing in which first you have to create image and then you send command for printing. So problem was with formatting due to font which i was using because most of font handle each character space and width separately, but some font like "Courier" which i used handles each character's width and space in same manner. – user885314 Jun 27 '12 at 07:16