نحوه ایجاد یک نمایشگر PDF JavaScript

نحوه ایجاد یک نمایشگر PDF JavaScript

عنصر

1

id="canvas_container">

2
     id="pdf_renderer">
3

برای ساده نگه داشتن کارها، ما در هر زمان فقط یک صفحه را در داخل بوم نمایش می دهیم. با این حال، به کاربران اجازه می‌دهیم تا با فشار دادن یک دکمه به صفحه قبلی یا صفحه بعدی سوئیچ کنند. علاوه بر این، برای نمایش شماره صفحه فعلی و اجازه دادن به کاربران برای پرش به هر صفحه ای که می خواهند، رابط ما دارای یک فیلد ورودی خواهد بود.

برای پشتیبانی از عملیات زوم، دو دکمه دیگر را به رابط اضافه کنید: یکی برای بزرگنمایی و دیگری برای بزرگنمایی.

1

id="zoom_controls">

2
    
3
    
4

در انتهای این بخش، کد صفحه وب به شکل زیر است.

1
 
2
 lang="en">
3

4
   charset="utf-8">
5
   name="viewport" content="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>Previous<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">value=</span><span style="color: #90a959">"1"</span> <span style="color: #6a9fb5">type=</span><span style="color: #90a959">"number"</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>Next<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="sectionnum">2.</span> دریافت PDF.js</h2>
