An alternative way to render PDF with keeping origin PDF coordinates for text blocks
In some cases we need to render PDF on the web page but for some reasones we also need to know origin coordinates of text blocks
It can be useful if you are planning to select some text and then send that selection with its coordinates to third-party system
- Via package pdf2json we extract needed data (text blocks and lines) to JSON
- on the server we create HTML for every text block and line:
divwith absolute positioning - on the client we just render an array of those
divs in the specified container
Clone the repo:
$ git clone https://github.com/daminort/pdf-renderer.gitGo to the server folder and install dependencies:
$ cd server
$ npm installGo to the client folder and install dependencies:
$ cd client
$ npm installGo to the server folder and start it:
$ cd server
$ npm startGo to the client folder and start it:
$ cd client
$ npm startNow you can visit page localhost:3000 and try application