Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable18] Prevent download, printing and text selection when download is hidden #181

Merged
merged 5 commits into from
May 22, 2020

Conversation

backportbot-nextcloud[bot]
Copy link

backport of #179

danxuliu added 5 commits May 15, 2020 12:23
Even if the Download buttons are hidden in the toolbars it was still
possible to trigger the download by using Ctrl|Meta+S. This directly
calls the "PDFViewerApplication.download" function, so when downloads
are hidden that function is now replaced with an empty function.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Even if the Print button was hidden in the toolbar it was still possible
to trigger the printing by using Ctrl|Meta+P. This uses the print
service from PDFViewer, so when the download is hidden the print service
is now disabled.

When printing is flagged as not supported in the PDFViewerApplication
initialization the Print buttons are disabled, so it is no longer needed
to disable them explicity. Moreover, this also fixes the Print button
being disabled only in the toolbar, but not in the secondary toolbar
(which is shown in smaller screens).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The Download button is hidden in both the toolbar and the secondary
toolbar later, so it is not needed to hide it only for the toolbar
first.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Even if printing was not possible using the PDFViewer printing services
it was still possible to print the PDF document by printing the web page
from the browser. As that can not be really prevented the best that can
be done is hide all the content in the printed media using CSS.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When the PDF is rendered PDFViewer creates canvases with the contents of
the pages and, in front of them, it creates too a layer with HTML text
elements that makes possible to select it. That text layer is used too
by the search function to highlight the results, so it can not be
removed. Instead of that the selection of the text is prevented using
CSS.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Copy link
Member

@danxuliu danxuliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works 👍

@rullzer rullzer mentioned this pull request May 21, 2020
5 tasks
@rullzer rullzer merged commit 5c6dde5 into stable18 May 22, 2020
@rullzer rullzer deleted the backport/179/stable18 branch May 22, 2020 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants