Issue 683 in pdfium: FPDFText_GetRect returns rects that have some offset

124 views
Skip to first unread message

clouds.f… via monorail

unread,
Mar 21, 2017, 4:23:31 PM3/21/17
to pdfiu...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 683 by clouds.f...@gmail.com: FPDFText_GetRect returns rects that have some offset
https://bugs.chromium.org/p/pdfium/issues/detail?id=683

What steps will reproduce the problem?
1. download the file https://www.adobe.com/products/postscript/pdfs/PLRM.pdf (attached)
3. run the code

auto page = FPDF_LoadPage(doc, 3); // read the page 4
FPDF_GetPageWidth(page); // width == 531.00
FPDF_GetPageHeight(page); // height == 666.00

auto textpage = FPDFText_LoadPage(page);
uint16_t text[20];
FPDFText_GetText(textpage, 0, 8, text); // text == "Contents"

FPDFText_CountRects(textpage, 0, 8); // return value 1
double left, top, right, bottom;
FPDFText_GetRect(textpage, 0, &left, &top, &right, &bottom);
// left == 137.06, right == 169.84, top == 692.98, bottom == 687.21

What is the expected output? What do you see instead?
The rect { left = 137.06, right = 169.84, top = 692.98, bottom = 687.21 } is expect to be inside { left = 0, right = 531.00, top = 666.00, bottom = 0 }, but 692.98 > 666.00.
I've tried save the document via pdf printer (or save as pdf, which converts the pdf to PDF-1.7 version), but the problem consists.

What version of the product are you using? On what operating system?
the latest master, macOS/Windows

Please provide any additional information below.



Attachments:
PLRM.pdf 7.4 MB

--
You received this message because:
1. The project was configured to send all issue notifications to this address

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

we… via monorail

unread,
Mar 21, 2017, 6:42:58 PM3/21/17
to pdfiu...@googlegroups.com
Updates:
Status: Invalid

Comment #1 on issue 683 by we...@chromium.org: FPDFText_GetRect returns rects that have some offset
https://bugs.chromium.org/p/pdfium/issues/detail?id=683#c1

FPDF_GetPageWidth and FPDF_GetPageHeight only measure the displayable area. Pls check https://cs.chromium.org/chromium/src/third_party/pdfium/public/fpdfview.h?q=FPDF_GetPageWidth&l=501

clouds.f… via monorail

unread,
Mar 22, 2017, 8:39:43 AM3/22/17
to pdfiu...@googlegroups.com

Comment #2 on issue 683 by clouds.f...@gmail.com: FPDFText_GetRect returns rects that have some offset
https://bugs.chromium.org/p/pdfium/issues/detail?id=683#c2

I see! I've use FPDF_PageToDevice and it works!
Reply all
Reply to author
Forward
0 new messages