Hi,
I want to use aspose to search through a PDF document that contains Arabic and Hebrew characters and find a word.
Today it only finds latin (English) words.
How can I achieve this?
Regards.
Hi,
I want to use aspose to search through a PDF document that contains Arabic and Hebrew characters and find a word.
Today it only finds latin (English) words.
How can I achieve this?
Regards.
Hi Tzach,
//open
document<o:p></o:p>
Document pdfDocument = new Document("c:/pdftest/For+Arabic.pdf");
//create TextAbsorber object to find all instances of the input search phrase
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("التوقيع");
//accept the absorber for all the pages
pdfDocument.Pages.Accept(textFragmentAbsorber);
//get the extracted text fragments
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
//loop through the fragments
foreach (TextFragment textFragment in textFragmentCollection)
{
foreach (TextSegment textSegment in textFragment.Segments)
{
Console.WriteLine("Text : {0} ", textSegment.Text);
Console.WriteLine("Position : {0} ", textSegment.Position);
Console.WriteLine("Font - Name : {0}", textSegment.TextState.Font.FontName);
Console.WriteLine("Font Size : {0} ",textSegment.TextState.FontSize);
Console.WriteLine("Page Number : {0} ", textFragment.Page.Number);
}
}
Hi Nayyer,
Hi Tzach,
Hi,
Hi Tzach,
//open
document<o:p></o:p>
Document pdfDocument = new Document("c:/pdftest/UniCode_Character.pdf");
//create TextAbsorber object to find all instances of the input search phrase
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("点");
//accept the absorber for all the pages
pdfDocument.Pages.Accept(textFragmentAbsorber);
//get the extracted text fragments
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
//loop through the fragments
foreach (TextFragment textFragment in textFragmentCollection)
{
foreach (TextSegment textSegment in textFragment.Segments)
{
Console.WriteLine("Text : {0} ", textSegment.Text);
Console.WriteLine("Position : {0} ", textSegment.Position);
Console.WriteLine("Font - Name : {0}", textSegment.TextState.Font.FontName);
Console.WriteLine("Font Size : {0} ", textSegment.TextState.FontSize);
Console.WriteLine("Page Number : {0} ", textFragment.Page.Number);
}
}