Tips on how to create a JavaScript PDF viewer


 ingredient.

1

id="canvas_container">

2
     id="pdf_renderer">
3

To maintain issues easy, we’ll be rendering just one web page contained in the canvas at any given time. We’ll, nonetheless, enable customers to change to the earlier web page or the subsequent web page by urgent a button. Moreover, to show the present web page quantity, and to permit customers to leap to any web page they want, our interface may have an enter area.

To assist zoom operations, add two extra buttons to the interface: one to zoom in and one to zoom out.

1

id="zoom_controls">

2
    
3
    
4

On the finish of this part, the online web page code appears to be like like this.

1
 
2
 lang="en">
3

4
   charset="utf-8">
5
   identify="viewport" content material="width=device-width, initial-scale=1">
6
  </span>My PDF Viewer<span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-7" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>7</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-8" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>8</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-9" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>9</pre>
</td>
<td class="rouge-code">
<pre>     <span style="color: #f4bf75"><p> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"my_pdf_viewer"</span><span style="color: #f4bf75">></span>
</p></span></pre>
</td>
</tr>
<tr id="line-10" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>10</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"><p> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"canvas_container"</span><span style="color: #f4bf75">></span>
</p></span></pre>
</td>
</tr>
<tr id="line-11" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>11</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><canvas> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"pdf_renderer"</span><span style="color: #f4bf75">></span></canvas></span>
</pre>
</td>
</tr>
<tr id="line-12" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>12</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-13" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>13</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-14" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>14</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"><p> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"navigation_controls"</span><span style="color: #f4bf75">></span>
</p></span></pre>
</td>
</tr>
<tr id="line-15" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>15</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><button> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"go_previous"</span><span style="color: #f4bf75">></span>Earlier<span style="color: #f4bf75"/></button></span>
</pre>
</td>
</tr>
<tr id="line-16" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>16</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><input/> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"current_page"</span> <span style="color: #6a9fb5">worth=</span><span style="color: #90a959">"1"</span> <span style="color: #6a9fb5">kind=</span><span style="color: #90a959">"quantity"</span><span style="color: #f4bf75">/></span>
</span></pre>
</td>
</tr>
<tr id="line-17" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>17</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><button> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"go_next"</span><span style="color: #f4bf75">></span>Subsequent<span style="color: #f4bf75"/></button></span>
</pre>
</td>
</tr>
<tr id="line-18" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>18</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-19" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>19</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-20" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>20</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"><p> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"zoom_controls"</span><span style="color: #f4bf75">></span>  
</p></span></pre>
</td>
</tr>
<tr id="line-21" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>21</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><button> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"zoom_in"</span><span style="color: #f4bf75">></span>+<span style="color: #f4bf75"/></button></span>
</pre>
</td>
</tr>
<tr id="line-22" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>22</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><button> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"zoom_out"</span><span style="color: #f4bf75">></span>-<span style="color: #f4bf75"/></button></span>
</pre>
</td>
</tr>
<tr id="line-23" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>23</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-24" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>24</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-25" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>25</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-26" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>26</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
</tbody>
</table>
</div>
<h2><span class="ez-toc-section" id="2_Getting_PDFjs"></span>
<span class="sectionnum">2.</span> Getting PDF.js<span class="ez-toc-section-end"></span></h2><div id="ez-toc-container" class="ez-toc-v2_0_71 ez-toc-wrap-center counter-flat ez-toc-counter ez-toc-light-blue ez-toc-container-direction">
<div class="ez-toc-title-container">
<p class="ez-toc-title ez-toc-toggle" style="cursor:pointer">Table of Contents</p>
<span class="ez-toc-title-toggle"><a href="#" class="ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle" aria-label="Toggle Table of Content"><span class="ez-toc-js-icon-con"><span class=""><span class="eztoc-hide" style="display:none;">Toggle</span><span class="ez-toc-icon-toggle-span"><svg style="fill: #999;color:#999" xmlns="http://www.w3.org/2000/svg" class="list-377408" width="20px" height="20px" viewBox="0 0 24 24" fill="none"><path d="M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z" fill="currentColor"></path></svg><svg style="fill: #999;color:#999" class="arrow-unsorted-368013" xmlns="http://www.w3.org/2000/svg" width="10px" height="10px" viewBox="0 0 24 24" version="1.2" baseProfile="tiny"><path d="M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z"/></svg></span></span></span></a></span></div>
<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1'><a class="ez-toc-link ez-toc-heading-1" href="#2_Getting_PDFjs" title="2. Getting PDF.js">2. Getting PDF.js</a></li><li class='ez-toc-page-1'><a class="ez-toc-link ez-toc-heading-2" href="#3_Loading_a_PDF_File" title="3. Loading a PDF File">3. Loading a PDF File</a></li><li class='ez-toc-page-1'><a class="ez-toc-link ez-toc-heading-3" href="#4_Rendering_a_Page" title="4. Rendering a Page">4. Rendering a Page</a></li><li class='ez-toc-page-1'><a class="ez-toc-link ez-toc-heading-4" href="#5_Changing_the_Current_Page" title="5. Changing the Current Page">5. Changing the Current Page</a></li><li class='ez-toc-page-1'><a class="ez-toc-link ez-toc-heading-5" href="#6_Changing_the_Zoom_Level" title="6. Changing the Zoom Level">6. Changing the Zoom Level</a></li><li class='ez-toc-page-1'><a class="ez-toc-link ez-toc-heading-6" href="#Congratulations_Youve_Realized_to_Create_a_Viewer_for_PDF_Paperwork_in_JavaScript" title="Congratulations! You’ve Realized to Create a Viewer for PDF Paperwork in JavaScript!">Congratulations! You’ve Realized to Create a Viewer for PDF Paperwork in JavaScript!</a></li></ul></nav></div>

