From 49fa50d7e922746c02f7b70c8436466d7f62696a Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 8 Jun 2018 15:31:10 +0000 Subject: Use FPDFText_GetBoundedText() to get the visible text in a test. Add a test PDF with multiple pages, each with a different media box and crop box. Demonstrate how FPDFText_GetText() gets all the text on the page, and how FPDFText_GetBoundedText() with the right bounding boxes gets only the visible text on the page. Also fix a small nit in CPDF_TextPage::GetTextByRect() found while writing this CL. BUG=pdfium:387 Change-Id: I9ce4bb181e2ba5b454ea1341bbccef9ba94c9cd8 Reviewed-on: https://pdfium-review.googlesource.com/34550 Commit-Queue: Ryan Harrison Reviewed-by: Ryan Harrison --- testing/resources/cropped_text.in | 98 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 testing/resources/cropped_text.in (limited to 'testing/resources/cropped_text.in') diff --git a/testing/resources/cropped_text.in b/testing/resources/cropped_text.in new file mode 100644 index 0000000000..c8632de112 --- /dev/null +++ b/testing/resources/cropped_text.in @@ -0,0 +1,98 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R +>> +endobj +{{object 2 0}} << + /Type /Pages + /Count 4 + /Kids [ 6 0 R 7 0 R 8 0 R 9 0 R ] +>> +endobj +{{object 3 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Times-Roman +>> +endobj +{{object 4 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Helvetica +>> +endobj +{{object 5 0}} << + {{streamlen}} +>> +stream +BT +20 50 Td +/F1 12 Tf +(Hello, world!) Tj +0 50 Td +/F2 16 Tf +(Goodbye, world!) Tj +ET +endstream +endobj +{{object 6 0}} << + /Type /Page + /Parent 2 0 R + /MediaBox [ 0 0 200 200 ] + /CropBox [ 50 50 150 150 ] + /Resources << + /Font << + /F1 3 0 R + /F2 4 0 R + >> + >> + /Contents 5 0 R +>> +endobj +{{object 7 0}} << + /Type /Page + /Parent 2 0 R + /MediaBox [ -50 -50 200 200 ] + /CropBox [ 50 50 150 150 ] + /Resources << + /Font << + /F1 3 0 R + /F2 4 0 R + >> + >> + /Contents 5 0 R +>> +endobj +{{object 8 0}} << + /Type /Page + /Parent 2 0 R + /MediaBox [ 0 0 200 200 ] + /CropBox [ 60 60 150 150 ] + /Resources << + /Font << + /F1 3 0 R + /F2 4 0 R + >> + >> + /Contents 5 0 R +>> +endobj +{{object 9 0}} << + /Type /Page + /Parent 2 0 R + /MediaBox [ 0 0 200 200 ] + /CropBox [ 150 150 60 60 ] + /Resources << + /Font << + /F1 3 0 R + /F2 4 0 R + >> + >> + /Contents 5 0 R +>> +endobj +{{xref}} +{{trailer}} +{{startxref}} +%%EOF -- cgit v1.2.3