pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zhu Yi" <z...@student.ethz.ch>
Subject Problems of Highlight with PDFbox
Date Thu, 10 Jul 2014 14:50:09 GMT

Hi Im a newer to Pdfbox and I want to highlight certain character of PDF files. Right now
I can get the coordinates of the character and I want to highlight it.

I saw on this link: highlight text using pdfbox when it's location in the pdf is known<http://stackoverflow.com/questions/18463543/highlight-text-using-pdfbox-when-its-location-in-the-pdf-is-known>

that shows the steps to highlight.

My question lies on these 2 steps: markup.setRectangle(); markup.setQuads();

I've tried to understand Quadpoints and PDRectangles but failed.

Actually if I wrote code like this:

    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 get nothing, but if I set LowerLeftX,LowerLeftY,UpperRightX,UpperRightY for PDRectanlge
I could get the highlited text,but the coordinates are not what I expected.

Could any one explain to me the difference between these two classes? Since I already have
4 points in Quadpoints, why do I still have to add the position of the Rectangle?What realations
do these 2 classes have?


Thanks!
Mime
View raw message