Add: pdf view to submission view
This commit is contained in:
parent
59def7382e
commit
c6be1cb778
1 changed files with 11 additions and 0 deletions
|
@ -48,8 +48,19 @@
|
|||
alt="{{ submission.content_object.title }}"/>
|
||||
|
||||
|
||||
{% elif submission.content_object.files.first.file_mime|is_pdf %}
|
||||
<!-- Embed the full PDF.js viewer here -->
|
||||
<iframe id="pdf-js-viewer"
|
||||
src="{% static 'libs/pdfjs-4.7.76-dist/web/viewer.html' %}?file={% url 'files:serve_content_file' 'submission' submission.content_object.files.first.file_hash %}"
|
||||
width="100%" height="100%"
|
||||
class="border-0 m-auto flex-grow-1 p-0">
|
||||
</iframe>
|
||||
|
||||
<!-- Scripts required for PDF.js -->
|
||||
<script src="{% static 'libs/pdfjs-4.7.76-dist/build/pdf.js' %}"></script>
|
||||
<script src="{% static 'libs/pdfjs-4.7.76-dist/web/viewer.js' %}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div class="m-auto center-block bg-body-secondary p-4 rounded-2 border border-3">
|
||||
|
|
Loading…
Reference in a new issue