PDF-TO-TEXT
PDF-to-Text is an OCR, Pure Javascript by tesseract.js api, mobile-ready that convert PDF text-image to text.
Tech
PDF-to-Text uses a number of open source projects to work properly:
- [JavaScript] – awesome!
- [HTML] – HTML enhanced for web apps!
- [CSS] – Fence!
- [Magic] – that”s nice!
Installation
PDF-to-Text requires Node.js v4+ or any server enviroment to run.
Start the server.
$ npm install http-server -g $ cd pdf-to-text-master $ http-server
Understanding Subresource Integrity
Generating Hashes
cat FILENAME.js | openssl dgst -sha384 -binary | openssl base64 -A
Online SRI Hash Generator
https://www.srihash.org/
Query Animate Rotate Using Step
$(‘.button’).click(function() {
$(‘.box’).animate(
{ deg: 180 },
{
duration: 1200,
step: function(now) {
$(this).css({ transform: ‘rotate(‘ + now + ‘deg)’ });
}
}
);
});
get URL Query params with jquery & js
// Assuming “?order=1&total=30”
While
URLSearchParams
is ideal, not all browsers support that API. There’s a polyfill available but if you want a tiny function for basic query string parsing, the following is a function stolen from the A-Frame VR toolkit which parses the query string to get the key’s value you’d like:function getUrlParameter(name) { name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); var results = regex.exec(location.search); return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); };
With the function above, you can get individual parameter values:
getUrlParameter('order'); // "1"