<p>Now {that a} bare-bones person interface for our JavaScript PDF viewer is prepared, let’s add PDF.js to our net web page. As a result of the most recent model of the library is accessible on <a href="https://cdnjs.com/libraries/pdf.js" target="_blank" rel="external noopener">CDNJS</a>, we are able to achieve this by merely including the next traces in the direction of the top of the online web page.</p>
<div class="rouge-syntax-highlight">
<table class="rouge-line-table html">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"><script><![CDATA[
]]></script></span></pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">    </span><span style="color: #6a9fb5">src=</span><span style="color: #90a959">"https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.0.943/pdf.min.js"</span><span style="color: #f4bf75">></span>
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>Should you choose to make use of a neighborhood copy of the library, you possibly can obtain it from the <a href="https://github.com/mozilla/pdfjs-dist" target="_blank" rel="external noopener">pdfjs-dist</a> repository.</p>
<h2><span class="ez-toc-section" id="3_Loading_a_PDF_File"></span>
<span class="sectionnum">3.</span> Loading a PDF File<span class="ez-toc-section-end"></span></h2>
<p>Earlier than we begin loading a PDF file, let’s create a easy JavaScript object to retailer the state of our PDF viewer in JS. Inside it, we’ll have three gadgets: a reference to the PDF file itself, the present web page index, and the present zoom degree.</p>
<div class="rouge-syntax-highlight">
<table class="rouge-line-table html">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"><script/></span>
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #d28445">var</span> <span style="color: #d0d0d0;background-color: #151515">myState</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #6a9fb5">pdf</span><span style="color: #d0d0d0">:</span> <span style="color: #d28445">null</span><span style="color: #d0d0d0">,</span>
</pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #6a9fb5">currentPage</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">1</span><span style="color: #d0d0d0">,</span>
</pre>
</td>
</tr>
<tr id="line-5" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>5</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #6a9fb5">zoom</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">1</span>
</pre>
</td>
</tr>
<tr id="line-6" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>6</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-7" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>7</pre>
</td>
<td class="rouge-code">
<pre> 
</pre>
</td>
</tr>
<tr id="line-8" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>8</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #949494">// more code here
</span>
</pre>
</td>
</tr>
<tr id="line-9" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>9</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
</tbody>
</table>
</div>
At this point, we can load our PDF file by calling the <code class="inline">getDocument()</code> method of the <code class="inline">pdfjsLib</code> object, which runs asynchronously.
<div class="rouge-syntax-highlight">
<table class="rouge-line-table html">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre>pdfjsLib.getDocument('./my_document.pdf').then((pdf) => {
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre> 
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre>    // more code here
</pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre> 
</pre>
</td>
</tr>
<tr id="line-5" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>5</pre>
</td>
<td class="rouge-code">
<pre>});
</pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="callout-block">
<span class="callout-icon callout-info"/>
Note that the <code class="inline">getDocument()</code> method internally uses an <code class="inline">XMLHttpRequest</code> object to load the PDF file. This means that the file must be present either on your own web server or on a server that allows cross-origin requests.
</div>
If you don’t have a PDF file handy, you can get the one I’m using from <a href="https://en.wikipedia.org/w/index.php?title=Special:ElectronPdf&page=New+Horizons&action=show-download-screen" target="_blank" rel="external noopener">Wikipedia</a>.
Once the PDF file has been loaded successfully, we can update the <code class="inline">pdf</code> property of our state object.
Lastly, add a call to a function named <code class="inline">render()</code> so that our PDF viewer in JS automatically renders the first page of the PDF file. We’ll define the function in the next step.
<h2><span class="ez-toc-section" id="4_Rendering_a_Page"></span>
<span class="sectionnum">4.</span> Rendering a Page<span class="ez-toc-section-end"></span></h2>
By calling the <code class="inline">getPage()</code> method of the <code class="inline">pdf</code> object and passing a page number to it, we can get a reference to any page in the PDF file. For now, let’s pass the <code class="inline">currentPage</code> property of our state object to it. This method too returns a promise, so we’ll need a callback function to handle its result.
Accordingly, create a new function called <code class="inline">render()</code> containing the following code:
<div class="rouge-syntax-highlight">
<table class="rouge-line-table html">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre>function render() {
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre>    myState.pdf.getPage(myState.currentPage).then((page) => {
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre> 
</pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre>        // more code here
</pre>
</td>
</tr>
<tr id="line-5" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>5</pre>
</td>
<td class="rouge-code">
<pre> 
</pre>
</td>
</tr>
<tr id="line-6" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>6</pre>
</td>
<td class="rouge-code">
<pre>    });
</pre>
</td>
</tr>
<tr id="line-7" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>7</pre>
</td>
<td class="rouge-code">
<pre>}
</pre>
</td>
</tr>
</tbody>
</table>
</div>
To actually render a page, we must call the <code class="inline">render()</code> method of the <code class="inline">page</code> object available inside the callback. As arguments, the method expects the 2D context of our canvas and a <code class="inline">PageViewport</code> object, which we can get by calling the <code class="inline">getViewport()</code> method. Because the <code class="inline">getViewport()</code> method expects the desired zoom level as an argument, we must pass the <code class="inline">zoom</code> property of our state object to it.
<div class="rouge-syntax-highlight">
<table class="rouge-line-table html">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre>var canvas = document.getElementById("pdf_renderer");
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre>var ctx = canvas.getContext('2d');
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre> 
</pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre>var viewport = page.getViewport(myState.zoom);
</pre>
</td>
</tr>
</tbody>
</table>
</div>
The dimensions of the viewport depend on the original size of the page and the zoom level. In order to make sure that the entire viewport is rendered on our canvas, we must now change the size of our canvas to match that of the viewport. Here’s how:
<div class="rouge-syntax-highlight">
<table class="rouge-line-table html">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre>canvas.width = viewport.width;
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre>canvas.height = viewport.height;
</pre>
</td>
</tr>
</tbody>
</table>
</div>
At this point, we can go ahead and render the page.
<div class="rouge-syntax-highlight">
<table class="rouge-line-table html">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre>page.render({
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre>    canvasContext: ctx,
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre>    viewport: viewport
</pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre>});
</pre>
</td>
</tr>
</tbody>
</table>
</div>
Putting it all together, the whole source code looks like this.
<div class="rouge-syntax-highlight">
<table class="rouge-line-table html">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre> 
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"> <span style="color: #6a9fb5">lang=</span><span style="color: #90a959">"en"</span><span style="color: #f4bf75">></span>
</span></pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-5" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>5</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #f4bf75"><meta/> <span style="color: #6a9fb5">charset=</span><span style="color: #90a959">"utf-8"</span><span style="color: #f4bf75">></span>
</span></pre>
</td>
</tr>
<tr id="line-6" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>6</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #f4bf75"><meta/> <span style="color: #6a9fb5">name=</span><span style="color: #90a959">"viewport"</span> <span style="color: #6a9fb5">content=</span><span style="color: #90a959">"width=device-width, initial-scale=1"</span><span style="color: #f4bf75">></span>
</span></pre>
</td>
</tr>
<tr id="line-7" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>7</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #f4bf75"><title/></span>My PDF Viewer<span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-8" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>8</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #f4bf75"><script><![CDATA[
]]></script></span></pre>
</td>
</tr>
<tr id="line-9" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>9</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">    </span><span style="color: #6a9fb5">src=</span><span style="color: #90a959">"https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.0.943/pdf.min.js"</span><span style="color: #f4bf75">></span>
</pre>
</td>
</tr>
<tr id="line-10" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>10</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-11" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>11</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-12" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>12</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-13" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>13</pre>
</td>
<td class="rouge-code">
<pre>     <span style="color: #f4bf75"><p> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"my_pdf_viewer"</span><span style="color: #f4bf75">></span>
</p></span></pre>
</td>
</tr>
<tr id="line-14" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>14</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"><p> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"canvas_container"</span><span style="color: #f4bf75">></span>
</p></span></pre>
</td>
</tr>
<tr id="line-15" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>15</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><canvas> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"pdf_renderer"</span><span style="color: #f4bf75">></span></canvas></span>
</pre>
</td>
</tr>
<tr id="line-16" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>16</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-17" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>17</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-18" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>18</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"><p> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"navigation_controls"</span><span style="color: #f4bf75">></span>
</p></span></pre>
</td>
</tr>
<tr id="line-19" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>19</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><button> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"go_previous"</span><span style="color: #f4bf75">></span>Earlier<span style="color: #f4bf75"/></button></span>
</pre>
</td>
</tr>
<tr id="line-20" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>20</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><input/> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"current_page"</span> <span style="color: #6a9fb5">worth=</span><span style="color: #90a959">"1"</span> <span style="color: #6a9fb5">kind=</span><span style="color: #90a959">"quantity"</span><span style="color: #f4bf75">/></span>
</span></pre>
</td>
</tr>
<tr id="line-21" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>21</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><button> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"go_next"</span><span style="color: #f4bf75">></span>Subsequent<span style="color: #f4bf75"/></button></span>
</pre>
</td>
</tr>
<tr id="line-22" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>22</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-23" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>23</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-24" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>24</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"><p> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"zoom_controls"</span><span style="color: #f4bf75">></span>  
</p></span></pre>
</td>
</tr>
<tr id="line-25" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>25</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><button> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"zoom_in"</span><span style="color: #f4bf75">></span>+<span style="color: #f4bf75"/></button></span>
</pre>
</td>
</tr>
<tr id="line-26" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>26</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><button> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"zoom_out"</span><span style="color: #f4bf75">></span>-<span style="color: #f4bf75"/></button></span>
</pre>
</td>
</tr>
<tr id="line-27" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>27</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-28" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>28</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-29" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>29</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-30" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>30</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #f4bf75"><script/></span>
</pre>
</td>
</tr>
<tr id="line-31" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>31</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d28445">var</span> <span style="color: #d0d0d0;background-color: #151515">myState</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-32" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>32</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #6a9fb5">pdf</span><span style="color: #d0d0d0">:</span> <span style="color: #d28445">null</span><span style="color: #d0d0d0">,</span>
</pre>
</td>
</tr>
<tr id="line-33" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>33</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #6a9fb5">currentPage</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">1</span><span style="color: #d0d0d0">,</span>
</pre>
</td>
</tr>
<tr id="line-34" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>34</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #6a9fb5">zoom</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">1</span>
</pre>
</td>
</tr>
<tr id="line-35" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>35</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-36" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>36</pre>
</td>
<td class="rouge-code">
<pre>     
</pre>
</td>
</tr>
<tr id="line-37" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>37</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0;background-color: #151515">pdfjsLib</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getDocument</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">'</span><span style="color: #90a959">./my_document.pdf</span><span style="color: #90a959">'</span><span style="color: #d0d0d0">).</span><span style="color: #d0d0d0;background-color: #151515">then</span><span style="color: #d0d0d0">((</span><span style="color: #d0d0d0;background-color: #151515">pdf</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">=></span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-38" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>38</pre>
</td>
<td class="rouge-code">
<pre>     
</pre>
</td>
</tr>
<tr id="line-39" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>39</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">pdf</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">pdf</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-40" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>40</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d0d0d0;background-color: #151515">render</span><span style="color: #d0d0d0">();</span>
</pre>
</td>
</tr>
<tr id="line-41" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>41</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-42" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>42</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0">});</span>
</pre>
</td>
</tr>
<tr id="line-43" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>43</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-44" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>44</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d28445">function</span> <span style="color: #d0d0d0;background-color: #151515">render</span><span style="color: #d0d0d0">()</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-45" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>45</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">pdf</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getPage</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">currentPage</span><span style="color: #d0d0d0">).</span><span style="color: #d0d0d0;background-color: #151515">then</span><span style="color: #d0d0d0">((</span><span style="color: #d0d0d0;background-color: #151515">page</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">=></span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-46" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>46</pre>
</td>
<td class="rouge-code">
<pre>         
</pre>
</td>
</tr>
<tr id="line-47" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>47</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d28445">var</span> <span style="color: #d0d0d0;background-color: #151515">canvas</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">document</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getElementById</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">"</span><span style="color: #90a959">pdf_renderer</span><span style="color: #90a959">"</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-48" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>48</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d28445">var</span> <span style="color: #d0d0d0;background-color: #151515">ctx</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">canvas</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getContext</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">'</span><span style="color: #90a959">2d</span><span style="color: #90a959">'</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-49" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>49</pre>
</td>
<td class="rouge-code">
<pre>     
</pre>
</td>
</tr>
<tr id="line-50" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>50</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d28445">var</span> <span style="color: #d0d0d0;background-color: #151515">viewport</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">page</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getViewport</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">zoom</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-51" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>51</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-52" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>52</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d0d0d0;background-color: #151515">canvas</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">width</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">viewport</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">width</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-53" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>53</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d0d0d0;background-color: #151515">canvas</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">height</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">viewport</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">height</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-54" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>54</pre>
</td>
<td class="rouge-code">
<pre>         
</pre>
</td>
</tr>
<tr id="line-55" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>55</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d0d0d0;background-color: #151515">page</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">render</span><span style="color: #d0d0d0">({</span>
</pre>
</td>
</tr>
<tr id="line-56" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>56</pre>
</td>
<td class="rouge-code">
<pre>                    <span style="color: #6a9fb5">canvasContext</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">ctx</span><span style="color: #d0d0d0">,</span>
</pre>
</td>
</tr>
<tr id="line-57" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>57</pre>
</td>
<td class="rouge-code">
<pre>                    <span style="color: #6a9fb5">viewport</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">viewport</span>
</pre>
</td>
</tr>
<tr id="line-58" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>58</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d0d0d0">});</span>
</pre>
</td>
</tr>
<tr id="line-59" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>59</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d0d0d0">});</span>
</pre>
</td>
</tr>
<tr id="line-60" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>60</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-61" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>61</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-62" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>62</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-63" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>63</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
</tbody>
</table>
</div>
If you try opening the web page in a browser, you should now be able to see the first page of your PDF file.
<figure class="post_image"><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=850/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-page-first-page-demo.png" alt="Demo" loading="lazy" width="870px" height="554px" class="resized-image resized-image-desktop" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1700/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-page-first-page-demo.png 2x"/><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=630/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-page-first-page-demo.png" alt="Demo" loading="lazy" width="650px" height="416px" class="resized-image resized-image-tablet" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1260/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-page-first-page-demo.png 2x"/><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=360/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-page-first-page-demo.png" alt="Demo" loading="lazy" width="380px" height="246px" class="resized-image resized-image-mobile" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=720/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-page-first-page-demo.png 2x"/></figure>
You may have noticed that the size of our PDF viewer currently depends on the size of the page being rendered and the zoom level. This is not ideal because we don’t want the layout of our web page to be affected while users interact with the PDF viewer in JavaScript. 
To fix this, all we need to do is give a fixed width and height to the <code class="inline">
<div> element encapsulating our canvas and set its <code class="inline">overflow</code> CSS property to <code class="inline">auto</code>. This property, when necessary, adds scroll bars to the <code class="inline">
<div> element, allowing users to scroll both horizontally and vertically.
Add the following code inside the <code class="inline"/> tag of the web page:
<div class="rouge-syntax-highlight">
<table class="rouge-line-table html">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"><style/></span>
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #d0d0d0;background-color: #151515">#canvas_container</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0;background-color: #151515">width</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">800px</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0;background-color: #151515">height</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">450px</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-5" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>5</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0;background-color: #151515">overflow</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">auto</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-6" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>6</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-7" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>7</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
</tbody>
</table>
</div>
You are, of course, free to change the width and height or even use media queries to make the <code class="inline">
<div> element match your requirements.
Optionally, you can include the following CSS rules to make the <code class="inline">
<div> element seem more distinct:
<div class="rouge-syntax-highlight">
<table class="rouge-line-table html">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre>#canvas_container {
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre>    background: #333;
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre>    text-align: center;
</pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre>    border: solid 3px;
</pre>
</td>
</tr>
<tr id="line-5" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>5</pre>
</td>
<td class="rouge-code">
<pre>}
</pre>
</td>
</tr>
</tbody>
</table>
</div>
If you refresh the web page now, you should see something like this on your screen:
<figure class="post_image"><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=850/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-first-page-with-background.png" alt="Demo With Background" loading="lazy" width="870px" height="554px" class="resized-image resized-image-desktop" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1700/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-first-page-with-background.png 2x"/><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=630/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-first-page-with-background.png" alt="Demo With Background" loading="lazy" width="650px" height="416px" class="resized-image resized-image-tablet" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1260/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-first-page-with-background.png 2x"/><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=360/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-first-page-with-background.png" alt="Demo With Background" loading="lazy" width="380px" height="246px" class="resized-image resized-image-mobile" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=720/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-first-page-with-background.png 2x"/></figure>
<h2><span class="ez-toc-section" id="5_Changing_the_Current_Page"></span>
<span class="sectionnum">5.</span> Changing the Current Page<span class="ez-toc-section-end"></span></h2>
Our JavaScript PDF viewer is currently capable of showing only the first page of any PDF file given to it. To allow users to change the page being rendered, we must now add click event listeners to the <code class="inline">go_previous</code> and <code class="inline">go_next</code> buttons we created earlier.
Inside the event listener of the <code class="inline">go_previous</code> button, we must decrement the <code class="inline">currentPage</code> property of our state object, making sure that it doesn't fall below <code class="inline">1</code>. After we do so, we can simply call the <code class="inline">render()</code> function again to render the new page.
Additionally, we must update the value of the <code class="inline">current_page</code> text field so that it displays the new page number. The following code shows you how:
<div class="rouge-syntax-highlight">
<table class="rouge-line-table html">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre>document.getElementById('go_previous')
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre>    .addEventListener('click', (e) => );
</pre>
</td>
</tr>
</tbody>
</table>
</div>
Similarly, inside the event listener of the <code class="inline">go_next</code> button, we must increment the <code class="inline">currentPage</code> property, while ensuring that it doesn’t exceed the number of pages present in the PDF file, which we can determine using the <code class="inline">numPages</code> property of the <code class="inline">_pdfInfo</code> object.
<div class="rouge-syntax-highlight">
<table class="rouge-line-table html">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre>document.getElementById('go_next')
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre>    .addEventListener('click', (e) =>  myState.currentPage > myState.pdf._pdfInfo.numPages) 
</pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre>    return;
</pre>
</td>
</tr>
<tr id="line-5" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>5</pre>
</td>
<td class="rouge-code">
<pre>         
</pre>
</td>
</tr>
<tr id="line-6" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>6</pre>
</td>
<td class="rouge-code">
<pre>    myState.currentPage += 1;
</pre>
</td>
</tr>
<tr id="line-7" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>7</pre>
</td>
<td class="rouge-code">
<pre>    document.getElementById("current_page").value = myState.currentPage;
</pre>
</td>
</tr>
<tr id="line-8" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>8</pre>
</td>
<td class="rouge-code">
<pre>    render();
</pre>
</td>
</tr>
<tr id="line-9" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>9</pre>
</td>
<td class="rouge-code">
<pre>);
</pre>
</td>
</tr>
</tbody>
</table>
</div>
Lastly, we must add a key press event listener to the <code class="inline">current_page</code> text field so that users can directly jump to any page they desire by simply typing in a page number and hitting the <strong>Enter</strong> key. Inside the event listener, we need to make sure that the number the user has entered is both greater than zero and less than or equal to the <code class="inline">numPages</code> property.
<div class="rouge-syntax-highlight">
<table class="rouge-line-table html">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre>document.getElementById('current_page')
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre>    .addEventListener('keypress', (e) => {
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre>    if(myState.pdf == null) return;
</pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre> 
</pre>
</td>
</tr>
<tr id="line-5" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>5</pre>
</td>
<td class="rouge-code">
<pre>    // Get key code
</pre>
</td>
</tr>
<tr id="line-6" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>6</pre>
</td>
<td class="rouge-code">
<pre>    var code = (e.keyCode ? e.keyCode : e.which);
</pre>
</td>
</tr>
<tr id="line-7" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>7</pre>
</td>
<td class="rouge-code">
<pre> 
</pre>
</td>
</tr>
<tr id="line-8" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>8</pre>
</td>
<td class="rouge-code">
<pre>    // If key code matches that of the Enter key
</pre>
</td>
</tr>
<tr id="line-9" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>9</pre>
</td>
<td class="rouge-code">
<pre>    if(code == 13) {
</pre>
</td>
</tr>
<tr id="line-10" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>10</pre>
</td>
<td class="rouge-code">
<pre>        var desiredPage = document.getElementById('current_page').valueAsNumber;
</pre>
</td>
</tr>
<tr id="line-11" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>11</pre>
</td>
<td class="rouge-code">
<pre>                         
</pre>
</td>
</tr>
<tr id="line-12" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>12</pre>
</td>
<td class="rouge-code">
<pre>        if(desiredPage >= 1 <span style="color: #151515;background-color: #ac4142">&&</span> desiredPage <span style="color: #f4bf75"><</span><span style="color: #151515;background-color: #ac4142">=</span> <span style="color: #6a9fb5">myState.pdf._pdfInfo.numPages</span><span style="color: #151515;background-color: #ac4142">)</span> <span style="color: #151515;background-color: #ac4142">{</span>
</pre>
</td>
</tr>
<tr id="line-13" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>13</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #6a9fb5">myState.currentPage = </span><span style="color: #90a959">desiredPage;</span>
</pre>
</td>
</tr>
<tr id="line-14" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>14</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #6a9fb5">document.getElementById</span><span style="color: #151515;background-color: #ac4142">("</span><span style="color: #6a9fb5">current_page</span><span style="color: #151515;background-color: #ac4142">"</span><span style="color: #6a9fb5">).value = </span><span style="color: #90a959">desiredPage;</span>
</pre>
</td>
</tr>
<tr id="line-15" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>15</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #6a9fb5">render</span><span style="color: #151515;background-color: #ac4142">();</span>
</pre>
</td>
</tr>
<tr id="line-16" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>16</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #151515;background-color: #ac4142">}</span>
</pre>
</td>
</tr>
<tr id="line-17" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>17</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #151515;background-color: #ac4142">}</span>
</pre>
</td>
</tr>
<tr id="line-18" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>18</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #151515;background-color: #ac4142">});</span>
</pre>
</td>
</tr>
</tbody>
</table>
</div>
Our PDF viewer in JavaScript can now display any page of the PDF file.
<figure class="post_image"><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=850/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-page-controls.png" alt="Page Controls" loading="lazy" width="870px" height="554px" class="resized-image resized-image-desktop" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1700/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-page-controls.png 2x"/><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=630/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-page-controls.png" alt="Page Controls" loading="lazy" width="650px" height="416px" class="resized-image resized-image-tablet" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1260/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-page-controls.png 2x"/><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=360/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-page-controls.png" alt="Page Controls" loading="lazy" width="380px" height="246px" class="resized-image resized-image-mobile" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=720/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-page-controls.png 2x"/></figure>
<h2><span class="ez-toc-section" id="6_Changing_the_Zoom_Level"></span>
<span class="sectionnum">6.</span> Changing the Zoom Level<span class="ez-toc-section-end"></span></h2>
Because our <code class="inline">render()</code> function already uses the <code class="inline">zoom</code> property of the state object while rendering a page, adjusting the zoom level is as easy as incrementing or decrementing the property and calling the function.
Inside the on-click event listener of the <code class="inline">zoom_in</code> button, let’s increment the <code class="inline">zoom</code> property by <code class="inline">0.5</code>.
<div class="rouge-syntax-highlight">
<table class="rouge-line-table html">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre>document.getElementById('zoom_in')
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre>    .addEventListener('click', (e) => {
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre>    if(myState.pdf == null) return;
</pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre>    myState.zoom += 0.5;
</pre>
</td>
</tr>
<tr id="line-5" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>5</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-6" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>6</pre>
</td>
<td class="rouge-code">
<pre>    render();
</pre>
</td>
</tr>
<tr id="line-7" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>7</pre>
</td>
<td class="rouge-code">
<pre>});
</pre>
</td>
</tr>
</tbody>
</table>
</div>
And inside the on-click event listener of the <code class="inline">zoom_out</code> button, let’s decrement the <code class="inline">zoom</code> property by <code class="inline">0.5</code>.
<div class="rouge-syntax-highlight">
<table class="rouge-line-table html">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre>document.getElementById('zoom_out')
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre>    .addEventListener('click', (e) => {
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre>    if(myState.pdf == null) return;
</pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre>    myState.zoom -= 0.5;
</pre>
</td>
</tr>
<tr id="line-5" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>5</pre>
</td>
<td class="rouge-code">
<pre>    
</pre>
</td>
</tr>
<tr id="line-6" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>6</pre>
</td>
<td class="rouge-code">
<pre>    render();
</pre>
</td>
</tr>
<tr id="line-7" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>7</pre>
</td>
<td class="rouge-code">
<pre>});
</pre>
</td>
</tr>
</tbody>
</table>
</div>
You are free to add upper and lower bounds to the <code class="inline">zoom</code> property, but they are not required.
This is what it looks like when it’s all put together.
<div class="rouge-syntax-highlight">
<table class="rouge-line-table html">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre> 
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"> <span style="color: #6a9fb5">lang=</span><span style="color: #90a959">"en"</span><span style="color: #f4bf75">></span>
</span></pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-5" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>5</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #f4bf75"><meta/> <span style="color: #6a9fb5">charset=</span><span style="color: #90a959">"utf-8"</span><span style="color: #f4bf75">></span>
</span></pre>
</td>
</tr>
<tr id="line-6" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>6</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #f4bf75"><meta/> <span style="color: #6a9fb5">name=</span><span style="color: #90a959">"viewport"</span> <span style="color: #6a9fb5">content=</span><span style="color: #90a959">"width=device-width, initial-scale=1"</span><span style="color: #f4bf75">></span>
</span></pre>
</td>
</tr>
<tr id="line-7" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>7</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #f4bf75"><title/></span>My PDF Viewer<span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-8" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>8</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #f4bf75"><script><![CDATA[
]]></script></span></pre>
</td>
</tr>
<tr id="line-9" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>9</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">    </span><span style="color: #6a9fb5">src=</span><span style="color: #90a959">"http://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.0.943/pdf.min.js"</span><span style="color: #f4bf75">></span>
</pre>
</td>
</tr>
<tr id="line-10" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>10</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-11" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>11</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-12" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>12</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #f4bf75"><style/></span>
</pre>
</td>
</tr>
<tr id="line-13" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>13</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #d0d0d0;background-color: #151515">#canvas_container</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-14" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>14</pre>
</td>
<td class="rouge-code">
<pre>          <span style="color: #d0d0d0;background-color: #151515">width</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">800px</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-15" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>15</pre>
</td>
<td class="rouge-code">
<pre>          <span style="color: #d0d0d0;background-color: #151515">top</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">450px</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-16" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>16</pre>
</td>
<td class="rouge-code">
<pre>          <span style="color: #d0d0d0;background-color: #151515">overflow</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">auto</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-17" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>17</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-18" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>18</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-19" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>19</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #d0d0d0;background-color: #151515">#canvas_container</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-20" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>20</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0;background-color: #151515">background</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">#333</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-21" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>21</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0;background-color: #151515">text-align</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">heart</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-22" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>22</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0;background-color: #151515">border</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">stable</span> <span style="color: #90a959">3px</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-23" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>23</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-24" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>24</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-25" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>25</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-26" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>26</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-27" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>27</pre>
</td>
<td class="rouge-code">
<pre>     <span style="color: #f4bf75"><p> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"my_pdf_viewer"</span><span style="color: #f4bf75">></span>
</p></span></pre>
</td>
</tr>
<tr id="line-28" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>28</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"><p> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"canvas_container"</span><span style="color: #f4bf75">></span>
</p></span></pre>
</td>
</tr>
<tr id="line-29" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>29</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><canvas> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"pdf_renderer"</span><span style="color: #f4bf75">></span></canvas></span>
</pre>
</td>
</tr>
<tr id="line-30" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>30</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-31" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>31</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-32" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>32</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"><p> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"navigation_controls"</span><span style="color: #f4bf75">></span>
</p></span></pre>
</td>
</tr>
<tr id="line-33" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>33</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><button> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"go_previous"</span><span style="color: #f4bf75">></span>Earlier<span style="color: #f4bf75"/></button></span>
</pre>
</td>
</tr>
<tr id="line-34" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>34</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><input/> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"current_page"</span> <span style="color: #6a9fb5">worth=</span><span style="color: #90a959">"1"</span> <span style="color: #6a9fb5">kind=</span><span style="color: #90a959">"quantity"</span><span style="color: #f4bf75">/></span>
</span></pre>
</td>
</tr>
<tr id="line-35" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>35</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><button> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"go_next"</span><span style="color: #f4bf75">></span>Subsequent<span style="color: #f4bf75"/></button></span>
</pre>
</td>
</tr>
<tr id="line-36" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>36</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-37" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>37</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-38" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>38</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"><p> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"zoom_controls"</span><span style="color: #f4bf75">></span>  
</p></span></pre>
</td>
</tr>
<tr id="line-39" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>39</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><button> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"zoom_in"</span><span style="color: #f4bf75">></span>+<span style="color: #f4bf75"/></button></span>
</pre>
</td>
</tr>
<tr id="line-40" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>40</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><button> <span style="color: #6a9fb5">id=</span><span style="color: #90a959">"zoom_out"</span><span style="color: #f4bf75">></span>-<span style="color: #f4bf75"/></button></span>
</pre>
</td>
</tr>
<tr id="line-41" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>41</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-42" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>42</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-43" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>43</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-44" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>44</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #f4bf75"><script/></span>
</pre>
</td>
</tr>
<tr id="line-45" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>45</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d28445">var</span> <span style="color: #d0d0d0;background-color: #151515">myState</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-46" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>46</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #6a9fb5">pdf</span><span style="color: #d0d0d0">:</span> <span style="color: #d28445">null</span><span style="color: #d0d0d0">,</span>
</pre>
</td>
</tr>
<tr id="line-47" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>47</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #6a9fb5">currentPage</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">1</span><span style="color: #d0d0d0">,</span>
</pre>
</td>
</tr>
<tr id="line-48" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>48</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #6a9fb5">zoom</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">1</span>
</pre>
</td>
</tr>
<tr id="line-49" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>49</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-50" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>50</pre>
</td>
<td class="rouge-code">
<pre>     
</pre>
</td>
</tr>
<tr id="line-51" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>51</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0;background-color: #151515">pdfjsLib</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getDocument</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">'</span><span style="color: #90a959">./my_document.pdf</span><span style="color: #90a959">'</span><span style="color: #d0d0d0">).</span><span style="color: #d0d0d0;background-color: #151515">then</span><span style="color: #d0d0d0">((</span><span style="color: #d0d0d0;background-color: #151515">pdf</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">=></span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-52" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>52</pre>
</td>
<td class="rouge-code">
<pre>     
</pre>
</td>
</tr>
<tr id="line-53" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>53</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">pdf</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">pdf</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-54" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>54</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d0d0d0;background-color: #151515">render</span><span style="color: #d0d0d0">();</span>
</pre>
</td>
</tr>
<tr id="line-55" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>55</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-56" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>56</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0">});</span>
</pre>
</td>
</tr>
<tr id="line-57" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>57</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-58" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>58</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d28445">perform</span> <span style="color: #d0d0d0;background-color: #151515">render</span><span style="color: #d0d0d0">()</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-59" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>59</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">pdf</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getPage</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">currentPage</span><span style="color: #d0d0d0">).</span><span style="color: #d0d0d0;background-color: #151515">then</span><span style="color: #d0d0d0">((</span><span style="color: #d0d0d0;background-color: #151515">web page</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">=></span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-60" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>60</pre>
</td>
<td class="rouge-code">
<pre>         
</pre>
</td>
</tr>
<tr id="line-61" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>61</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d28445">var</span> <span style="color: #d0d0d0;background-color: #151515">canvas</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">doc</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getElementById</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">"</span><span style="color: #90a959">pdf_renderer</span><span style="color: #90a959">"</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-62" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>62</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d28445">var</span> <span style="color: #d0d0d0;background-color: #151515">ctx</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">canvas</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getContext</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">'</span><span style="color: #90a959">second</span><span style="color: #90a959">'</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-63" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>63</pre>
</td>
<td class="rouge-code">
<pre>     
</pre>
</td>
</tr>
<tr id="line-64" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>64</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d28445">var</span> <span style="color: #d0d0d0;background-color: #151515">viewport</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">web page</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getViewport</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">zoom</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-65" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>65</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-66" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>66</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d0d0d0;background-color: #151515">canvas</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">width</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">viewport</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">width</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-67" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>67</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d0d0d0;background-color: #151515">canvas</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">top</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">viewport</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">top</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-68" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>68</pre>
</td>
<td class="rouge-code">
<pre>         
</pre>
</td>
</tr>
<tr id="line-69" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>69</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d0d0d0;background-color: #151515">web page</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">render</span><span style="color: #d0d0d0">({</span>
</pre>
</td>
</tr>
<tr id="line-70" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>70</pre>
</td>
<td class="rouge-code">
<pre>                    <span style="color: #6a9fb5">canvasContext</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">ctx</span><span style="color: #d0d0d0">,</span>
</pre>
</td>
</tr>
<tr id="line-71" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>71</pre>
</td>
<td class="rouge-code">
<pre>                    <span style="color: #6a9fb5">viewport</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">viewport</span>
</pre>
</td>
</tr>
<tr id="line-72" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>72</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d0d0d0">});</span>
</pre>
</td>
</tr>
<tr id="line-73" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>73</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d0d0d0">});</span>
</pre>
</td>
</tr>
<tr id="line-74" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>74</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-75" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>75</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-76" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>76</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0;background-color: #151515">doc</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getElementById</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">'</span><span style="color: #90a959">go_previous</span><span style="color: #90a959">'</span><span style="color: #d0d0d0">).</span><span style="color: #d0d0d0;background-color: #151515">addEventListener</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">'</span><span style="color: #90a959">click on</span><span style="color: #90a959">'</span><span style="color: #d0d0d0">,</span> <span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">e</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">=></span> <span style="color: #d0d0d0"></span> <span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">currentPage</span> <span style="color: #d0d0d0">==</span> <span style="color: #90a959">1</span><span style="color: #d0d0d0">)</span> 
</pre>
</td>
</tr>
<tr id="line-78" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>78</pre>
</td>
<td class="rouge-code">
<pre>              <span style="color: #aa759f">return</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-79" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>79</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">currentPage</span> <span style="color: #d0d0d0">-=</span> <span style="color: #90a959">1</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-80" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>80</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d0d0d0;background-color: #151515">doc</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getElementById</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">"</span><span style="color: #90a959">current_page</span><span style="color: #90a959">"</span><span style="color: #d0d0d0">).</span><span style="color: #d0d0d0;background-color: #151515">worth</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">currentPage</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-81" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>81</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d0d0d0;background-color: #151515">render</span><span style="color: #d0d0d0">();</span>
</pre>
</td>
</tr>
<tr id="line-82" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>82</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-83" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>83</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-84" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>84</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0;background-color: #151515">doc</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getElementById</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">'</span><span style="color: #90a959">go_next</span><span style="color: #90a959">'</span><span style="color: #d0d0d0">).</span><span style="color: #d0d0d0;background-color: #151515">addEventListener</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">'</span><span style="color: #90a959">click on</span><span style="color: #90a959">'</span><span style="color: #d0d0d0">,</span> <span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">e</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">=></span> <span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-91" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>91</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-92" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>92</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0;background-color: #151515">doc</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getElementById</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">'</span><span style="color: #90a959">current_page</span><span style="color: #90a959">'</span><span style="color: #d0d0d0">).</span><span style="color: #d0d0d0;background-color: #151515">addEventListener</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">'</span><span style="color: #90a959">keypress</span><span style="color: #90a959">'</span><span style="color: #d0d0d0">,</span> <span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">e</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">=></span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-93" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>93</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #aa759f">if</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">pdf</span> <span style="color: #d0d0d0">==</span> <span style="color: #d28445">null</span><span style="color: #d0d0d0">)</span> <span style="color: #aa759f">return</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-94" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>94</pre>
</td>
<td class="rouge-code">
<pre>         
</pre>
</td>
</tr>
<tr id="line-95" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>95</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #949494">// Get key code
</span>
</pre>
</td>
</tr>
<tr id="line-96" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>96</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d28445">var</span> <span style="color: #d0d0d0;background-color: #151515">code</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">e</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">keyCode</span> <span style="color: #d0d0d0">?</span> <span style="color: #d0d0d0;background-color: #151515">e</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">keyCode</span> <span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">e</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">which</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-97" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>97</pre>
</td>
<td class="rouge-code">
<pre>         
</pre>
</td>
</tr>
<tr id="line-98" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>98</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #949494">// If key code matches that of the Enter key
</span>
</pre>
</td>
</tr>
<tr id="line-99" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>99</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #aa759f">if</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">code</span> <span style="color: #d0d0d0">==</span> <span style="color: #90a959">13</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-100" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>100</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d28445">var</span> <span style="color: #d0d0d0;background-color: #151515">desiredPage</span> <span style="color: #d0d0d0">=</span> 
</pre>
</td>
</tr>
<tr id="line-101" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>101</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d0d0d0;background-color: #151515">doc</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getElementById</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">'</span><span style="color: #90a959">current_page</span><span style="color: #90a959">'</span><span style="color: #d0d0d0">).</span><span style="color: #d0d0d0;background-color: #151515">valueAsNumber</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-102" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>102</pre>
</td>
<td class="rouge-code">
<pre>                                 
</pre>
</td>
</tr>
<tr id="line-103" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>103</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #aa759f">if</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">desiredPage</span> <span style="color: #d0d0d0">>=</span> <span style="color: #90a959">1</span> <span style="color: #d0d0d0">&&</span> <span style="color: #d0d0d0;background-color: #151515">desiredPage</span> <span style="color: #d0d0d0"><=</span> <span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">pdf</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">_pdfInfo</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">numPages</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-104" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>104</pre>
</td>
<td class="rouge-code">
<pre>                    <span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">currentPage</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">desiredPage</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-105" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>105</pre>
</td>
<td class="rouge-code">
<pre>                    <span style="color: #d0d0d0;background-color: #151515">doc</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getElementById</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">"</span><span style="color: #90a959">current_page</span><span style="color: #90a959">"</span><span style="color: #d0d0d0">).</span><span style="color: #d0d0d0;background-color: #151515">worth</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">desiredPage</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-106" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>106</pre>
</td>
<td class="rouge-code">
<pre>                    <span style="color: #d0d0d0;background-color: #151515">render</span><span style="color: #d0d0d0">();</span>
</pre>
</td>
</tr>
<tr id="line-107" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>107</pre>
</td>
<td class="rouge-code">
<pre>                <span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-108" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>108</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-109" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>109</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0">});</span>
</pre>
</td>
</tr>
<tr id="line-110" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>110</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-111" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>111</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0;background-color: #151515">doc</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getElementById</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">'</span><span style="color: #90a959">zoom_in</span><span style="color: #90a959">'</span><span style="color: #d0d0d0">).</span><span style="color: #d0d0d0;background-color: #151515">addEventListener</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">'</span><span style="color: #90a959">click on</span><span style="color: #90a959">'</span><span style="color: #d0d0d0">,</span> <span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">e</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">=></span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-112" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>112</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #aa759f">if</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">pdf</span> <span style="color: #d0d0d0">==</span> <span style="color: #d28445">null</span><span style="color: #d0d0d0">)</span> <span style="color: #aa759f">return</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-113" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>113</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">zoom</span> <span style="color: #d0d0d0">+=</span> <span style="color: #90a959">0.5</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-114" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>114</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d0d0d0;background-color: #151515">render</span><span style="color: #d0d0d0">();</span>
</pre>
</td>
</tr>
<tr id="line-115" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>115</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0">});</span>
</pre>
</td>
</tr>
<tr id="line-116" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>116</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-117" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>117</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0;background-color: #151515">doc</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">getElementById</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">'</span><span style="color: #90a959">zoom_out</span><span style="color: #90a959">'</span><span style="color: #d0d0d0">).</span><span style="color: #d0d0d0;background-color: #151515">addEventListener</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">'</span><span style="color: #90a959">click on</span><span style="color: #90a959">'</span><span style="color: #d0d0d0">,</span> <span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">e</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">=></span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-118" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>118</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #aa759f">if</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">pdf</span> <span style="color: #d0d0d0">==</span> <span style="color: #d28445">null</span><span style="color: #d0d0d0">)</span> <span style="color: #aa759f">return</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-119" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>119</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d0d0d0;background-color: #151515">myState</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">zoom</span> <span style="color: #d0d0d0">-=</span> <span style="color: #90a959">0.5</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-120" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>120</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #d0d0d0;background-color: #151515">render</span><span style="color: #d0d0d0">();</span>
</pre>
</td>
</tr>
<tr id="line-121" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>121</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #d0d0d0">});</span>
</pre>
</td>
</tr>
<tr id="line-122" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>122</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-123" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>123</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-124" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>124</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>Our PDF viewer in JavaScript is prepared. Should you refresh the online web page once more, you need to be capable to view all of the pages current within the PDF doc in JavaScript and in addition zoom in to or zoom out of them.</p>
<figure class="post_image"><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=850/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-zoom-demo.png" alt="Zoom Demo" loading="lazy" width="870px" height="554px" class="resized-image resized-image-desktop" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1700/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-zoom-demo.png 2x"/><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=630/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-zoom-demo.png" alt="Zoom Demo" loading="lazy" width="650px" height="416px" class="resized-image resized-image-tablet" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1260/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-zoom-demo.png 2x"/><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=360/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-zoom-demo.png" alt="Zoom Demo" loading="lazy" width="380px" height="246px" class="resized-image resized-image-mobile" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=720/uploads/users/413/posts/36126/image/how-to-create-a-javascript-pdf-viewer-zoom-demo.png 2x"/></figure>
<h2 id="toc-lgn5-conclusion"><span class="ez-toc-section" id="Congratulations_Youve_Realized_to_Create_a_Viewer_for_PDF_Paperwork_in_JavaScript"></span>Congratulations! You’ve Realized to Create a Viewer for <span>PDF Paperwork in JavaScript!</span><br />
<span class="ez-toc-section-end"></span></h2>
<p>You now know the best way to use PDF.js to create a customized JavaScript PDF viewer on your web site. Together with your new viewer for PDF paperwork in JavaScript, you possibly can confidently supply a seamless person expertise whereas displaying your group's brochures, white papers, types, and different paperwork usually meant to be distributed as arduous copies.</p>
<p>You possibly can <a href="https://github.com/mozilla/pdf.js" target="_blank" rel="external noopener">learn more about PDF.js on the official GitHub repo</a>.</p>
</div>
<p></code></p>
</div>
<p></code></p>
</div>
<p></code></div>
<p></code></p>
</div>
<p><br />
<br /><a href="https://webdesign.tutsplus.com/how-to-create-a-pdf-viewer-in-javascript--cms-32505t" target="_blank" rel="noopener">Source link </a></p>

		
		
			</div><!-- .entry-content .clear -->
