embed-pdf-view.html 700 字节
Newer Older
Y
yyexplore 已提交
1 2 3 4 5
<script type="text/javascript" src="/js/pdf-js/build/pdf.js"></script>

<div id="embed-pdf-view">
</div>

Y
yyexplore 已提交
6 7 8 9 10 11 12 13 14 15 16
{{ $url :=  .Get "url" }}
{{ $base_url := .Site.BaseURL | urls.Parse}}
{{ $base_path := $base_url.Path}}
{{ $url_pdf := path.Join $base_path $url}}

<!--
<p> url_is: {{ $url }} </p>
<p> baseurl_is: {{.Site.BaseURL}} </p>
<p> basepath_is: {{ $base_path  }} </p>
<p> url_pdf_is: {{ $url_pdf }} </p>
-->
Y
yyexplore 已提交
17 18 19 20 21

<script type="text/javascript">
  window.onload = function() {

  var pdf_div = document.getElementById('embed-pdf-view');
M
update  
miykael 已提交
22
  pdf_div.innerHTML = '<iframe src="js/pdf-js/web/viewer.html?file={{$url_pdf}}" width="100%" with="800px" style="border: none;min-height:75vh;" />' ;
Y
yyexplore 已提交
23 24 25 26
  
  };

</script>