Highlight text with PDFbox

Hi, I know what Pdfbox is and I want to highlight a specific type of PDF file. Right now I can get the coordinates of the character, and I want to select it.

I saw from this link: highlight text using pdfbox when it is in PDF format

which shows the steps to highlight.

My question lies with these two steps: markup.setRectangle (); markup.setQuads ();

I tried to understand Quadpoints and PDRectangles, but could not.

Actually, if I wrote the code as follows:

    PDRectangle position = new PDRectangle(50,50);
    markup.setRectangle(position);
    float []p=new float[8];
    p[0]=100;p[1]=100;p[2]=200;p[3]=100;p[4]=100;p[5]=500;p[6]=200;p[7]=500;
    markup.setQuadPoints(p);

I would not get anything, but if I set LowerLeftX, LowerLeftY, UpperRightX, UpperRightY for PDRectanlge, I could get highly elastic text, but the coordinates are not what I expected.

- ? 4 Quadpoints, Rectangle? 2 ?

!

+4

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


All Articles