Add: pdf view to submission view

This commit is contained in:
Aroy-Art 2024-12-27 21:43:19 +01:00
parent 59def7382e
commit c6be1cb778
Signed by: Aroy
GPG key ID: 583642324A1D2070

View file

@ -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">