</div>

	
</article><!-- #post-## -->


	        <nav class="navigation post-navigation" aria-label="Post navigation">
	                <span class="screen-reader-text">Post navigation</span>
	                <div class="nav-links"><div class="nav-previous"><a title="Simple Slider (Carousel With Pure CSS)" href="https://jknews360.in/easy-slider-carousel-with-pure-css/" rel="prev"><span class="ast-post-nav"><span class="ahfb-svg-iconset ast-inline-flex svg-baseline"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M134.059 296H436c6.627 0 12-5.373 12-12v-56c0-6.627-5.373-12-12-12H134.059v-46.059c0-21.382-25.851-32.09-40.971-16.971L7.029 239.029c-9.373 9.373-9.373 24.569 0 33.941l86.059 86.059c15.119 15.119 40.971 4.411 40.971-16.971V296z'></path></svg></span> Previous</span> <p> Simple Slider (Carousel With Pure CSS) </p></a></div><div class="nav-next"><a title="From Design to Improvement With out Translation: How one can Discover the Actual Supply of Reality" href="https://jknews360.in/from-design-to-development-without-translation-how-to-find-the-real-source-of-truth/" rel="next"><span class="ast-post-nav">Next <span class="ahfb-svg-iconset ast-inline-flex svg-baseline"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M313.941 216H12c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12h301.941v46.059c0 21.382 25.851 32.09 40.971 16.971l86.059-86.059c9.373-9.373 9.373-24.569 0-33.941l-86.059-86.059c-15.119-15.119-40.971-4.411-40.971 16.971V216z'></path></svg></span></span> <p> From Design to Improvement With out Translation: How one can Discover the Actual Supply of Reality </p></a></div></div>
	        </nav><div class="ast-single-related-posts-container ast-container--"><div class="ast-related-posts-title-section"> <h2 class="ast-related-posts-title"> Related Posts </h2> </div><div class="ast-related-posts-wrapper">						<article class="ast-related-post post-873 post type-post status-publish format-standard has-post-thumbnail hentry category-web-development">
							<div class="ast-related-posts-inner-section">
								<div class="ast-related-post-content">
									<div class="ast-related-post-featured-section post-has-thumb"><div class="post-thumb-img-content post-thumb"><a aria-label="Read more about How To Make A Robust Case For Accessibility — Smashing Journal" href="https://jknews360.in/how-to-make-a-strong-case-for-accessibility-smashing-magazine-journal/"><img width="1024" height="576" src="https://jknews360.in/wp-content/uploads/2024/08/How-To-Make-A-Strong-Case-For-Accessibility-—-Smashing-1024x576.jpg" class="attachment-large size-large wp-post-image" alt="How To Make A Robust Case For Accessibility — Smashing Journal" title="How To Make A Robust Case For Accessibility — Smashing Journal" itemprop="" decoding="async" srcset="https://jknews360.in/wp-content/uploads/2024/08/How-To-Make-A-Strong-Case-For-Accessibility-—-Smashing-1024x576.jpg 1024w, https://jknews360.in/wp-content/uploads/2024/08/How-To-Make-A-Strong-Case-For-Accessibility-—-Smashing-300x169.jpg 300w, https://jknews360.in/wp-content/uploads/2024/08/How-To-Make-A-Strong-Case-For-Accessibility-—-Smashing-768x432.jpg 768w, https://jknews360.in/wp-content/uploads/2024/08/How-To-Make-A-Strong-Case-For-Accessibility-—-Smashing.jpg 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></a> </div></div>														<header class="entry-header related-entry-header">
																	<h3 class="ast-related-post-title entry-title">
				<a href="https://jknews360.in/how-to-make-a-strong-case-for-accessibility-smashing-magazine-journal/" target="_self" rel="bookmark noopener noreferrer">How To Make A Robust Case For Accessibility — Smashing Journal</a>
			</h3>
		<div class="entry-meta ast-related-cat-style--none ast-related-tag-style--none">			<span class="comments-link">
				<a href="https://jknews360.in/how-to-make-a-strong-case-for-accessibility-smashing-magazine-journal/#respond">Leave a Comment</a>			</span>

			 / <span class="ast-taxonomy-container cat-links default"><a href="https://jknews360.in/category/web-development/" rel="category tag">Web development</a></span> / By <span class="posted-by vcard author" itemtype="https://schema.org/Person" itemscope="itemscope" itemprop="author">			<a title="View all posts by luvparganiha"
				href="https://jknews360.in/author/luvparganiha/" rel="author"
				class="url fn n" itemprop="url"				>
				<span
				class="author-name" itemprop="name"				>
				luvparganiha			</span>
			</a>
		</span>

		</div>														</header>
																						<div class="entry-content clear">
																			</div>
								</div>
							</div>
						</article>
											<article class="ast-related-post post-876 post type-post status-publish format-standard has-post-thumbnail hentry category-web-development">
							<div class="ast-related-posts-inner-section">
								<div class="ast-related-post-content">
									<div class="ast-related-post-featured-section post-has-thumb"><div class="post-thumb-img-content post-thumb"><a aria-label="Read more about Find out how to Redirect a Web page or URL in WordPress" href="https://jknews360.in/how-to-redirect-a-page-or-url-in-wordpress/"><img width="400" height="277" src="https://jknews360.in/wp-content/uploads/2024/08/How-to-Redirect-a-Page-or-URL-in-WordPress.png" class="attachment-large size-large wp-post-image" alt="Find out how to Redirect a Web page or URL in WordPress" title="Find out how to Redirect a Web page or URL in WordPress" itemprop="" decoding="async" srcset="https://jknews360.in/wp-content/uploads/2024/08/How-to-Redirect-a-Page-or-URL-in-WordPress.png 400w, https://jknews360.in/wp-content/uploads/2024/08/How-to-Redirect-a-Page-or-URL-in-WordPress-300x208.png 300w" sizes="(max-width: 400px) 100vw, 400px" /></a> </div></div>														<header class="entry-header related-entry-header">
																	<h3 class="ast-related-post-title entry-title">
				<a href="https://jknews360.in/how-to-redirect-a-page-or-url-in-wordpress/" target="_self" rel="bookmark noopener noreferrer">Find out how to Redirect a Web page or URL in WordPress</a>
			</h3>
		<div class="entry-meta ast-related-cat-style--none ast-related-tag-style--none">			<span class="comments-link">
				<a href="https://jknews360.in/how-to-redirect-a-page-or-url-in-wordpress/#respond">Leave a Comment</a>			</span>

			 / <span class="ast-taxonomy-container cat-links default"><a href="https://jknews360.in/category/web-development/" rel="category tag">Web development</a></span> / By <span class="posted-by vcard author" itemtype="https://schema.org/Person" itemscope="itemscope" itemprop="author">			<a title="View all posts by luvparganiha"
				href="https://jknews360.in/author/luvparganiha/" rel="author"
				class="url fn n" itemprop="url"				>
				<span
				class="author-name" itemprop="name"				>
				luvparganiha			</span>
			</a>
		</span>

		</div>														</header>
																						<div class="entry-content clear">
																			</div>
								</div>
							</div>
						</article>
					</div> </div>		<div id="comments" class="comments-area comment-form-position-below ">
	
	
	
	
		<div id="respond" class="comment-respond">
		<h3 id="reply-title" class="comment-reply-title">Leave a Comment <small><a rel="nofollow" id="cancel-comment-reply-link" href="/how-to-create-a-javascript-pdf-viewer/#respond" style="display:none;">Cancel Reply</a></small></h3><form action="https://jknews360.in/wp-comments-post.php" method="post" id="ast-commentform" class="comment-form"><p class="comment-notes"><span id="email-notes">Your email address will not be published.</span> <span class="required-field-message">Required fields are marked <span class="required">*</span></span></p><div class="ast-row comment-textarea"><fieldset class="comment-form-comment"><legend class ="comment-form-legend"></legend><div class="comment-form-textarea ast-grid-common-col"><label for="comment" class="screen-reader-text">Type here..</label><textarea id="comment" name="comment" placeholder="Type here.." cols="45" rows="8" aria-required="true"></textarea></div></fieldset></div><div class="ast-comment-formwrap ast-row"><p class="comment-form-author ast-grid-common-col ast-width-lg-33 ast-width-md-4 ast-float"><label for="author" class="screen-reader-text">Name*</label><input id="author" name="author" type="text" value="" placeholder="Name*" size="30" aria-required='true' /></p>
