I have an application that can write string to pdf file. I want to write data in tabular format so i formatted the string and did write operation. Text shows up in pdf file but its not in proper format. How to do it?
Example :
I want text to be shown as:
Name Address Phone number
Aditya Pune xxxxxxxx
It is actually shown as:
Name Address Phone number
Aditya Pune xxxxxxxx
I have used stringByPaddingToLenght method. So all strings are of same length.
Using Mono-space font solved my problem.
Related
I wanted to download an image from the web. But when I 'save image', it opens as a .txt file. I figure this is some type of encoding for the image but I can't find out which.
I want to eventually automate downloading the image for further processing, specifically text recognition. I've tried to convert the .txt using some online base64 encoders/decoders with no success. However, https://convertio.co/ was able to convert the .txt to .gif but I don't know how it did what it did.
I've given a sample of the .txt file. The actual file is much bigger.
The file name beings as such (if it helps):
data:image;base64,R0lGODlhyABGAIMAAPRDNvRDNvRDNvRDNvRDNvRDNvRDNvRDNvRDNvRDNvRDNvRDNvRDNvRDNvRDNv///ywAAAAAyABGAAAE+vDB (and it goes on, its very long).
GIF89aÈ�F�ƒ��ôC6ôC6ôC6ôC6ôC6ôC6ôC6ôC6ôC6ôC6ôC6ôC6ôC6ôC6ôC6ÿÿÿ,����È�F��úðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|úðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|úðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|úðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ|ðÁ;
I can see that there are '|' characters in between. May be for separating pixels.
The entire file is here: https://pastebin.com/BPbTHMZ7
It's seems to be a GIF image encoded as a data URL:
data:image;base64,R0lGODlhyABGAIMAAPRDNvRDNvRDNvR...
This format can be used in HTML and CSS file and is handy because the image data is directly embedded in the HTML/CSS file and does not need to be loaded with a separate request.
The start of the text basically says it's data URL, containing data for an image and the image is encoded using Base 64.
To decode it:
Chop off the start of the text, namely data:image;base64,.
Run the remaining text (R0lGODlhy...) through a Base64 decoder. The result will be binary data.
Save the binary data to a file using a file name with the extension .gif.
Now you have a proper GIF image as a file.
We have created an Outlook Plugin which (amongst other things) can be used to save Mail items in text form to a specific folder. However, the text of the resulting text file is encoded in ANSI and I would like to save it as UTF8. I have already set the Codepage of the mail item like so:
mail = (MailItem)objItem;
mail.InternetCodepage = 65001; // equal UTF8 encoding; see http://msdn.microsoft.com/en-us/library/office/ff860730.aspx
mail.SaveAs(filePath, olSaveAsType);
However, the resulting file is saved as "ANSI as UTF8" and all extended characters (e.g. in Arabic or Russian) come out as question marks.
Does anyone know how I can save the mail item in utf8?
Thanks a lot.
Cheers,
Martin
Instead of trying to set the encoding, try reading InternetCodepage and then using a System.Text.Encoding object to read the saved file into a string. You could then convert and re-save the string as another file in the encoding you prefer.
I wanted to restore some of the lost notes that I obtained by using an iTunes backup (of an iphone 4) and opening up the notes.sqlite file. When I query the table that contains the notes text:
select zcontent from znotebody
I get the text that is in html format. How can I convert those entries to a more readable content? It doesnt have to be perfect, just enough to be able to read it. Here is an example of a note:
Meds fir odd<div>Trazadone</div><div>Effexor (& Cd)</div><div>Buspirone</div><div>Clonodine</div><div>Nortriptyline</div><div>Risperdal</div><div>Straterra </div>
Here is the actual note from above:
Meds fir odd
Trazadone
(Effexor & Cd)
Buspirone
Nortriptyline
Risperdal
Straterra<space here>
If you just want to retrieve the note text, I would try this
select "" + zcontent + ""
from znotebody
Then save to a file and open in browser
You have to look some NSString categories, to escape html tags in your text.
Follow this link will help to solve the issue.. Objective C HTML escape/unescape
I'm creating a trivia iPhone app. I've written 1,000 questions or so in the mac app Numbers. The problem I'm having is that when I export the document to a CSV then open it in mySQL lite and save it as a database for the app, things like apostrophes turn out strangely for example "there's" would turn out as thereás instead. Is there any easy way to correct this issue?
Thanks,
Chris
This is happening because you are generating the CSV file from a MS doc or excel file
where
if i write "There’s" in MS Doc(look the apstrophe character)
but if i write same text in a simple text file "There's" (look the changed apstrophe character)
That is why the text is displaying as thereás due to character encoding problem.
So you have to change the (’)character in to (') to display it correctly.
I am making a directory for an app and I need to parse the the names, e-mail, phone #, and office for each item that I want to display in a UITableView. I have a class made but I have never really dealt with pasring anything past simple txt files.
I need to load a URL to a xml file, which consists of the following type of data at the bottom. It does not have xml tags, but it is saved as a .xml
I have read up on the NSXMLParsers, but I wasn't sure if that would be the correct way to do this or if there was an easier way.
Example of part of the .xml file below, this is just part of a few hundred lines that are organized in the same manner, by division, department, then person.
Thanks for any help!
http://cs.millersville.edu/School of Science and MathematicsDr.FirstH.LastRoddy Science CenterFirst.Last#millersville.edu872-3838Computer ScienceMrs.First.LastRoddy Science CenterFirst.Last#millersville.edu872-3858Computer ScienceDr.FirstH.LastRoddy Science CenterFirstH.LastRoddy#millersville.edu872-3470Computer ScienceDr.FirstH.LastRoddy Science CenterFirst.Last#millersville.edu872-3724Computer ScienceMs.FirstA.GilbertLast Science CenterFirst.Last#millersville.edu871-2214Computer ScienceDr.FirstH.LastRoddy Science CenterFirst.Last#millersville.edu872-3666
There's no way you can use a xml parser for this file.
Instead you may try to use NSScanner to parse the text file. A couple of tutorials are listed here:
Parsing CSV Data
Writing a parser using NSScanner
without the xml tags, your file is as good as a plain text file...
rows separated by new line character....
and each line contains data separated by a dot (.) or something like that. figure out the pattern and parse it like you would parse a text file...