How to find the text is rotated or not using TextFragment

I am using TextFragment to iterate over page content to remove the text from page.

I want to remove normal text from PDF page and slanted text should present on page so that I can export the whole page as an image.

Is it possible to know that text is rotated\slanted using TextFragment.

Thanks

Hi Deependra,


Thanks for your inquriy. I am afraid currently Aspose.Pdf does not support rotation property for TextFragment. However, we will appreciate it if you please share your sample input and output documents here, so we will log a feature request in our issue tracking system to support the functionality in future.

We are sorry for the inconvenience.

Best Regards,

Hi Tilal,


It’s simple, vertical text or rotated text identification needs to be in library as if we are converting PDF to html there is positioning challenges so if the identification can be done then the text can be added to background image.

I think this it is the most common feature and other libraries providing this.

Hi Deependra,


Thanks for your feedback. As stated above the feature is not available in Aspose.Pdf at the moment, we have logged a new feature request PDFNET-41079 in our issue tracking system for the purpose. We will notify you as soon as it is implemented.

We are sorry for the inconvenience caused.

Best Regards,

@DeependraKhangarot

Please use Rotation property in TextState of TextFragment.

Please consider the following code:

//open document
Document pdfDocument = new Document(inputDocument);
//create TextAbsorber object to find all the phrases matching the regular expression
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(@"[\S]+");//like 1999-2000
//set text search option to specify regular expression usage
TextSearchOptions textSearchOptions = new TextSearchOptions(true);
textFragmentAbsorber.TextSearchOptions = textSearchOptions;
//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)
{
Console.WriteLine("Text : {0} ", textFragment.Text);
Console.WriteLine("Rotation : {0} ", textFragment.TextState.Rotation);
}

Please try this code with latest version of the Aspose.PDF for .NET and in case of any further assistance, please feel free to let us know.