<p class="comment-form-email ast-grid-common-col ast-width-lg-33 ast-width-md-4 ast-float"><label for="email" class="screen-reader-text">Email*</label><input id="email" name="email" type="text" value="" placeholder="Email*" size="30" aria-required='true' /></p>
<p class="comment-form-url ast-grid-common-col ast-width-lg-33 ast-width-md-4 ast-float"><label for="url"><label for="url" class="screen-reader-text">Website</label><input id="url" name="url" type="text" value="" placeholder="Website" size="30" /></label></p></div>
<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes" /> <label for="wp-comment-cookies-consent">Save my name, email, and website in this browser for the next time I comment.</label></p>
<p class="form-submit"><input name="submit" type="submit" id="submit" class="submit" value="Post Comment" /> <input type='hidden' name='comment_post_ID' value='2337' id='comment_post_ID' />
<input type='hidden' name='comment_parent' id='comment_parent' value='0' />
</p></form>	</div><!-- #respond -->
	
	
</div><!-- #comments -->

			</main><!-- #main -->
			
		
	</div><!-- #primary -->


	<div class="widget-area secondary" id="secondary" itemtype="https://schema.org/WPSideBar" itemscope="itemscope">
	<div class="sidebar-main" >
		
		<aside id="block-2" class="widget widget_block widget_search"><form role="search" method="get" action="https://jknews360.in/" class="wp-block-search__button-outside wp-block-search__text-button wp-block-search"    ><label class="wp-block-search__label" for="wp-block-search__input-1" >Search</label><div class="wp-block-search__inside-wrapper " ><input class="wp-block-search__input" id="wp-block-search__input-1" placeholder="" value="" type="search" name="s" required /><button aria-label="Search" class="wp-block-search__button wp-element-button" type="submit" >Search</button></div></form></aside><aside id="block-3" class="widget widget_block"><div class="wp-block-group is-layout-flow wp-block-group-is-layout-flow"><h2 class="wp-block-heading">Recent Posts</h2><ul class="wp-block-latest-posts__list wp-block-latest-posts"><li><a class="wp-block-latest-posts__post-title" href="https://jknews360.in/six-months-after-launching-a-supercomputer-with-1528-h100-ai-gpus-nvidias-ceo-announces-in-denmark-its-ai-era-impact/">“Six months after launching a supercomputer with 1,528 H100 AI GPUs, NVIDIA’s CEO announces in Denmark its AI-era impact.”</a></li>
