Document Viewer for pdf and txt files
In this article we are going to use document viewer to view .pdf/.txt files in the browser. Many applications required to show some documents to the user or user would like to see some documents uploaded by them.

The document viewer which has been used in this code is open-source and is available for download in Git. You can download ViewerJS from this site.

Now let us see an example of ViewerJS.

Once ViewerJS has been downloaded, Include that inside the project.

DocumentViewer.html

<html>
    <head>
        <title>Document Viewer</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        Lets view the Text File: <a href="ViewerJS/Myfile.txt">Text Document</a><br><br>
         Lets view the PDF File: <a href="ViewerJS/myfile.pdf">PDF Document</a>
    </body>
</html>

Note: Please make sure .txt/.pdf files are stored inside ViewerJS folder

screen1

We are going to use document viewer to display MyFile.txt and myfile.pdf in the browser using ViewerJS document viewer
op1
op2 op3

 

By Sri

Leave a Reply

Your email address will not be published. Required fields are marked *