This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getHightlightCoords() { | |
var pageIndex = PDFViewerApplication.pdfViewer.currentPageNumber - 1; | |
var page = PDFViewerApplication.pdfViewer.getPageView(pageIndex); | |
var pageRect = page.canvas.getClientRects()[0]; | |
var selectionRects = Array.apply(this, window.getSelection().getRangeAt(0).getClientRects()); | |
var viewport = page.viewport; | |
var selected = selectionRects.map(function (r) { | |
return viewport.convertToPdfPoint(r.left - pageRect.left, r.top - pageRect.top).concat( | |
viewport.convertToPdfPoint(r.right - pageRect.left, r.bottom - pageRect.top)); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Add copy to clipboard from IPython! | |
To install, just copy it to your profile/startup directory, typically: | |
~/.ipython/profile_default/startup/ | |
Example usage: | |
%clip hello world | |
# will store "hello world" |