<p>اکنون که یک رابط کاربری بدون شک برای نمایشگر PDF جاوا اسکریپت ما آماده است، بیایید PDF.js را به صفحه وب خود اضافه کنیم. از آنجایی که آخرین نسخه کتابخانه در CDNJS موجود است، می‌توانیم این کار را با افزودن خطوط زیر در انتهای صفحه وب انجام دهیم.</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 src="data:text/javascript;base64,PCEoQ0RBVEEoKSk+" defer></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>اگر ترجیح می دهید از نسخه محلی کتابخانه استفاده کنید، می توانید آن را از مخزن pdfjs-dist دانلود کنید.</p>
<h2>
<span class="sectionnum">3.</span> بارگذاری یک فایل PDF</h2>
<p>قبل از شروع بارگذاری یک فایل PDF، بیایید یک شی جاوا اسکریپت ساده ایجاد کنیم تا وضعیت نمایشگر PDF خود را در JS ذخیره کند. در داخل آن، ما سه مورد خواهیم داشت: ارجاع به خود فایل PDF، نمایه صفحه فعلی و سطح بزرگنمایی فعلی.</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 Wikipedia.
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="sectionnum">4.</span> Rendering a Page</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 src="data:text/javascript;base64,PCEoQ0RBVEEoKSk+" defer></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>Previous<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">value=</span><span style="color: #90a959">"1"</span> <span style="color: #6a9fb5">type=</span><span style="color: #90a959">"number"</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>Next<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="نسخه ی نمایشی" 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="دمو" 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="نسخه ی نمایشی" 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>
ممکن است متوجه شده باشید که اندازه نمایشگر PDF ما در حال حاضر به اندازه صفحه ارائه شده و سطح بزرگنمایی بستگی دارد. این ایده‌آل نیست زیرا ما نمی‌خواهیم در حالی که کاربران با نمایشگر PDF در جاوا اسکریپت تعامل دارند، طرح‌بندی صفحه وب ما تحت تأثیر قرار گیرد. 
برای رفع این مشکل، تنها کاری که باید انجام دهیم این است که یک عرض و ارتفاع ثابت به آن بدهیم <code class="inline">
<div> element encapsulating our canvas and set its <code class="inline">overflow</code> ویژگی CSS به <code class="inline">auto</code>. این ویژگی، در صورت لزوم، نوارهای اسکرول را به آن اضافه می کند <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="نسخه ی نمایشی با پس زمینه" 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="نسخه نمایشی با پس زمینه" 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="نسخه ی نمایشی با پس زمینه" 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="sectionnum">5.</span> تغییر صفحه فعلی</h2>
نمایشگر پی دی اف جاوا اسکریپت ما در حال حاضر قادر است تنها صفحه اول هر فایل پی دی اف داده شده به آن را نشان دهد. برای اینکه به کاربران اجازه دهیم صفحه در حال ارائه را تغییر دهند، اکنون باید شنوندگان رویداد کلیک را به صفحه اضافه کنیم <code class="inline">go_previous</code> و <code class="inline">go_next</code> دکمه هایی که قبلا ایجاد کردیم
در داخل شنونده رویداد از <code class="inline">go_previous</code> را فشار دهید، ما باید آن را کاهش دهیم <code class="inline">currentPage</code> ویژگی شی state ما، مطمئن شویم که زیر آن قرار نگیرد <code class="inline">1</code>. پس از انجام این کار، می توانیم به سادگی با آن تماس بگیریم <code class="inline">render()</code> دوباره برای رندر صفحه جدید عمل کنید.
علاوه بر این، باید مقدار the را به روز کنیم <code class="inline">current_page</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('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>
<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|| myState.currentPage == 1) 
</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>
به طور مشابه، در داخل شنونده رویداد از <code class="inline">go_next</code> را فشار دهید، ما باید آن را افزایش دهیم <code class="inline">currentPage</code> ویژگی، در حالی که اطمینان حاصل می کنیم که از تعداد صفحات موجود در فایل PDF تجاوز نمی کند، که می توانیم با استفاده از <code class="inline">numPages</code> دارایی از <code class="inline">_pdfInfo</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('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) => {
</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 || 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>
در نهایت، ما باید یک شنونده رویداد مطبوعاتی کلیدی را به آن اضافه کنیم <code class="inline">current_page</code> فیلد متنی به طوری که کاربران می توانند مستقیماً با تایپ شماره صفحه و زدن آن به هر صفحه ای که می خواهند بپرند <strong>وارد کنید</strong> کلید در داخل شنونده رویداد، باید مطمئن شویم که عددی که کاربر وارد کرده است هم بزرگتر از صفر و هم کوچکتر یا مساوی باشد. <code class="inline">numPages</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('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>
نمایشگر PDF ما در جاوا اسکریپت اکنون می تواند هر صفحه ای از فایل PDF را نمایش دهد.
<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="کنترل های صفحه" 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="کنترل های صفحه" 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="کنترل های صفحه" 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="sectionnum">6.</span> تغییر سطح بزرگنمایی</h2>
چون ما <code class="inline">render()</code> تابع قبلاً از <code class="inline">zoom</code> ویژگی شی state در حین رندر کردن صفحه، تنظیم سطح بزرگنمایی به آسانی افزایش یا کاهش ویژگی و فراخوانی تابع است.
در داخل شنونده رویداد روی کلیک <code class="inline">zoom_in</code> را فشار دهید، بیایید آن را افزایش دهیم <code class="inline">zoom</code> دارایی توسط <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>
و در داخل شنونده رویداد روی کلیک <code class="inline">zoom_out</code> را فشار دهید، بیایید مقدار را کاهش دهیم <code class="inline">zoom</code> دارایی توسط <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>
شما آزاد هستید که کرانهای بالا و پایین را به آن اضافه کنید <code class="inline">zoom</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><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 src="data:text/javascript;base64,PCEoQ0RBVEEoKSk+" defer></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">height</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">center</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">solid</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>Previous<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">value=</span><span style="color: #90a959">"1"</span> <span style="color: #6a9fb5">type=</span><span style="color: #90a959">"number"</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>Next<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">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-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">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">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-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">2d</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">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">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-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">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">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">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</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-77" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>77</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: #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">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">current_page</span><span style="color: #90a959">"</span><span style="color: #d0d0d0">).</span><span style="color: #d0d0d0;background-color: #151515">value</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">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">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</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-85" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>85</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: #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">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> 
</pre>
</td>
</tr>
<tr id="line-86" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>86</pre>
</td>
<td class="rouge-code">
<pre>               <span style="color: #aa759f">return</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-87" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>87</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-88" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>88</pre>
</td>
<td class="rouge-code">
<pre>            <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">current_page</span><span style="color: #90a959">"</span><span style="color: #d0d0d0">).</span><span style="color: #d0d0d0;background-color: #151515">value</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-89" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>89</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-90" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>90</pre>
</td>
<td class="rouge-code">
<pre>        <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">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">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">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">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">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">current_page</span><span style="color: #90a959">"</span><span style="color: #d0d0d0">).</span><span style="color: #d0d0d0;background-color: #151515">value</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">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">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</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">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">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</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>نمایشگر PDF ما در جاوا اسکریپت آماده است. اگر دوباره صفحه وب را بازخوانی کنید، باید بتوانید تمام صفحات موجود در سند PDF را در جاوا اسکریپت مشاهده کنید و همچنین آنها را بزرگنمایی یا کوچکنمایی کنید.</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="زوم نسخه نمایشی" 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="زوم نسخه نمایشی" 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="زوم نسخه نمایشی" 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>اسناد PDF در جاوا اسکریپت!</span><br />
</h2>
<p>اکنون می دانید که چگونه از PDF.js برای ایجاد یک نمایشگر پی دی اف جاوا اسکریپت سفارشی برای وب سایت خود استفاده کنید. با نمایشگر جدید خود برای اسناد PDF در جاوا اسکریپت، می‌توانید با اطمینان تجربه کاربری بی‌نظیری را در حین نمایش بروشورها، برگه‌های سفید، فرم‌ها و سایر اسنادی که عموماً به عنوان نسخه‌های چاپی توزیع می‌شوند، ارائه دهید.</p>
<p>می‌توانید درباره PDF.js در مخزن رسمی GitHub اطلاعات بیشتری کسب کنید.</p>
</div>
<p></code></p>
</div>
<p></code></p>
</div>
<p></code></div>
<p></code></p>
</div>
<p>
منبع: https://webdesign.tutsplus.com/how-to-create-a-pdf-viewer-in-javascript--cms-32505t</p>
	</div><!-- .entry-content -->

	<footer class="entry-footer default-max-width">
		<div class="posted-by"><span class="posted-on">منتشر شده در <time class="entry-date published updated" datetime="2019-01-07T07:51:12+03:30">ژانویه 7, 2019</time></span><span class="byline">توسط <a href="https://abtintheme.ir/author/ashraff_hathibelagal/" rel="author">Ashraff Hathibelagal</a></span></div><div class="post-taxonomies"><span class="cat-links">دسته‌بندی شده در <a href="https://abtintheme.ir/category/news/" rel="category tag">اخبار</a> </span><span class="tags-links">برچسب خورده با <a href="https://abtintheme.ir/tag/%d9%88%d8%a8-%d8%b3%d8%a7%db%8c%d8%aa/" rel="tag">وب سایت</a></span></div>	</footer><!-- .entry-footer -->

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

	<nav class="navigation post-navigation" aria-label="نوشته‌ها">
		<h2 class="screen-reader-text">راهبری نوشته</h2>
		<div class="nav-links"><div class="nav-previous"><a href="https://abtintheme.ir/%d8%aa%da%a9%d9%86%db%8c%da%a9-%d9%87%d8%a7%db%8c-%d9%85%d8%b5%d8%a7%d8%ad%d8%a8%d9%87-%d9%87%d9%85%d8%af%d9%84%db%8c-%d8%af%d8%b1-%d8%aa%d9%81%da%a9%d8%b1-%d8%b7%d8%b1%d8%a7%d8%ad%db%8c/" rel="prev"><p class="meta-nav"><svg class="svg-icon" width="24" height="24" aria-hidden="true" role="img" focusable="false" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="m4 13v-2h12l-4-4 1-2 7 7-7 7-1-2 4-4z" fill="currentColor"/></svg>نوشتهٔ پیشین</p><p class="post-title">تکنیک های مصاحبه همدلی در تفکر طراحی</p></a></div><div class="nav-next"><a href="https://abtintheme.ir/%d9%86%d8%ad%d9%88%d9%87-%d8%b3%d8%a7%d8%ae%d8%aa-%da%a9%d8%a7%d9%85%d9%be%d9%88%d9%86%d9%86%d8%aa-%d9%81%db%8c%d9%84%d8%aa%d8%b1-%d8%af%d8%b1-css-%d8%ae%d8%a7%d9%84%d8%b5-2-%d8%b1%d9%88%d8%b4/" rel="next"><p class="meta-nav">نوشته بعدی<svg class="svg-icon" width="24" height="24" aria-hidden="true" role="img" focusable="false" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M20 13v-2H8l4-4-1-2-7 7 7 7 1-2-4-4z" fill="currentColor"/></svg></p><p class="post-title">نحوه ساخت کامپوننت فیلتر در CSS خالص (2 روش)</p></a></div></div>
	</nav>			</main><!-- #main -->
		</div><!-- #primary -->
	</div><!-- #content -->

	
	<aside class="widget-area">
		<section id="block-3" class="widget widget_block">
<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<h2 class="wp-block-heading">نوشته‌های تازه</h2>


<ul class="wp-block-latest-posts__list wp-block-latest-posts"><li><a class="wp-block-latest-posts__post-title" href="https://abtintheme.ir/20-%d8%a8%d9%87%d8%aa%d8%b1%db%8c%d9%86-%d9%82%d8%a7%d9%84%d8%a8-%da%86%d8%a7%d9%be-%da%a9%d9%88%d9%be%d9%86-%d9%88-%da%a9%d9%88%d9%be%d9%86-speckyboy/">20+ بهترین قالب چاپ کوپن و کوپن – Speckyboy</a></li>
<li><a class="wp-block-latest-posts__post-title" href="https://abtintheme.ir/%d8%a7%d9%87%d9%85%db%8c%d8%aa-%d8%aa%d8%ae%d8%b1%db%8c%d8%a8-%d8%b2%db%8c%d8%a8%d8%a7-%d8%af%d8%b1-%d8%b7%d8%b1%d8%a7%d8%ad%db%8c-%d8%b1%d8%a7%d8%a8%d8%b7-%d8%af%d8%b1-%d8%af%d8%b3%d8%aa%d8%b1%d8%b3/">اهمیت تخریب زیبا در طراحی رابط در دسترس – مجله Smashing</a></li>
<li><a class="wp-block-latest-posts__post-title" href="https://abtintheme.ir/%d9%88%db%8c%da%98%da%af%db%8c-%d9%87%d8%a7%db%8c-%d8%b5%d9%81%d8%ad%d9%87-%d9%86%d8%aa%d8%a7%db%8c%d8%ac-%d9%85%d9%88%d8%aa%d9%88%d8%b1-%d8%ac%d8%b3%d8%aa%d8%ac%d9%88%db%8c-%da%af%d9%88%da%af%d9%84/">ویژگی های صفحه نتایج موتور جستجوی گوگل (SERP) • Yoast</a></li>
<li><a class="wp-block-latest-posts__post-title" href="https://abtintheme.ir/%d9%85%d9%87%d8%a7%d8%b1%d8%aa-%d9%87%d8%a7%db%8c-seo-%d8%ae%d9%88%d8%af-%d8%b1%d8%a7-%d8%a7%d8%b2-%d8%b7%d8%b1%db%8c%d9%82-%d8%a2%d8%b2%d9%85%d8%a7%db%8c%d8%b4-%d8%a7%d9%81%d8%b2%d8%a7%db%8c%d8%b4/">مهارت های SEO خود را از طریق آزمایش افزایش دهید • Yoast</a></li>
<li><a class="wp-block-latest-posts__post-title" href="https://abtintheme.ir/%d8%a8%d8%b3%d8%aa%d9%87%d8%a8%d9%86%d8%af%db%8c-%da%a9%d9%86%db%8c%d8%af-%d9%88-%d8%af%d8%b1-%da%a9%d8%aa%d8%a7%d8%a8%d9%87%d8%a7-%d9%88-%da%a9%d8%a7%d8%b1%da%af%d8%a7%d9%87-2/">بسته‌بندی کنید و در کتاب‌ها و کارگاه‌های آموزشی Smashing صرفه‌جویی کنید – مجله Smashing</a></li>
<li><a class="wp-block-latest-posts__post-title" href="https://abtintheme.ir/%d8%a8%db%8c%d8%b4-%d8%a7%d8%b2-20-%d8%a7%d9%84%da%af%d9%88%db%8c-%d8%a8%d9%87%d8%aa%d8%b1%db%8c%d9%86-%d8%b9%d9%86%d9%88%d8%a7%d9%86-%d8%a8%d8%b1%d8%a7%db%8c-davinci-resolve-speckyboy/">بیش از 20 الگوی بهترین عنوان برای DaVinci Resolve – Speckyboy</a></li>
<li><a class="wp-block-latest-posts__post-title" href="https://abtintheme.ir/%d8%a7%db%8c%d8%ac%d8%a7%d8%af-%db%8c%da%a9-%d9%81%d8%b1%d9%85-%da%86%d9%86%d8%af-%d9%85%d8%b1%d8%ad%d9%84%d9%87-%d8%a7%db%8c-%d9%85%d9%88%d8%ab%d8%b1-%d8%a8%d8%b1%d8%a7%db%8c-%d8%aa%d8%ac%d8%b1%d8%a8/">ایجاد یک فرم چند مرحله ای موثر برای تجربه کاربری بهتر – مجله Smashing</a></li>
<li><a class="wp-block-latest-posts__post-title" href="https://abtintheme.ir/15-%d8%a8%d9%87%d8%aa%d8%b1%db%8c%d9%86-%d8%a7%d9%84%da%af%d9%88%d9%87%d8%a7%db%8c-%d9%88%db%8c%d8%af%d8%a6%d9%88%db%8c%db%8c-%d8%b1%d8%b2%d9%88%d9%85%d9%87-%d9%88-cv-speckyboy/">15+ بهترین الگوهای ویدئویی رزومه و CV – Speckyboy</a></li>
<li><a class="wp-block-latest-posts__post-title" href="https://abtintheme.ir/dreaming-of-miracles-december-2024-wallpapers-edition-smashing-magazine/">Dreaming Of Miracles (December 2024 Wallpapers Edition) — Smashing Magazine</a></li>
<li><a class="wp-block-latest-posts__post-title" href="https://abtintheme.ir/take-charge-of-your-local-seo-presence-yoast/">Take charge of your local SEO presence • Yoast</a></li>
</ul></div></div>
</section><section id="block-4" class="widget widget_block">
<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow"></div></div>
</section><section id="block-6" class="widget widget_block">
<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow"></div></div>
</section>	</aside><!-- .widget-area -->

	
	<footer id="colophon" class="site-footer">

				<div class="site-info">
			<div class="site-name">
																						<a href="https://abtintheme.ir/">آبتین تم</a>
																		</div><!-- .site-name -->

			
			
<!-- .powered-by -->

		</div><!-- .site-info -->
	</footer><!-- #colophon -->

</div><!-- #page -->

<script>document.body.classList.remove("no-js");</script>	<script src="data:text/javascript;base64,aWYoLTEhPT1uYXZpZ2F0b3IudXNlckFnZW50LmluZGV4T2YoJ01TSUUnKXx8LTEhPT1uYXZpZ2F0b3IuYXBwVmVyc2lvbi5pbmRleE9mKCdUcmlkZW50LycpKXtkb2N1bWVudC5ib2R5LmNsYXNzTGlzdC5hZGQoJ2lzLUlFJyl9" defer></script>
	<script src="https://abtintheme.ir/wp-content/themes/twentytwentyone/assets/js/responsive-embeds.js?ver=2.4" id="twenty-twenty-one-responsive-embeds-script-js" defer data-deferred="1"></script>

</body>
</html>


<!-- Page cached by LiteSpeed Cache 6.5.3 on 2024-12-09 08:49:57 -->