Modify

Opened 3 years ago

Last modified 3 years ago

#14001 new defect

PdfPreviewPlugin: not able to preview pdf file as expected

Reported by: peter.chiu@… Owned by: tkob-trac
Priority: normal Component: PdfPreviewPlugin
Severity: normal Keywords: pdfviewer
Cc: peter.chiu@… Trac Release: 1.0

Description (last modified by Ryan J Ollos)

Having followed the instructions given, we have not been able to display any pdf files from trac. No particular errors are recorded in trac.log. The steps taken are described below. Any advice please?

Server: Centos 7 Trac-1.0.13-1

  1. Install plugin:
    [root@dev5 sites-available]# pip install https://trac-hacks.org/browser/pdfpreviewplugin/1.0?format=zip
    Collecting https://trac-hacks.org/browser/pdfpreviewplugin/1.0?format=zip
      Downloading https://trac-hacks.org/browser/pdfpreviewplugin/1.0?format=zip
         - 8.3MB 15.9MB/s
      Requirement already satisfied (use --upgrade to upgrade): TracPdfPreview==0.1.2 from https://trac-hacks.org/browser/pdfpreviewplugin/1.0?format=zip in /usr/lib/python2.7/site-packages
    You are using pip version 8.1.2, however version 21.0.1 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
    
  1. Check plugin
    [root@dev5 sites-available]# find /usr/lib/python2.7/site-packages/ -name "*pdfpreview*"
    /usr/lib/python2.7/site-packages/tracpdfpreview
    /usr/lib/python2.7/site-packages/tracpdfpreview/pdfpreview.py
    /usr/lib/python2.7/site-packages/tracpdfpreview/pdfpreview.pyc
    
  1. Modify trac.ini:
    [root@dev5 sites-available]# egrep "component|preview|mimeview|mime_map" /var/trac/jsocwiki/conf/trac.ini
    
    [components]
    tracpdfpreview.pdfpreview.* = enabled
    
    [mimeviewer]
    max_preview_size = 262144
    mime_map = text/x-dylan:dylan,text/x-idl:ice,text/xada:ads:adb,application/pdf
    #mime_map = text/x-dylan:dylan, text/x-idl:ice, text/x-ada:ads:adb
    mime_map_patterns = text/plain:README|INSTALL|COPYING.*
    default_component =
    auto_preview_timeout = 2.0
    
  1. Deploy trac changes:
    [root@dev5 log]# trac-admin /var/trac/jsocwiki deploy /var/www/html/trac/jsocwiki
    Copying resources from:
      trac.web.chrome.Chrome
        /usr/lib/python2.7/site-packages/trac/htdocs
        /var/trac/jsocwiki/htdocs
      acct_mgr.notification.AccountChangeNotificationAdminPanel
        /usr/lib/python2.7/site-packages/acct_mgr/htdocs
      acct_mgr.register.RegistrationModule
    ...
      acct_mgr.admin.ConfigurationAdminPanel
        /usr/lib/python2.7/site-packages/acct_mgr/htdocs
      acct_mgr.macros.AccountManagerWikiMacros
        /usr/lib/python2.7/site-packages/acct_mgr/htdocs
      tracpdfpreview.pdfpreview.PdfRenderer
        /usr/lib/python2.7/site-packages/tracpdfpreview/htdocs
    Creating scripts.
    
  1. Attempt to Display:

http://dev5.spice.rl.ac.uk/attachment/wiki/WikiStart/bryant_msp4500_Tail_2021.pdf

  1. Result:
    HTML preview not available, since no preview renderer could handle it. Try downloading the file instead.
    
  1. No relevant errors reported in trac.log
    2021-04-14 16:27:11,786 Trac[env] WARNING: base_url option not set in configuration, generated links may be incorrect
    2021-04-14 16:27:11,788 Trac[web_ui] WARNING: ResetPwStore is disabled, therefore password reset won't work.
    2021-04-14 16:27:11,810 Trac[api] WARNING: Unable to find repository '(default)' for synchronization
    2021-04-14 18:06:11,162 Trac[env] INFO: -------------------------------- environment startup [Trac 1.0.13] --------------------------------
    2021-04-14 18:06:11,322 Trac[web_ui] WARNING: ResetPwStore is disabled, therefore password reset won't work.
    

Attachments (3)

trac.ini (6.4 KB) - added by anonymous 3 years ago.
Trac-PDF-View.jpg (196.1 KB) - added by anonymous 3 years ago.
trac.log (442.1 KB) - added by anonymous 3 years ago.

Download all attachments as: .zip

Change History (12)

Changed 3 years ago by anonymous

Attachment: trac.ini added

comment:1 Changed 3 years ago by Ryan J Ollos

Description: modified (diff)

comment:2 Changed 3 years ago by Ryan J Ollos

It works for me in a development environment with Trac 1.0-stable. Could you confirm that the plugin is loading at debug level and also check the browser console for errors?: TracTroubleshooting#ChecktheLogs.

