[ 
https://issues.apache.org/jira/browse/PDFBOX-2337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14128342#comment-14128342
 ] 

Joël Kuiper commented on PDFBOX-2337:
-------------------------------------

Here is a working implementation 

https://gist.githubusercontent.com/joelkuiper/331a399961941989fec8/raw/9bc1a13eca6577c70c3a309214424cd6b0f2d3e6/TextHighlight

It may still require some refactoring but calling the file with <input-pdf> 
<output-pdf> <pattern> will highlight the pattern in yellow 

> Add an example for highlighting text based on a string 
> -------------------------------------------------------
>
>                 Key: PDFBOX-2337
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2337
>             Project: PDFBox
>          Issue Type: Wish
>          Components: Documentation, Utilities
>            Reporter: Joël Kuiper
>            Priority: Minor
>              Labels: example, examples
>
> An often heard request is to be able to highlight a certain text within a PDF 
> programmatically, similar to the highlight functionality in Acrobat or 
> Preview.app.
> The actual implementation of this functionality is trickier than it appears, 
> since it requires the calculation of bouding boxes from TextPositions. 
> A example class may help people with implementing this (common) 
> functionality. 
> (see for example this discussion 
> https://mail-archives.apache.org/mod_mbox/pdfbox-users/201409.mbox/%3CC8340BB9-E299-4A76-A50B-6155504A0D5B%40joelkuiper.eu%3E)
>  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to