<li><a class="wp-block-latest-posts__post-title" href="https://jknews360.in/the-legacy-of-ratan-tata-a-visionary-leader-passed-away-who-changed-india-forever/">The Legacy of Ratan Tata: A Visionary Leader passed away Who Changed India Forever</a></li>
<li><a class="wp-block-latest-posts__post-title" href="https://jknews360.in/bhiwani-assembly-of-haryana-election-results-live-updates-for-2024/">Bhiwani, Assembly of Haryana Election Results: Live Updates for 2024</a></li>
<li><a class="wp-block-latest-posts__post-title" href="https://jknews360.in/jiocinemas-power-move-youtube-india-head-ishan-chatterjee-joins-as-chief-business-officer/">JioCinema’s Power Move: YouTube India Head Ishan Chatterjee Joins as Chief Business Officer!</a></li>
<li><a class="wp-block-latest-posts__post-title" href="https://jknews360.in/womens-twenty20-world-cup-2024-india-vs-pakistan-live-score-ind-w-8-0-2-shafali-smriti-start-106-run-chase-vs-pak-w/">Women’s Twenty20 World Cup 2024: India vs. Pakistan Live Score: IND-W 8/0 (2); Shafali, Smriti start 106-run chase vs. PAK-W</a></li>
</ul></div></aside><aside id="block-4" class="widget widget_block"><div class="wp-block-group is-layout-flow wp-block-group-is-layout-flow"><h2 class="wp-block-heading">Recent Comments</h2><div class="no-comments wp-block-latest-comments">No comments to show.</div></div></aside><aside id="block-5" class="widget widget_block"><div class="wp-block-group is-layout-flow wp-block-group-is-layout-flow"><h2 class="wp-block-heading">Archives</h2><ul class="wp-block-archives-list wp-block-archives">	<li><a href='https://jknews360.in/2024/10/'>October 2024</a></li>
	<li><a href='https://jknews360.in/2024/09/'>September 2024</a></li>
	<li><a href='https://jknews360.in/2024/08/'>August 2024</a></li>
	<li><a href='https://jknews360.in/2024/07/'>July 2024</a></li>
</ul></div></aside><aside id="block-6" class="widget widget_block"><div class="wp-block-group is-layout-flow wp-block-group-is-layout-flow"><h2 class="wp-block-heading">Categories</h2><ul class="wp-block-categories-list wp-block-categories">	<li class="cat-item cat-item-1"><a href="https://jknews360.in/category/blog/">Blog</a>
</li>
	<li class="cat-item cat-item-15"><a href="https://jknews360.in/category/crypto-currency/">Crypto currency</a>
</li>
	<li class="cat-item cat-item-13"><a href="https://jknews360.in/category/technology/">Technology</a>
</li>
	<li class="cat-item cat-item-4"><a href="https://jknews360.in/category/trending-now/">Trending now</a>
</li>
	<li class="cat-item cat-item-16"><a href="https://jknews360.in/category/web-development/">Web development</a>
</li>
</ul></div></aside><aside id="subscriber_widget-2" class="widget widget_subscriber_widget"><div class="sfsi_subscribe_Popinner">
					<form method="post" onsubmit="return sfsi_processfurther(this);" target="popupwindow" action="https://api.follow.it/subscription-form/SFk1WU1ycUhrbVVMRFZWUC8yWndHUlNkSVZncFJtKytVZEkyK3NLa0EreEQ2M2tVR3VUYWQ1RkthTWo5ZE94cEdqeDZ5eUZLM05reW50Zjd1UzNiVmd2clFDSGFHSnhSMFFGaHNoS2R2OExGS2pDWmxjaENvMFdjTHM2bGRPWFd8b3A1d3NreDNGUHJvVU41VG5mNGlrTXJvQmxQcS9Yd2gwclRrNTdWbTBEYz0=/8/">
						<h5>Get new posts by email</h5>
						<div class="sfsi_subscription_form_field">
						<input type="hidden" name="action" value="followPub">
							<input type="email" name="email" value="" placeholder="Subscribe"/>
						</div>
						<div class="sfsi_subscription_form_field">
							<input type="submit" name="subscribe" value="Subscribe"/>
						</div>
					</form>
				</div></aside>
	</div><!-- .sidebar-main -->
</div><!-- #secondary -->


	</div> <!-- ast-container -->
	</div><!-- #content -->
<footer
class="site-footer" id="colophon" itemtype="https://schema.org/WPFooter" itemscope="itemscope" itemid="#colophon">
			<div class="site-below-footer-wrap ast-builder-grid-row-container site-footer-focus-item ast-builder-grid-row-full ast-builder-grid-row-tablet-full ast-builder-grid-row-mobile-full ast-footer-row-stack ast-footer-row-tablet-stack ast-footer-row-mobile-stack" data-section="section-below-footer-builder">
	<div class="ast-builder-grid-row-container-inner">
					<div class="ast-builder-footer-grid-columns site-below-footer-inner-wrap ast-builder-grid-row">
											<div class="site-footer-below-section-1 site-footer-section site-footer-section-1">
								<div class="ast-builder-layout-element ast-flex site-footer-focus-item ast-footer-copyright" data-section="section-footer-builder">
				<div class="ast-footer-copyright"><p>Copyright © 2025  | Powered by <a href="https://wpastra.com/" rel="nofollow noopener" target="_blank">Astra WordPress Theme</a></p>
</div>			</div>
						</div>
										</div>
			</div>

