Click here to Skip to main content
15,884,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need to extractmalayalam text from pdf.While extracting the text with itextsharp text extraction strategy some special characters are also coming with the text.

What I have tried:

I HAVE TRIED THIS
PdfReader pdfReader = new PdfReader(fileName);

for (int page = 1; page <= pdfReader.NumberOfPages; page++)
{
ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy();
string currentText = PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy);

text.Append(currentText);
}
pdfReader.Close();

I HAVE ALSO TRIED
byte[] bytes = Encoding.UTF8.GetBytes(ParseText);
byte[] converted = Encoding.Convert(Encoding.Default, Encoding.UTF8, bytes);
string final = Encoding.UTF8.GetString(converted);
Posted
Updated 15-Jun-16 23:34pm

1 solution

See How to extract text from PDF file with IDENTITY-H fonts using VB.NET - Stack Overflow[^]
When looking at the example there, I think there might be some possibility of reverse engineering the specific "identity h encoding" of your file. Get the bytes of the text first (byte[] bytes = Encoding.UTF8.GetBytes(ParseText);), but then use your own custom converter which changes some bytes to the correct values for Malayalam characters. It is your job to find out how they are mapped.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900