Extension code from pdf.js with highlight management.