File size: 3,456 Bytes
d6b8d19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Original Latex master thesis

The original master thesis which was submitted can be seen and downloaded below.

<!-- <iframe src="https://nbviewer.org/github/jav-ed/Test_1/raw/master/Javed_Butt_Missioninformer.pdf" width="100%" height="97%"></iframe> -->

<!-- download link: https://github.com/jav-ed/Test_1/raw/master/Javed_Butt_Missioninformer.pdf -->

<!-- Does not work
<iframe src="https://mozilla.github.io/pdf.js/web/viewer.html?file=https://github.com/jav-ed/Test_1/raw/master/Javed_Butt_Missioninformer.pdf#page=3&zoom=50&scrollbar=0&toolbar=0" width="100%" height="97%"></iframe> -->

<!-- embeed does not work
<embed src="https://github.com/jav-ed/Test_1/raw/master/Javed_Butt_Missioninformer.pdf" 
type="application/pdf"
 width="100%" height="600px"> -->

<!-- google docs, does not look really good -->
<!-- <iframe 
src="https://docs.google.com/gview?embedded=true&url=https://github.com/jav-ed/Test_1/raw/master/Javed_Butt_Missioninformer.pdf" 
width="100%"
height="97%" >
</iframe> -->

<!-- works using nbviewer nice. It does not store any data, rather is gets the data from provided url and then does some rendering work on its won server (no server required from users side):
https://nbviewer.org/, looks impressively good7
https://nbviewer.org/faq#how-can-i-remove-a-notebook-from-nbviewer

-->
<!-- <iframe src="https://nbviewer.org/github/jav-ed/Test_1/raw/master/Javed_Butt_Missioninformer.pdf" width="100%" 
height="91%"></iframe> -->
<!-- 
<iframe src="https://nbviewer.org/github/jav-ed/Test_1/raw/master/Javed_Butt_Missioninformer.pdf" width="100%" 
height="91%"></iframe>
 -->

<!-- using hugging face does work when combined with google docs
Note, the perfoamnce of google docs is not satisfying - the pdf doucments looks blurred
download link: 
https://huggingface.co/spaces/JavedA/Test/resolve/main/Javed_Butt_Missioninformer.pdf

https://huggingface.co/spaces/JavedA/Test/blob/main/Javed_Butt_Missioninformer.pdf

raw will give you a git large file remark  -> not suited to download or embeed pdf or any other binary files -> use resolve instead of blob or raw 
https://huggingface.co/spaces/JavedA/Test/raw/main/Javed_Butt_Missioninformer.pdf
 -->

<!-- <iframe src="https://docs.google.com/gview?embedded=true&url=https://huggingface.co/spaces/JavedA/Test/resolve/main/Javed_Butt_Missioninformer.pdf"
height="91%"
width="100%"
></iframe> -->


Finally, what worked was:

Define a iframe and some of its styling
<style>
    #pdf_Iframe {
      width: 100%;
      height: 91%;
      border: 1px solid #ccc;
    }
</style>

  <iframe id="pdf_Iframe"></iframe>
  <script>

    // DOMContentLoaded is an event in JavaScript that fires when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading.
    document.addEventListener('DOMContentLoaded', function() {
      // Code to be executed after the DOM has been loaded
      openPdf();
    });

    // use resolve for pdf, not raw and not blob
    const url = 'https://huggingface.co/spaces/JavedA/Test/resolve/main/Javed_Butt_Missioninformer.pdf';

    // download the pdf using the url provided above
    function openPdf() {
      fetch(url)
        .then(response => response.blob())
        .then(blob => {
          const blobUrl = URL.createObjectURL(blob);

          const iframe = document.getElementById('pdf_Iframe');
          iframe.src = blobUrl;

        });
    }
  </script>