Skip to content

Commit f4b24b9

Browse files
committed
Added support for PDF.js
1 parent febd4ca commit f4b24b9

File tree

373 files changed

+90336
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

373 files changed

+90336
-8
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ You can configure the following parameters of the viewer:
3434
* Height: sets the height of the iframe
3535
* FilePath: path to the file to be render on the HTML page
3636
* TempDirectoryPath: path for the temporary converted to PDF files (see Word, PowerPoint and Excel sections below).
37+
* PdfRenderer: is used by documents converted to PDFs (see below) and you can choose between [PDF.js](https://mozilla.github.io/pdf.js/) and [Adobe Reader](https://acrobat.adobe.com/uk/en/). Adobe Reader is used by default now, but this requires Adobe to be installed client-side. PDF.js is relying only on JavaScript, but the library is still developing. For further information check their websites.
3738
3839
### How to embed PDF documents?
3940
For PDF documents, a simple iframe is generated, so the following line is enough to embed a document:
@@ -42,15 +43,18 @@ For PDF documents, a simple iframe is generated, so the following line is enough
4243
<cc:DocumentViewer runat="server" Width="500" Height="500" FilePath="~/sample.pdf" />
4344
```
4445

46+
You can additionally set the PdfRenderer parameter if you want to use PDF.js.
47+
4548
### How to embed Word documents?
4649
Word documents are converted to PDF documents, then rendered in iframe. You should have Microsoft Office installed on the server for this to work.
4750
You can embed a Word document as shown below:
4851

4952
```html
50-
<cc:DocumentViewer runat="server" Width="500" Height="500" FilePath="sample.docx" TempDirectoryPath="~/TempFiles" />
53+
<cc:DocumentViewer runat="server" Width="500" Height="500" FilePath="sample.docx" TempDirectoryPath="~/TempFiles" PdfRenderer="PdfJs" />
5154
```
5255

5356
If TempDirectoryPath is not supplied, the converted documents can be found in the Temp directory of the project root.
57+
If PdfRenderer is not supplied, Adobe Reader is used by default.
5458

5559

5660
### How to embed PowerPoint documents?
@@ -62,6 +66,7 @@ You can embed a PowerPoint document as shown below:
6266
```
6367

6468
If TempDirectoryPath is not supplied, the converted documents can be found in the Temp directory of the project root.
69+
You can additionally set the PdfRenderer parameter if you want to use PDF.js.
6570

6671
### How to embed Excel documents?
6772
Excel documents are converted to HTML files, then rendered in iframe. You should have Microsoft Office installed on the server for this to work.
@@ -72,6 +77,7 @@ You can embed an Excel document as shown below:
7277
```
7378

7479
If TempDirectoryPath is not supplied, the converted documents can be found in the Temp directory of the project root.
80+
You can additionally set the PdfRenderer parameter if you want to use PDF.js.
7581

7682
### Do you have an issue?
7783
Have a bug or a feature request? Please search for existing and closed issues before submitting a new one. If your problem or idea is not addressed yet, please open a new issue.

WebFormsDocumentViewer.UI/Default.aspx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
<div class="card text-center">
2626
<div class="card-block">
2727
<h4 class="card-title">PDF Viewer</h4>
28-
<p class="card-text">This renders a PDF document in an iframe.</p>
29-
<cc:DocumentViewer runat="server" Width="500" Height="500" FilePath="~/Samples/sample.pdf" />
28+
<p class="card-text">This renders a PDF document in an iframe and uses
29+
<a href="https://mozilla.github.io/pdf.js/" target="_blank">PDF.js</a> as the PDF renderer
30+
instead of <a href="https://acrobat.adobe.com/uk/en/"> target="_blank"Adobe Reader</a>.</p>
31+
<cc:DocumentViewer runat="server" Width="500" Height="500" FilePath="~/Samples/sample.pdf" PdfRenderer="PdfJs" />
3032
</div>
3133
</div>
3234
</div>

0 commit comments

Comments
 (0)