Parsing and Rendering PDF with PDF.js
In this post I will elaborate on implementing a simple PDF renderer with PDF.js. In order to proceed you should include both pdf.js and and pdf.worker.js associated with your html file where you render the PDF.
The code used to parse and render PDF can be found here;
1) create an html page having the div. #holder which will act as a container for rendering the PDF
2) Declare global variables pdfDoc, pageNum and scale at the beginning of the script file.
3) window.onload function is used to load the PDF at page loading.
4) In function renderPDF(url), You can provide url to any pdf here or it can be a Unit8Array. Default scale will be 1.5 (150% zoomed). You can have alternative default values.
5) PDFJS.disableWorker = true, This line of code is required because PDF.js uses Web Workers concept of HTML5 to process the request. If it is set to false, PDF.js will create an instance of web workers which will run in an isolated thread.
7) In function base64ToUint8Array(base64), base64 is an encoded string. For this you can get the PDF byte array as a base-64 encoded string from server side and decode using the atob function. Atob is a native function that decodes a string of data which has been encoded using base-64 encoding.
8) The renderPage, function simply receives the page information such as the page view port according to the predifined scaling factor, resize the canvas according to the scaled viewport heiht and width and render the corresponding page of the pdf accordingly. And update the page numbers accordingly.
9) The goPrevious and goNext methods can be used to navigate between pages of the rendered PDF.
10) Zoom function will again render the PDF by resizing the canvas dimensions.
You can refer to this link  and find more information regarding PDF.js