Last edited 3 years ago by Ryan J Ollos (previous) (diff)

comment:3 Changed 3 years ago by Ryan J Ollos

Description: modified (diff)

comment:4 Changed 3 years ago by peter.chiu@…

Thanks for your speedy response.

With DEBUGging turned on, the trac.log is revealing that trapdfpreview is loaded, but it flags the user account has no policy to perform ACCTMGR_USER_ADMIN, and a number of no policy allowed errors.

Looks like another search to find out that they mean...

=============================================================================== 2021-04-14 20:24:10,453 Trac[loader] DEBUG: Loading tracpdfpreview from /usr/lib/python2.7/site-packages 2021-04-14 20:24:10,507 Trac[env] WARNING: base_url option not set in configuration, generated links may be incorrect 2021-04-14 20:24:10,507 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/chrome/pdfpreview/web/images/secondaryToolbarButton-lastPage.png'"> 2021-04-14 20:24:10,508 Trac[web_ui] WARNING: ResetPwStore is disabled, therefore password reset won't work. 2021-04-14 20:24:10,512 Trac[session] DEBUG: Retrieving session for ID u'pcmc' 2021-04-14 20:24:10,520 Trac[perm] DEBUG: No policy allowed pcmc performing ACCTMGR_USER_ADMIN on None

2021-04-14 20:24:10,143 Trac[chrome] DEBUG: Prepare chrome data for request 2021-04-14 20:24:10,144 Trac[perm] DEBUG: No policy allowed pcmc performing ACCTMGR_CONFIG_ADMIN on None 2021-04-14 20:24:10,144 Trac[perm] DEBUG: No policy allowed pcmc performing TRAC_ADMIN on <Resource u'admin:general/basics'> 2021-04-14 20:24:10,144 Trac[perm] DEBUG: No policy allowed pcmc performing TRAC_ADMIN on <Resource u'admin:general/logging'> 2021-04-14 20:24:10,144 Trac[perm] DEBUG: No policy allowed pcmc performing PERMISSION_GRANT on <Resource u'admin:general/perm'> 2021-04-14 20:24:10,144 Trac[perm] DEBUG: No policy allowed pcmc performing PERMISSION_REVOKE on <Resource u'admin:general/perm'> 2021-04-14 20:24:10,144 Trac[perm] DEBUG: No policy allowed pcmc performing TRAC_ADMIN on <Resource u'admin:general/plugin'> 2021-04-14 20:24:10,144 Trac[perm] DEBUG: No policy allowed pcmc performing VERSIONCONTROL_ADMIN on <Resource u'admin:versioncontrol/repository'> 2021-04-14 20:24:10,146 Trac[perm] DEBUG: No policy allowed pcmc performing EMAIL_VIEW on None

Version 0, edited 3 years ago by peter.chiu@… (next)

comment:5 in reply to:  4 Changed 3 years ago by Ryan J Ollos

Replying to peter.chiu@…:

With DEBUGging turned on, the trac.log is revealing that trapdfpreview is loaded, but it flags the user account has no policy to perform ACCTMGR_USER_ADMIN, and a number of no policy allowed errors.

Those are normal, it just means the permission policy rejected by default due to lack of explicitly granted permission.

comment:6 Changed 3 years ago by Ryan J Ollos

Make sure to do a hard refresh of the browser when viewing the /attachment/wiki/WikiStart/bryant_msp4500_Tail_2021.pdf:

Note: Some web browsers (IE, Opera) cache CSS and JavaScript files, so you should instruct your users to manually erase the contents of their browser's cache. A forced refreshed (SHIFT + <F5>) should be sufficient.

Changed 3 years ago by anonymous

Attachment: Trac-PDF-View.jpg added

comment:7 Changed 3 years ago by anonymous

Morning Ryan,

Thanks for your further reply last night.

I have tried the force clear on the cache with Shift-F5 and then I get a grey screen but no content.

If I then click the original format button, the pdf file is displayed.

Is that the expected procedure to display the pdf file?

Anyway, it is a good progress from before, and thanks for your help.

Peter

comment:8 in reply to:  7 Changed 3 years ago by Ryan J Ollos

Replying to anonymous:

I have tried the force clear on the cache with Shift-F5 and then I get a grey screen but no content.

That is strange, the content should display in that case.

If I then click the original format button, the pdf file is displayed.

In Firefox the "original format" link prompts for downloading the file. Which browser are you using?

Changed 3 years ago by anonymous

Attachment: trac.log added

comment:9 Changed 3 years ago by anonymous

Morning,

Looks like the issue is not resolved.

I have been using IE for Windows 10, Opera and Firefox, each with cache clear.

I have attached another screen dump, and trac.log. Actually, just trac.log, the image exceeds 1M.

I fail to spot any clue from the log, wonder if you can.

Thanks again.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain tkob-trac.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.