Skip to content

Instantly share code, notes, and snippets.

@CGRemakes
CGRemakes / gist:c9c14b858829c4a4ac99
Last active December 19, 2016 08:17 — forked from yurydelendik/gist:f2b846dae7cb29c86d23
PDF.js get/show hightlight
var id_count = 1;
function HighlightSelectedText()
{
var pageIndex = window.PDFViewerApplication.pdfViewer.currentPageNumber - 1;
var page = window.PDFViewerApplication.pdfViewer.getPageView(pageIndex);
var pageElement = page.canvas.parentNode.nextSibling;
var pageRect = page.canvas.getClientRects()[0];
var selection = window.getSelection();