How to extract font styles of text contents from pdf?

How to extract font styles of text contents from pdf???

Hi Parkavi,

Thanks for contacting support.

In order to accomplish your requirement, please follow the instructions specified over Search and Get Text Segments from Pages of PDF

How to find out font style for special character inside the textFragmentAbsorber


Here is my code

com.aspose.pdf.TextFragmentAbsorber textFragmentAbsorber = new com.aspose.pdf.TextFragmentAbsorber(“pouvoir traiter avec la grande distribution [premier”);

com.aspose.pdf.TextSearchOptions textSearchOptions = new com.aspose.pdf.TextSearchOptions(true);
textFragmentAbsorber.setTextSearchOptions(textSearchOptions);

pdfDocument.getPages().accept(textFragmentAbsorber);

com.aspose.pdf.TextFragmentCollection textFragmentCollection = textFragmentAbsorber.getTextFragments();

for(int i=1;i<=textFragmentCollection.size(); i++)
{

TextSegmentCollection textsegment = textFragmentCollection.get_Item(i).getSegments();
for(int j=1;j<= textsegment.size() ; j++)
{
System.out.println("Textseg :- " + textsegment.get_Item(j).getText());
System.out.println("Font - Namess :- " + textsegment.get_Item(j).getTextState().getFont().getFontName());
}


}

when i run the code it shows the error as

Exception in thread “main” java.util.regex.PatternSyntaxException: Unclosed character class near index 51
pouvoir traiter avec la grande distribution [premier
^

2.Suppose when i given input like this it show textFragmentCollection.size() is zero

com.aspose.pdf.TextFragmentAbsorber(“pour un chiffre d’affaires de 14,5 M€ et dix-huit sala-
”);


I have attached my pdf file also …

Can u say me how to handle…???





Hi Parkavi,

I have tested the scenario and I am able to reproduce the above stated exception. For the sake of correction, I have logged it in our issue tracking system as PDFNEWJAVA-34458. We will investigate this issue in details and will keep you updated on the status of a correction.

We apologize for your inconvenience.

Hiii


Any Updates???

Hi Parkavi,

Thanks for your patience.

The development team has been busy resolving other priority issues and I am afraid the issue reported earlier is still pending for review. Nevertheless, as soon as we have some definite updates regarding its resolution, we would be more than happy to update you with the status of correction. Please be patient and spare us a little more time.

We are really sorry for this inconvenience.

The issues you have found earlier (filed as PDFNEWJAVA-34458) have been fixed in Aspose.Pdf for Java 10.0.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.