Skip to content

Instantly share code, notes, and snippets.

@Gubolin
Gubolin / extract.js
Last active May 30, 2023 01:52
PDF.js text extraction
// adapted from https://stackoverflow.com/questions/1554280/extract-text-from-pdf-in-javascript/9213180#9213180
page.render(renderContext).promise.then(function(pdf){
page.getTextContent().then(function(textContent){
var page_text = "";
var last_block = null;
for(j = 0; j < textContent.length; j++){
var block = textContent[j];
if(last_block != null && last_block.str[last_block.str.length - 1] != ' '){
@Gubolin
Gubolin / addtab.html
Last active August 29, 2015 14:00
jQuery Mobile add tab dynamically
<div data-role="tabs" id="tabs">
<div data-role="listview" id="tabnav">
<ul>
<li><a href="#test">Test</a></li>
</ul>
</div>
</div>