</div>
	</footer><!-- #colophon -->
	</div><!-- #page -->
                <!--facebook like and share js -->
                <div id="fb-root"></div>
                <script>
                    (function(d, s, id) {
                        var js, fjs = d.getElementsByTagName(s)[0];
                        if (d.getElementById(id)) return;
                        js = d.createElement(s);
                        js.id = id;
                        js.src = "https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2";
                        fjs.parentNode.insertBefore(js, fjs);
                    }(document, 'script', 'facebook-jssdk'));
                </script>
                			<script src="https://apis.google.com/js/platform.js"></script>
            <div class="sfsi_outr_div"><div class="sfsi_FrntInner_chg" style="background-color:#eff7f7;border:1px solid#f3faf2; font-style:;color:#000000;box-shadow:12px 30px 18px #CCCCCC;"><div class="sfsiclpupwpr" onclick="sfsihidemepopup();"><img src="https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/close.png" alt="error" /></div><h2 style="font-family:Helvetica,Arial,sans-serif;font-style:;color:#000000;font-size:30px">Enjoy this blog? Please spread the word :)</h2><ul style="margin-bottom:0px"><li><div style='width:51px; height:51px;margin-left:5px;margin-bottom:5px; ' class='sfsi_wicons ' ><div class='inerCnt'><a class=' sficn' data-effect='' target='_blank' rel='noopener'  href='https://www.facebook.com/jeet.parganiha.5' id='sfsiid_facebook_icon' style='width:51px;height:51px;opacity:1;'  ><img data-pin-nopin='true' alt='Facebook' title='Facebook' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/icons_theme/animated_icons/animated_icons_facebook.gif' width='51' height='51' style='' class='sfcm sfsi_wicon ' data-effect=''   /></a><div class="sfsi_tool_tip_2 fb_tool_bdr sfsiTlleft" style="opacity:0;z-index:-1;" id="sfsiid_facebook"><span class="bot_arow bot_fb_arow"></span><div class="sfsi_inside"><div  class='icon2'><div class="fb-like" width="200" data-href="https%3A%2F%2Fjknews360.in%2Fhow-to-create-a-javascript-pdf-viewer%2F"  data-send="false"  data-layout="button_count"  ></div></div><div  class='icon3'><a target='_blank' rel='noopener' href='https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fjknews360.in%2Fhow-to-create-a-javascript-pdf-viewer' style='display:inline-block;'  > <img class='sfsi_wicon'  data-pin-nopin='true' alt='fb-share-icon' title='Facebook Share' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/share_icons/fb_icons/en_US.svg' /></a></div></div></div></div></div></li><li><div style='width:51px; height:51px;margin-left:5px;margin-bottom:5px; ' class='sfsi_wicons ' ><div class='inerCnt'><a class=' sficn' data-effect='' target='_blank' rel='noopener'  href='https://twitter.com/jeetparganiha' id='sfsiid_twitter_icon' style='width:51px;height:51px;opacity:1;'  ><img data-pin-nopin='true' alt='X (Twitter)' title='X (Twitter)' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/icons_theme/animated_icons/animated_icons_twitter.gif' width='51' height='51' style='' class='sfcm sfsi_wicon ' data-effect=''   /></a><div class="sfsi_tool_tip_2 twt_tool_bdr sfsiTlleft" style="opacity:0;z-index:-1;" id="sfsiid_twitter"><span class="bot_arow bot_twt_arow"></span><div class="sfsi_inside"><div  class='icon1'><a target="_blank" href="https://twitter.com/intent/user?screen_name=https://twitter.com/jeetparganiha">
			<img data-pin-nopin= true src="https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/share_icons/Twitter_Follow/en_US_Follow.svg" class="sfsi_wicon" alt="Follow Me" title="Follow Me" style="opacity: 1;" />
			</a></div><div  class='icon2'><div class='sf_twiter' style='display: inline-block;vertical-align: middle;width: auto;'>
						<a target='_blank' rel='noopener' href='https://twitter.com/intent/tweet?text=Hey%2C+check+out+this+cool+site+I+found%3A+www.yourname.com+%23Topic+via%40my_x_twitter_name+https%3A%2F%2Fjknews360.in%2Fhow-to-create-a-javascript-pdf-viewer' style='display:inline-block' >
							<img data-pin-nopin= true class='sfsi_wicon' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/share_icons/Twitter_Tweet/en_US_Tweet.svg' alt='Post on X' title='Post on X' >
						</a>
					</div></div></div></div></div></div></li><li><div style='width:51px; height:51px;margin-left:5px;margin-bottom:5px; ' class='sfsi_wicons ' ><div class='inerCnt'><a class=' sficn' data-effect='' target='_blank' rel='noopener'  href='https://www.youtube.com/channel/UCFyGMMIIh9x-Go637dpDllg' id='sfsiid_youtube_icon' style='width:51px;height:51px;opacity:1;'  ><img data-pin-nopin='true' alt='YouTube' title='YouTube' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/icons_theme/animated_icons/animated_icons_youtube.gif' width='51' height='51' style='' class='sfcm sfsi_wicon ' data-effect=''   /></a><div class="sfsi_tool_tip_2 utube_tool_bdr sfsiTlleft" style="opacity:0;z-index:-1;" id="sfsiid_youtube"><span class="bot_arow bot_utube_arow"></span><div class="sfsi_inside"><div  class='icon1'><a href='https://www.youtube.com/channel/UCFyGMMIIh9x-Go637dpDllg'  target='_blank' rel='noopener'><img data-pin-nopin='true' class='sfsi_wicon' alt='YouTube' title='YouTube' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/visit_icons/Visit_us_youtube/icon_Visit_us_en_US.svg' /></a></div><div  class='icon2'><div class="g-ytsubscribe" data-channelid="UCFyGMMIIh9x-Go637dpDllg" data-layout="default" data-count="hidden"></div></div></div></div></div></div></li><li><div style='width:51px; height:51px;margin-left:5px;margin-bottom:5px; ' class='sfsi_wicons ' ><div class='inerCnt'><a class=' sficn' data-effect='' target='_blank' rel='noopener'  href='https://in.pinterest.com/jeetuparganiha/' id='sfsiid_pinterest_icon' style='width:51px;height:51px;opacity:1;'  ><img data-pin-nopin='true' alt='Pinterest' title='Pinterest' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/icons_theme/animated_icons/animated_icons_pinterest.gif' width='51' height='51' style='' class='sfcm sfsi_wicon ' data-effect=''   /></a><div class="sfsi_tool_tip_2 printst_tool_bdr sfsiTlleft" style="opacity:0;z-index:-1;" id="sfsiid_pinterest"><span class="bot_arow bot_pintst_arow"></span><div class="sfsi_inside"><div  class='icon2'><a href='#' onclick='sfsi_pinterest_modal_images(event)' class='sfsi_pinterest_sm_click' style='display:inline-block;'><img class='sfsi_wicon' data-pin-nopin='true' alt='fb-share-icon' title='Pin Share' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/share_icons/Pinterest_Save/en_US_save.svg' /></a></div></div></div></div></div></li><li><div style='width:51px; height:51px;margin-left:5px;margin-bottom:5px; ' class='sfsi_wicons ' ><div class='inerCnt'><a class=' sficn' data-effect='' target='_blank' rel='noopener'  href='https://www.linkedin.com/in/jeet-parganiha-b92305116/' id='sfsiid_linkedin_icon' style='width:51px;height:51px;opacity:1;'  ><img data-pin-nopin='true' alt='LinkedIn' title='LinkedIn' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/icons_theme/animated_icons/animated_icons_linkedin.gif' width='51' height='51' style='' class='sfcm sfsi_wicon ' data-effect=''   /></a><div class="sfsi_tool_tip_2 linkedin_tool_bdr sfsiTlleft" style="opacity:0;z-index:-1;" id="sfsiid_linkedin"><span class="bot_arow bot_linkedin_arow"></span><div class="sfsi_inside"><div  class='icon2'><a target='_blank' rel='noopener' href="https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fjknews360.in%2Fhow-to-create-a-javascript-pdf-viewer"><img class="sfsi_wicon" data-pin-nopin= true alt="Share" title="Share" src="https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/share_icons/Linkedin_Share/en_US_share.svg" /></a></div></div></div></div></div></li><li><div style='width:51px; height:51px;margin-left:5px;margin-bottom:5px; ' class='sfsi_wicons ' ><div class='inerCnt'><a class=' sficn' data-effect='' target='_blank' rel='noopener'  href='https://www.instagram.com/jeetparganiha/' id='sfsiid_instagram_icon' style='width:51px;height:51px;opacity:1;'  ><img data-pin-nopin='true' alt='Instagram' title='Instagram' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/icons_theme/animated_icons/animated_icons_instagram.gif' width='51' height='51' style='' class='sfcm sfsi_wicon ' data-effect=''   /></a></div></div></li></ul></div></div><script>

window.addEventListener('sfsi_functions_loaded', function() {
    if (typeof sfsi_time_pop_up == 'function') {
        sfsi_time_pop_up(5000);
    }
})
</script>
<div class="norm_row sfsi_wDiv sfsi_floater_position_center-right" id="sfsi_floater" style="z-index: 9999;width:45px;text-align:left;position:absolute;position:absolute;right:30px;top:50%;"><div style='width:40px; height:40px;margin-left:5px;margin-bottom:5px; ' class='sfsi_wicons shuffeldiv ' ><div class='inerCnt'><a class=' sficn' data-effect='' target='_blank' rel='noopener'  href='https://www.facebook.com/jeet.parganiha.5' id='sfsiid_facebook_icon' style='width:40px;height:40px;opacity:1;'  ><img data-pin-nopin='true' alt='Facebook' title='Facebook' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/icons_theme/animated_icons/animated_icons_facebook.gif' width='40' height='40' style='' class='sfcm sfsi_wicon ' data-effect=''   /></a><div class="sfsi_tool_tip_2 fb_tool_bdr sfsiTlleft" style="opacity:0;z-index:-1;" id="sfsiid_facebook"><span class="bot_arow bot_fb_arow"></span><div class="sfsi_inside"><div  class='icon2'><div class="fb-like" width="200" data-href="https%3A%2F%2Fjknews360.in%2Fhow-to-create-a-javascript-pdf-viewer%2F"  data-send="false"  data-layout="button_count"  ></div></div><div  class='icon3'><a target='_blank' rel='noopener' href='https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fjknews360.in%2Fhow-to-create-a-javascript-pdf-viewer' style='display:inline-block;'  > <img class='sfsi_wicon'  data-pin-nopin='true' alt='fb-share-icon' title='Facebook Share' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/share_icons/fb_icons/en_US.svg' /></a></div></div></div></div></div><div style='width:40px; height:40px;margin-left:5px;margin-bottom:5px; ' class='sfsi_wicons shuffeldiv ' ><div class='inerCnt'><a class=' sficn' data-effect='' target='_blank' rel='noopener'  href='https://twitter.com/jeetparganiha' id='sfsiid_twitter_icon' style='width:40px;height:40px;opacity:1;'  ><img data-pin-nopin='true' alt='X (Twitter)' title='X (Twitter)' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/icons_theme/animated_icons/animated_icons_twitter.gif' width='40' height='40' style='' class='sfcm sfsi_wicon ' data-effect=''   /></a><div class="sfsi_tool_tip_2 twt_tool_bdr sfsiTlleft" style="opacity:0;z-index:-1;" id="sfsiid_twitter"><span class="bot_arow bot_twt_arow"></span><div class="sfsi_inside"><div  class='icon1'><a target="_blank" href="https://twitter.com/intent/user?screen_name=https://twitter.com/jeetparganiha">
			<img data-pin-nopin= true src="https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/share_icons/Twitter_Follow/en_US_Follow.svg" class="sfsi_wicon" alt="Follow Me" title="Follow Me" style="opacity: 1;" />
			</a></div><div  class='icon2'><div class='sf_twiter' style='display: inline-block;vertical-align: middle;width: auto;'>
						<a target='_blank' rel='noopener' href='https://twitter.com/intent/tweet?text=Hey%2C+check+out+this+cool+site+I+found%3A+www.yourname.com+%23Topic+via%40my_x_twitter_name+https%3A%2F%2Fjknews360.in%2Fhow-to-create-a-javascript-pdf-viewer' style='display:inline-block' >
							<img data-pin-nopin= true class='sfsi_wicon' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/share_icons/Twitter_Tweet/en_US_Tweet.svg' alt='Post on X' title='Post on X' >
						</a>
					</div></div></div></div></div></div><div style='width:40px; height:40px;margin-left:5px;margin-bottom:5px; ' class='sfsi_wicons shuffeldiv ' ><div class='inerCnt'><a class=' sficn' data-effect='' target='_blank' rel='noopener'  href='https://www.youtube.com/channel/UCFyGMMIIh9x-Go637dpDllg' id='sfsiid_youtube_icon' style='width:40px;height:40px;opacity:1;'  ><img data-pin-nopin='true' alt='YouTube' title='YouTube' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/icons_theme/animated_icons/animated_icons_youtube.gif' width='40' height='40' style='' class='sfcm sfsi_wicon ' data-effect=''   /></a><div class="sfsi_tool_tip_2 utube_tool_bdr sfsiTlleft" style="opacity:0;z-index:-1;" id="sfsiid_youtube"><span class="bot_arow bot_utube_arow"></span><div class="sfsi_inside"><div  class='icon1'><a href='https://www.youtube.com/channel/UCFyGMMIIh9x-Go637dpDllg'  target='_blank' rel='noopener'><img data-pin-nopin='true' class='sfsi_wicon' alt='YouTube' title='YouTube' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/visit_icons/Visit_us_youtube/icon_Visit_us_en_US.svg' /></a></div><div  class='icon2'><div class="g-ytsubscribe" data-channelid="UCFyGMMIIh9x-Go637dpDllg" data-layout="default" data-count="hidden"></div></div></div></div></div></div><div style='width:40px; height:40px;margin-left:5px;margin-bottom:5px; ' class='sfsi_wicons shuffeldiv ' ><div class='inerCnt'><a class=' sficn' data-effect='' target='_blank' rel='noopener'  href='https://in.pinterest.com/jeetuparganiha/' id='sfsiid_pinterest_icon' style='width:40px;height:40px;opacity:1;'  ><img data-pin-nopin='true' alt='Pinterest' title='Pinterest' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/icons_theme/animated_icons/animated_icons_pinterest.gif' width='40' height='40' style='' class='sfcm sfsi_wicon ' data-effect=''   /></a><div class="sfsi_tool_tip_2 printst_tool_bdr sfsiTlleft" style="opacity:0;z-index:-1;" id="sfsiid_pinterest"><span class="bot_arow bot_pintst_arow"></span><div class="sfsi_inside"><div  class='icon2'><a href='#' onclick='sfsi_pinterest_modal_images(event)' class='sfsi_pinterest_sm_click' style='display:inline-block;'><img class='sfsi_wicon' data-pin-nopin='true' alt='fb-share-icon' title='Pin Share' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/share_icons/Pinterest_Save/en_US_save.svg' /></a></div></div></div></div></div><div style='width:40px; height:40px;margin-left:5px;margin-bottom:5px; ' class='sfsi_wicons shuffeldiv ' ><div class='inerCnt'><a class=' sficn' data-effect='' target='_blank' rel='noopener'  href='https://www.linkedin.com/in/jeet-parganiha-b92305116/' id='sfsiid_linkedin_icon' style='width:40px;height:40px;opacity:1;'  ><img data-pin-nopin='true' alt='LinkedIn' title='LinkedIn' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/icons_theme/animated_icons/animated_icons_linkedin.gif' width='40' height='40' style='' class='sfcm sfsi_wicon ' data-effect=''   /></a><div class="sfsi_tool_tip_2 linkedin_tool_bdr sfsiTlleft" style="opacity:0;z-index:-1;" id="sfsiid_linkedin"><span class="bot_arow bot_linkedin_arow"></span><div class="sfsi_inside"><div  class='icon2'><a target='_blank' rel='noopener' href="https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fjknews360.in%2Fhow-to-create-a-javascript-pdf-viewer"><img class="sfsi_wicon" data-pin-nopin= true alt="Share" title="Share" src="https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/share_icons/Linkedin_Share/en_US_share.svg" /></a></div></div></div></div></div><div style='width:40px; height:40px;margin-left:5px;margin-bottom:5px; ' class='sfsi_wicons shuffeldiv ' ><div class='inerCnt'><a class=' sficn' data-effect='' target='_blank' rel='noopener'  href='https://www.instagram.com/jeetparganiha/' id='sfsiid_instagram_icon' style='width:40px;height:40px;opacity:1;'  ><img data-pin-nopin='true' alt='Instagram' title='Instagram' src='https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/images/icons_theme/animated_icons/animated_icons_instagram.gif' width='40' height='40' style='' class='sfcm sfsi_wicon ' data-effect=''   /></a></div></div></div ><input type='hidden' id='sfsi_floater_sec' value='center-right' /><script>window.addEventListener("sfsi_functions_loaded", function()
			{
				if (typeof sfsi_widget_set == "function") {
					sfsi_widget_set();
				}
			}); window.addEventListener('sfsi_functions_loaded',function()
					  {
						var topalign = ( jQuery(window).height() - jQuery('#sfsi_floater').height() ) / 2;
						jQuery('#sfsi_floater').css('top',topalign);
					  	sfsi_float_widget('center');
					  });jQuery( document ).ready(function( $ ) { sfsi_shuffle(); });</script><script>
