Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pdf/static/js/pdf_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,14 @@ function pdfXBlockInitView(runtime, element) {
var handlerUrl = runtime.handlerUrl(element, 'on_download');
$.post(handlerUrl, '{}');
});

/*
* <object> tag shows only first page in iPad, iPhone and iPod
* 'View PDF' option will appear in these devices to view pdf in new tab */

let isRetinaDevice = /iPad|iPhone|iPod/.test(navigator.userAgent);
if (isRetinaDevice) {
$('.pdf-view-button').show();
}
});
}
3 changes: 3 additions & 0 deletions pdf/templates/html/pdf_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ <h2>{% trans display_name %} </h2>
{% if allow_download or source_url != "" %}
<ul>
{% if allow_download %}
<li class="pdf-view-button" style="display: none;">
<a href="{{ url }}" target="_blank">{% trans "View PDF" %}</a>
</li>
<li class="pdf-download-button">
<a href="{{ url }}" download>{% trans "Download the PDF" %}</a>
</li>
Expand Down