Javascript OCR Pdf-to-text


PDF-to-Text is an OCR, Pure Javascript by tesseract.js api, mobile-ready that convert PDF text-image to text.


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!


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

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(;
    return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));

With the function above, you can get individual parameter values:

getUrlParameter('order'); // "1"