window.addEventListener('sfsi_functions_loaded', function() {
    if (typeof sfsi_plugin_version == 'function') {
        sfsi_plugin_version(2.77);
    }
});

function sfsi_processfurther(ref) {
    var feed_id = 'SFk1WU1ycUhrbVVMRFZWUC8yWndHUlNkSVZncFJtKytVZEkyK3NLa0EreEQ2M2tVR3VUYWQ1RkthTWo5ZE94cEdqeDZ5eUZLM05reW50Zjd1UzNiVmd2clFDSGFHSnhSMFFGaHNoS2R2OExGS2pDWmxjaENvMFdjTHM2bGRPWFd8b3A1d3NreDNGUHJvVU41VG5mNGlrTXJvQmxQcS9Yd2gwclRrNTdWbTBEYz0=';
    var feedtype = 8;
    var email = jQuery(ref).find('input[name="email"]').val();
    var filter = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
    if ((email != "Enter your email") && (filter.test(email))) {
        if (feedtype == "8") {
            var url = "https://api.follow.it/subscription-form/" + feed_id + "/" + feedtype;
            window.open(url, "popupwindow", "scrollbars=yes,width=1080,height=760");
            return true;
        }
    } else {
        alert("Please enter email address");
        jQuery(ref).find('input[name="email"]').focus();
        return false;
    }
}
</script>
<style type="text/css" aria-selected="true">
.sfsi_subscribe_Popinner {
    width: 100% !important;

    height: auto !important;

    
    padding: 18px 0px !important;

    background-color: #ffffff !important;
}

.sfsi_subscribe_Popinner form {
    margin: 0 20px !important;
}

.sfsi_subscribe_Popinner h5 {
    font-family: Helvetica,Arial,sans-serif !important;

    font-weight: bold !important;
                color: #000000 !important;    
        font-size: 16px !important;    
        text-align: center !important;        margin: 0 0 10px !important;
    padding: 0 !important;
}

.sfsi_subscription_form_field {
    margin: 5px 0 !important;
    width: 100% !important;
    display: inline-flex;
    display: -webkit-inline-flex;
}

.sfsi_subscription_form_field input {
    width: 100% !important;
    padding: 10px 0px !important;
}

.sfsi_subscribe_Popinner input[type=email] {
        font-family: Helvetica,Arial,sans-serif !important;    
    font-style: normal !important;
        
        font-size: 14px !important;    
        text-align: center !important;    }

.sfsi_subscribe_Popinner input[type=email]::-webkit-input-placeholder {

        font-family: Helvetica,Arial,sans-serif !important;    
    font-style: normal !important;
           
        font-size: 14px !important;    
        text-align: center !important;    }

.sfsi_subscribe_Popinner input[type=email]:-moz-placeholder {
    /* Firefox 18- */
        font-family: Helvetica,Arial,sans-serif !important;    
    font-style: normal !important;
        
        font-size: 14px !important;    
        text-align: center !important;    
}

.sfsi_subscribe_Popinner input[type=email]::-moz-placeholder {
    /* Firefox 19+ */
        font-family: Helvetica,Arial,sans-serif !important;    
        font-style: normal !important;
        
            font-size: 14px !important;                text-align: center !important;    }

.sfsi_subscribe_Popinner input[type=email]:-ms-input-placeholder {

    font-family: Helvetica,Arial,sans-serif !important;
    font-style: normal !important;
        
            font-size: 14px !important ;
            text-align: center !important;    }

