How to determine superscript using ItextSharp?

Hy

I am using ITextSharp to parse a PDF file to output text. I want to know if I can catch if the PDF supports index or superscript, does anyone know how to make the difference between normal character and superscript in pdf using ITextSharp or another library?

thank

+3
source share
2 answers

Disclaimer: I actually have no evidence, but ...

, / . , . , , / - , , PDF.

, , / : , " " . , , PDF ITextSharp, "" .

+3

. PDF , / PDF, . ( ). :

    //input -> curText
    if(curText.Baseline > previousText.Baseline && 
         curText.Baseline < (prevText.Baseline + prevText.Height))
    {
         // This is most likely superscript //
    }
    else if(curText.Baseline < previousText.Baseline &&
         prevText.Baseline < (curText.Baseline + curText.Height))
    {
         // This is most likely subscript //
    }
    else
    {
         // This is probably normal text //
    }

, PDF. List < > , y . - , , , .

0

Source: https://habr.com/ru/post/1787697/


All Articles