Skip to content

Commit f01d01c

Browse files
authored
Create README.md
1 parent 4ee62fa commit f01d01c

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
### What is WebFormsDocumentViewer?
2+
WebFormsDocumentViewer is a simple custom control that lets you embed documents (PDF and Word) in your ASP.NET WebForms pages.
3+
4+
### How do I get started?
5+
First, add a reference in your web.config to the WebFormsDocumentViewer assembly:
6+
7+
```xml
8+
<system.web>
9+
<pages>
10+
<controls>
11+
<add assembly="WebFormsDocumentViewer" namespace="WebFormsDocumentViewer" tagPrefix="cc" />
12+
</controls>
13+
</pages>
14+
</system.web>
15+
<system.webServer>
16+
```
17+
18+
Or on your web page:
19+
20+
```csharp
21+
<%@ Register Assembly="WebFormsDocumentViewer" Namespace="WebFormsDocumentViewer" TagPrefix="cc" %>
22+
```
23+
24+
### How to use it?
25+
You can configure the following parameters of the viewer:
26+
* Width: sets the width of the iframe
27+
* Height: sets the height of the iframe
28+
* FilePath: path to the file to be render on the HTML page
29+
* TempDirectoryPath: path for the temporary converted to PDF files (see Word section below).
30+
31+
### How to embed PDF documents?
32+
For PDF documents, a simple iframe is generated, so the following line is enough to embed a document:
33+
34+
```html
35+
<cc:DocumentViewer runat="server" Width="500" Height="500" FilePath="~/sample.pdf" />
36+
```
37+
38+
### How to embed Word documents?
39+
Word documents are converted to PDF documents, then rendered in iframe. You should have Microsoft Office installed on the server for this to work.
40+
You can embed a Word document as shown below:
41+
42+
```html
43+
<cc:DocumentViewer runat="server" Width="500" Height="500" FilePath="sample.docx" TempDirectoryPath="~/TempFiles" />
44+
```
45+
46+
If TempDirectoryPath is not supplied, the converted documents can be found in the Temp directory of the project root.
47+
48+
### Do you have an issue?
49+
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.

0 commit comments

Comments
 (0)