.sfsi_subscribe_Popinner input[type=submit] {

        font-family: Helvetica,Arial,sans-serif !important;    
    font-weight: bold !important;
            color: #000000 !important;    
        font-size: 16px !important;    
        text-align: center !important;    
        background-color: #dedede !important;    }

.sfsi_shortcode_container {
        float: left;
    }

    .sfsi_shortcode_container .norm_row .sfsi_wDiv {
        position: relative !important;
    }

    .sfsi_shortcode_container .sfsi_holders {
        display: none;
    }

    </style>

					<div class="ez-toc-sticky ">
						<div class="ez-toc-sticky-fixed hide ez-toc-sticky-grey">
							<div class='ez-toc-sidebar'><div class="ez-toc-sticky-title-container">
<p class="ez-toc-sticky-title" style="cursor:inherit">Table of Contents</p>
<a class="ez-toc-close-icon" href="#" onclick="ezTOC_hideBar(event)" aria-label="×"><span aria-hidden="true">×</span></a>
</div>
<div id="ez-toc-sticky-container" class="ez-toc-sticky-container ez-toc-sticky-v2_0_71 counter-flat ez-toc-sticky-toggle-counter">
<nav class='ez-toc-sticky-toggle-direction'><ul class='ez-toc-sticky-list ez-toc-sticky-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-sticky-page-1'><a class="ez-toc-link ez-toc-heading-1" href="#2_Getting_PDFjs" title="2. Getting PDF.js">2. Getting PDF.js</a></li><li class='ez-toc-sticky-page-1'><a class="ez-toc-link ez-toc-heading-2" href="#3_Loading_a_PDF_File" title="3. Loading a PDF File">3. Loading a PDF File</a></li><li class='ez-toc-sticky-page-1'><a class="ez-toc-link ez-toc-heading-3" href="#4_Rendering_a_Page" title="4. Rendering a Page">4. Rendering a Page</a></li><li class='ez-toc-sticky-page-1'><a class="ez-toc-link ez-toc-heading-4" href="#5_Changing_the_Current_Page" title="5. Changing the Current Page">5. Changing the Current Page</a></li><li class='ez-toc-sticky-page-1'><a class="ez-toc-link ez-toc-heading-5" href="#6_Changing_the_Zoom_Level" title="6. Changing the Zoom Level">6. Changing the Zoom Level</a></li><li class='ez-toc-sticky-page-1'><a class="ez-toc-link ez-toc-heading-6" href="#Congratulations_Youve_Realized_to_Create_a_Viewer_for_PDF_Paperwork_in_JavaScript" title="Congratulations! You’ve Realized to Create a Viewer for PDF Paperwork in JavaScript!">Congratulations! You’ve Realized to Create a Viewer for PDF Paperwork in JavaScript!</a></li></ul></nav></div>
</div>
						</div>
						<a class='ez-toc-open-icon' href='#' onclick='ezTOC_showBar(event)' >
							<span class="arrow">→</span>
							<span class="text">Index</span>
						</a>
					</div>
					<!-- YouTube Feeds JS -->
<script type="text/javascript">

</script>

<div id="ast-scroll-top" tabindex="0" class="ast-scroll-top-icon ast-scroll-to-top-right" data-on-devices="both">
	<span class="ast-icon icon-arrow"><svg class="ast-arrow-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="26px" height="16.043px" viewBox="57 35.171 26 16.043" enable-background="new 57 35.171 26 16.043" xml:space="preserve">
                <path d="M57.5,38.193l12.5,12.5l12.5-12.5l-2.5-2.5l-10,10l-10-10L57.5,38.193z"/>
                </svg></span>	<span class="screen-reader-text">Scroll to Top</span>
</div>
			<script>
				const lazyloadRunObserver = () => {
					const lazyloadBackgrounds = document.querySelectorAll( `.e-con.e-parent:not(.e-lazyloaded)` );
					const lazyloadBackgroundObserver = new IntersectionObserver( ( entries ) => {
						entries.forEach( ( entry ) => {
							if ( entry.isIntersecting ) {
								let lazyloadBackground = entry.target;
								if( lazyloadBackground ) {
									lazyloadBackground.classList.add( 'e-lazyloaded' );
								}
								lazyloadBackgroundObserver.unobserve( entry.target );
							}
						});
					}, { rootMargin: '200px 0px 200px 0px' } );
					lazyloadBackgrounds.forEach( ( lazyloadBackground ) => {
						lazyloadBackgroundObserver.observe( lazyloadBackground );
					} );
				};
				const events = [
					'DOMContentLoaded',
					'elementor/lazyload/observe',
				];
				events.forEach( ( event ) => {
					document.addEventListener( event, lazyloadRunObserver );
				} );
			</script>
			<script src="https://jknews360.in/wp-includes/js/comment-reply.min.js?ver=6.7.2" id="comment-reply-js" async data-wp-strategy="async"></script>
<script id="astra-theme-js-js-extra">
var astra = {"break_point":"921","isRtl":"","is_scroll_to_id":"1","is_scroll_to_top":"1","is_header_footer_builder_active":"1","responsive_cart_click":"flyout"};
</script>
<script src="https://jknews360.in/wp-content/themes/astra/assets/js/minified/frontend.min.js?ver=4.8.1" id="astra-theme-js-js"></script>
<script src="https://jknews360.in/wp-includes/js/jquery/ui/core.min.js?ver=1.13.3" id="jquery-ui-core-js"></script>
<script src="https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/js/shuffle/modernizr.custom.min.js?ver=6.7.2" id="SFSIjqueryModernizr-js"></script>
<script src="https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/js/shuffle/jquery.shuffle.min.js?ver=6.7.2" id="SFSIjqueryShuffle-js"></script>
<script src="https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/js/shuffle/random-shuffle-min.js?ver=6.7.2" id="SFSIjqueryrandom-shuffle-js"></script>
<script id="SFSICustomJs-js-extra">
var sfsi_icon_ajax_object = {"nonce":"c97a58a34b","ajax_url":"https:\/\/jknews360.in\/wp-admin\/admin-ajax.php","plugin_url":"https:\/\/jknews360.in\/wp-content\/plugins\/ultimate-social-media-icons\/"};
</script>
<script src="https://jknews360.in/wp-content/plugins/ultimate-social-media-icons/js/custom.js?ver=2.9.4" id="SFSICustomJs-js"></script>
<script id="ez-toc-scroll-scriptjs-js-extra">
var eztoc_smooth_local = {"scroll_offset":"30","add_request_uri":""};
</script>
<script src="https://jknews360.in/wp-content/plugins/easy-table-of-contents/assets/js/smooth_scroll.min.js?ver=2.0.71" id="ez-toc-scroll-scriptjs-js"></script>
<script src="https://jknews360.in/wp-content/plugins/easy-table-of-contents/vendor/js-cookie/js.cookie.min.js?ver=2.2.1" id="ez-toc-js-cookie-js"></script>
<script src="https://jknews360.in/wp-content/plugins/easy-table-of-contents/vendor/sticky-kit/jquery.sticky-kit.min.js?ver=1.9.2" id="ez-toc-jquery-sticky-kit-js"></script>
<script id="ez-toc-js-js-extra">
var ezTOC = {"smooth_scroll":"1","visibility_hide_by_default":"1","scroll_offset":"30","fallbackIcon":"<span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span>","chamomile_theme_is_on":""};
</script>
<script src="https://jknews360.in/wp-content/plugins/easy-table-of-contents/assets/js/front.min.js?ver=2.0.71-1734165784" id="ez-toc-js-js"></script>
<script id="ez-toc-sticky-js-extra">
var eztoc_sticky_local = {"close_on_link_click":""};
</script>
<script src="https://jknews360.in/wp-content/plugins/easy-table-of-contents/assets/js/ez-toc-sticky.min.js?ver=2.0.71-1734165784" id="ez-toc-sticky-js"></script>
<script id="eael-general-js-extra">
var localize = {"ajaxurl":"https:\/\/jknews360.in\/wp-admin\/admin-ajax.php","nonce":"57a52b5586","i18n":{"added":"Added ","compare":"Compare","loading":"Loading..."},"eael_translate_text":{"required_text":"is a required field","invalid_text":"Invalid","billing_text":"Billing","shipping_text":"Shipping","fg_mfp_counter_text":"of"},"page_permalink":"https:\/\/jknews360.in\/how-to-create-a-javascript-pdf-viewer\/","cart_redirectition":"","cart_page_url":"","el_breakpoints":{"mobile":{"label":"Mobile Portrait","value":767,"default_value":767,"direction":"max","is_enabled":true},"mobile_extra":{"label":"Mobile Landscape","value":880,"default_value":880,"direction":"max","is_enabled":false},"tablet":{"label":"Tablet Portrait","value":1024,"default_value":1024,"direction":"max","is_enabled":true},"tablet_extra":{"label":"Tablet Landscape","value":1200,"default_value":1200,"direction":"max","is_enabled":false},"laptop":{"label":"Laptop","value":1366,"default_value":1366,"direction":"max","is_enabled":false},"widescreen":{"label":"Widescreen","value":2400,"default_value":2400,"direction":"min","is_enabled":false}},"ParticleThemesData":{"default":"{\"particles\":{\"number\":{\"value\":160,\"density\":{\"enable\":true,\"value_area\":800}},\"color\":{\"value\":\"#ffffff\"},\"shape\":{\"type\":\"circle\",\"stroke\":{\"width\":0,\"color\":\"#000000\"},\"polygon\":{\"nb_sides\":5},\"image\":{\"src\":\"img\/github.svg\",\"width\":100,\"height\":100}},\"opacity\":{\"value\":0.5,\"random\":false,\"anim\":{\"enable\":false,\"speed\":1,\"opacity_min\":0.1,\"sync\":false}},\"size\":{\"value\":3,\"random\":true,\"anim\":{\"enable\":false,\"speed\":40,\"size_min\":0.1,\"sync\":false}},\"line_linked\":{\"enable\":true,\"distance\":150,\"color\":\"#ffffff\",\"opacity\":0.4,\"width\":1},\"move\":{\"enable\":true,\"speed\":6,\"direction\":\"none\",\"random\":false,\"straight\":false,\"out_mode\":\"out\",\"bounce\":false,\"attract\":{\"enable\":false,\"rotateX\":600,\"rotateY\":1200}}},\"interactivity\":{\"detect_on\":\"canvas\",\"events\":{\"onhover\":{\"enable\":true,\"mode\":\"repulse\"},\"onclick\":{\"enable\":true,\"mode\":\"push\"},\"resize\":true},\"modes\":{\"grab\":{\"distance\":400,\"line_linked\":{\"opacity\":1}},\"bubble\":{\"distance\":400,\"size\":40,\"duration\":2,\"opacity\":8,\"speed\":3},\"repulse\":{\"distance\":200,\"duration\":0.4},\"push\":{\"particles_nb\":4},\"remove\":{\"particles_nb\":2}}},\"retina_detect\":true}","nasa":"{\"particles\":{\"number\":{\"value\":250,\"density\":{\"enable\":true,\"value_area\":800}},\"color\":{\"value\":\"#ffffff\"},\"shape\":{\"type\":\"circle\",\"stroke\":{\"width\":0,\"color\":\"#000000\"},\"polygon\":{\"nb_sides\":5},\"image\":{\"src\":\"img\/github.svg\",\"width\":100,\"height\":100}},\"opacity\":{\"value\":1,\"random\":true,\"anim\":{\"enable\":true,\"speed\":1,\"opacity_min\":0,\"sync\":false}},\"size\":{\"value\":3,\"random\":true,\"anim\":{\"enable\":false,\"speed\":4,\"size_min\":0.3,\"sync\":false}},\"line_linked\":{\"enable\":false,\"distance\":150,\"color\":\"#ffffff\",\"opacity\":0.4,\"width\":1},\"move\":{\"enable\":true,\"speed\":1,\"direction\":\"none\",\"random\":true,\"straight\":false,\"out_mode\":\"out\",\"bounce\":false,\"attract\":{\"enable\":false,\"rotateX\":600,\"rotateY\":600}}},\"interactivity\":{\"detect_on\":\"canvas\",\"events\":{\"onhover\":{\"enable\":true,\"mode\":\"bubble\"},\"onclick\":{\"enable\":true,\"mode\":\"repulse\"},\"resize\":true},\"modes\":{\"grab\":{\"distance\":400,\"line_linked\":{\"opacity\":1}},\"bubble\":{\"distance\":250,\"size\":0,\"duration\":2,\"opacity\":0,\"speed\":3},\"repulse\":{\"distance\":400,\"duration\":0.4},\"push\":{\"particles_nb\":4},\"remove\":{\"particles_nb\":2}}},\"retina_detect\":true}","bubble":"{\"particles\":{\"number\":{\"value\":15,\"density\":{\"enable\":true,\"value_area\":800}},\"color\":{\"value\":\"#1b1e34\"},\"shape\":{\"type\":\"polygon\",\"stroke\":{\"width\":0,\"color\":\"#000\"},\"polygon\":{\"nb_sides\":6},\"image\":{\"src\":\"img\/github.svg\",\"width\":100,\"height\":100}},\"opacity\":{\"value\":0.3,\"random\":true,\"anim\":{\"enable\":false,\"speed\":1,\"opacity_min\":0.1,\"sync\":false}},\"size\":{\"value\":50,\"random\":false,\"anim\":{\"enable\":true,\"speed\":10,\"size_min\":40,\"sync\":false}},\"line_linked\":{\"enable\":false,\"distance\":200,\"color\":\"#ffffff\",\"opacity\":1,\"width\":2},\"move\":{\"enable\":true,\"speed\":8,\"direction\":\"none\",\"random\":false,\"straight\":false,\"out_mode\":\"out\",\"bounce\":false,\"attract\":{\"enable\":false,\"rotateX\":600,\"rotateY\":1200}}},\"interactivity\":{\"detect_on\":\"canvas\",\"events\":{\"onhover\":{\"enable\":false,\"mode\":\"grab\"},\"onclick\":{\"enable\":false,\"mode\":\"push\"},\"resize\":true},\"modes\":{\"grab\":{\"distance\":400,\"line_linked\":{\"opacity\":1}},\"bubble\":{\"distance\":400,\"size\":40,\"duration\":2,\"opacity\":8,\"speed\":3},\"repulse\":{\"distance\":200,\"duration\":0.4},\"push\":{\"particles_nb\":4},\"remove\":{\"particles_nb\":2}}},\"retina_detect\":true}","snow":"{\"particles\":{\"number\":{\"value\":450,\"density\":{\"enable\":true,\"value_area\":800}},\"color\":{\"value\":\"#fff\"},\"shape\":{\"type\":\"circle\",\"stroke\":{\"width\":0,\"color\":\"#000000\"},\"polygon\":{\"nb_sides\":5},\"image\":{\"src\":\"img\/github.svg\",\"width\":100,\"height\":100}},\"opacity\":{\"value\":0.5,\"random\":true,\"anim\":{\"enable\":false,\"speed\":1,\"opacity_min\":0.1,\"sync\":false}},\"size\":{\"value\":5,\"random\":true,\"anim\":{\"enable\":false,\"speed\":40,\"size_min\":0.1,\"sync\":false}},\"line_linked\":{\"enable\":false,\"distance\":500,\"color\":\"#ffffff\",\"opacity\":0.4,\"width\":2},\"move\":{\"enable\":true,\"speed\":6,\"direction\":\"bottom\",\"random\":false,\"straight\":false,\"out_mode\":\"out\",\"bounce\":false,\"attract\":{\"enable\":false,\"rotateX\":600,\"rotateY\":1200}}},\"interactivity\":{\"detect_on\":\"canvas\",\"events\":{\"onhover\":{\"enable\":true,\"mode\":\"bubble\"},\"onclick\":{\"enable\":true,\"mode\":\"repulse\"},\"resize\":true},\"modes\":{\"grab\":{\"distance\":400,\"line_linked\":{\"opacity\":0.5}},\"bubble\":{\"distance\":400,\"size\":4,\"duration\":0.3,\"opacity\":1,\"speed\":3},\"repulse\":{\"distance\":200,\"duration\":0.4},\"push\":{\"particles_nb\":4},\"remove\":{\"particles_nb\":2}}},\"retina_detect\":true}","nyan_cat":"{\"particles\":{\"number\":{\"value\":150,\"density\":{\"enable\":false,\"value_area\":800}},\"color\":{\"value\":\"#ffffff\"},\"shape\":{\"type\":\"star\",\"stroke\":{\"width\":0,\"color\":\"#000000\"},\"polygon\":{\"nb_sides\":5},\"image\":{\"src\":\"http:\/\/wiki.lexisnexis.com\/academic\/images\/f\/fb\/Itunes_podcast_icon_300.jpg\",\"width\":100,\"height\":100}},\"opacity\":{\"value\":0.5,\"random\":false,\"anim\":{\"enable\":false,\"speed\":1,\"opacity_min\":0.1,\"sync\":false}},\"size\":{\"value\":4,\"random\":true,\"anim\":{\"enable\":false,\"speed\":40,\"size_min\":0.1,\"sync\":false}},\"line_linked\":{\"enable\":false,\"distance\":150,\"color\":\"#ffffff\",\"opacity\":0.4,\"width\":1},\"move\":{\"enable\":true,\"speed\":14,\"direction\":\"left\",\"random\":false,\"straight\":true,\"out_mode\":\"out\",\"bounce\":false,\"attract\":{\"enable\":false,\"rotateX\":600,\"rotateY\":1200}}},\"interactivity\":{\"detect_on\":\"canvas\",\"events\":{\"onhover\":{\"enable\":false,\"mode\":\"grab\"},\"onclick\":{\"enable\":true,\"mode\":\"repulse\"},\"resize\":true},\"modes\":{\"grab\":{\"distance\":200,\"line_linked\":{\"opacity\":1}},\"bubble\":{\"distance\":400,\"size\":40,\"duration\":2,\"opacity\":8,\"speed\":3},\"repulse\":{\"distance\":200,\"duration\":0.4},\"push\":{\"particles_nb\":4},\"remove\":{\"particles_nb\":2}}},\"retina_detect\":true}"},"eael_login_nonce":"5af765a287","eael_register_nonce":"bef5209666","eael_lostpassword_nonce":"ffb7b6e8cf","eael_resetpassword_nonce":"670e104b95"};
</script>
<script src="https://jknews360.in/wp-content/plugins/essential-addons-for-elementor-lite/assets/front-end/js/view/general.min.js?ver=6.1.0" id="eael-general-js"></script>
<script id="fifu-json-ld-js-extra">
var fifuJsonLd = {"url":"https:\/\/i0.wp.com\/jknews360.in\/wp-content\/uploads\/2024\/09\/How-to-create-a-JavaScript-PDF-viewer.png?ssl=1"};
</script>
<script src="https://jknews360.in/wp-content/plugins/featured-image-from-url/includes/html/js/json-ld.js?ver=4.9.7" id="fifu-json-ld-js"></script>
<script src="https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js?ver=1.0.0" id="remote_sdk-js" defer data-wp-strategy="defer"></script>
			<script>
			/(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())},!1);
			</script>
				</body>
</html>


<!-- Page cached by LiteSpeed Cache 6.5.4 on 2025-02-24 04:10:17 -->