I'm in need of a few features that are supported in PDF.js but require custom viewer files to work. This patch adds a config form under "Media" that allows the user to specify a path to a custom viewer.html file. If the setting is empty, the default library viewer is used.

This is really just a first attempt. It probably needs a little more help text and some sort of check to make sure the file actually exists, falling back to the default if it doesn't.

Comments

wrd created an issue. See original summary.

wrd’s picture

StatusFileSize
new4.21 KB
  • Change config object name from pdf.config to pdf.settings like other modules
  • Add some help text and a placeholder to the config form
wrd’s picture

StatusFileSize
new4.31 KB

Rerolling patch against current 8.x-1.x branch.

wrd’s picture

StatusFileSize
new4.56 KB

That patch didn't work at all. Trying again...

wrd’s picture

OK, that version (#4) is working for me, in D9 as well as D8.

shenzhuxi’s picture

I got errors with patch #4...

warning: src/Plugin/Field/FieldFormatter/PdfDefault.php has type 100755, expected 100644
error: patch failed: src/Plugin/Field/FieldFormatter/PdfDefault.php:32
error: src/Plugin/Field/FieldFormatter/PdfDefault.php: patch does not apply

wrd’s picture

Probably due to changes in the new release. I'll try to reconstruct the patch against version 1.0.

wrd’s picture

StatusFileSize
new4.86 KB

Rerolled against 8.x-1.x-dev, applies to 1.0.

  • shenzhuxi committed 1e33fbf on 8.x-1.x authored by wrd
    Issue #3076198 by wrd: Allow users to specify a custom viewer.html file
    
shenzhuxi’s picture

Assigned: Unassigned » shenzhuxi
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

thomasmurphy’s picture

What permission are required to access this config? It looks like it's "access administration pages" which seems to be far too broad.

mehul.shah’s picture

Can we do this for D7?