Extension talk:PdfHandler

Jump to navigation Jump to search

About this board

PdfHandler Talk Archive


PdfHandler with ApprovedRevs

2
213.115.193.20 (talkcontribs)

Hello,

Im using approvedRevs to approve stuff on our wiki. So if I link to a file on a page it will display the latest approved version of it.

If I link to a pdf with PdfHander it will always displays the latest version.

Anyone using approvedRevs and managed to get PdfHandler only to display the latest approved version?


Thanks

Jonathan3 (talkcontribs)
Reply to "PdfHandler with ApprovedRevs"

There are a few PDF files for which no thumbnail is created

1
Jonathan3 (talkcontribs)

Is there anything to watch out for here? Anything I can change? The files which aren't working show as 0 x 0 pixels. Thanks.

Reply to "There are a few PDF files for which no thumbnail is created"

How to create thumbnails of all existing PDF files?

1
Jonathan3 (talkcontribs)

I've finally managed to get this great extension to work. But when I look at Special:NewFiles or a PDF's File: page, it still shows the generic PDF logo until I purge the File: page.

Is there any way of purging all the File: pages and creating thumbnails for them all, all at once? Thanks.

Reply to "How to create thumbnails of all existing PDF files?"
TelePointHistory (talkcontribs)

I am trying to use PdfHandler to show thumbnails but know I don't have the pre-requisites.

Running the command in SSH: which gs convert pdfinfo pdftotext

shows that I have ghostscript but no packages for xpdf-utils

/bin/gs

/bin/convert

/usr/bin/which: no pdfinfo etc

/usr/bin/which: no pdftotext etc


Looking at this page https://www.xpdfreader.com/download.html I don't know what file to download or where to put it once it's downloaded. I am on Siteground hosting with WM 1.35.3 if that makes a difference. I'm hoping someone can give me a basic rundown for how it's meant to work. thanks.

Kghbln (talkcontribs)

Siteground has to install this for you on the server I guess. Best way is to contact their support.

Reply to "Installing xpdf-utils"

PDFs won't display, MW shows security warning error

5
Woozle (talkcontribs)

I had this extension installed and working on two wikis. After upgrading each at different times (to 1.31.7 and 1.32), I later noticed that it is no longer rendering them on File: pages or anywhere else, and the File: pages now show a pop-up security warning (when you hover over the "application/pdf" text) which links to Special:MyLanguage/Help:Security/PDF_files -- but that page has no information about suppressing the warning.

I'm thinking that whatever is triggering the warning is preventing the extension from rendering the files, but I haven't been able to find any information about how to change that.

Does anyone have any information about this?

Thanks.

Dinoguy1000 (talkcontribs)

The first thing to do is to make sure your extensions are up to date as well.

The warning is about generic issues with the PDF format as a whole and has nothing to do with the configuration details of any individual website. It also shouldn't prevent the preview from displaying (see for example commons:File:JUA0680291.pdf, where both a preview of the PDF and the warning popup are visible). You should be able to hide the warning via CSS, though I've never done this myself so I can't advise on what classes or IDs you need to use. Unfortunately I can't provide any help with why the previews aren't displaying for you; I've had the same issue on a wiki of mine for a while.

Woozle (talkcontribs)

Another extension does seem to have been causing the issue in at least one wiki, though it's not clear how the two were interfering with each other. Still investigating -- but PDFs on that wiki seem to be rendering properly now.

Dinoguy1000 (talkcontribs)

Which extension?

Woozle (talkcontribs)

I think it was one of mine, not one that MW distributes.

Reply to "PDFs won't display, MW shows security warning error"
Heinebold (talkcontribs)

The srcset is broken when on a locale that formats numbers differently.

The "1.5x" is generated using the current locale instead of ensuring that it is in a format that the browser understands.

On a locale that uses the decimal comma, that results in a broken image for unzoomed view, since the browser doesnt get image1 1.5x, image2 2x, but image1 1,5x, image2 2x , which means the three "images" image1 1, 5x, and image2.

I think you shouldn't rely on the locale to format numbers that have to follow source code syntax.

Dinoguy1000 (talkcontribs)

Would you mind filing a task for this on Phabricator? It is more likely to get developer attention there.

Reply to "Locale breaks images"
Huwmanbeing (talkcontribs)

I run MediaWiki 1.33 on Ubuntu with the latest version of PdfHandler, but thumbnails aren't being shown for PDFs. There's no obvious error being generated, the thumbnail images just don't appear. (Embedding a link like [[File:Sample.pdf|page=1|thumb|Test]] produces only the text link with no image, and the file page itself shows only the generic PDF file type icon.)

I've verified I have all the necessary prerequisites:

  • /usr/bin/gs
  • /usr/bin/convert
  • /usr/bin/pdfinfo
  • /usr/bin/pdftotext

I've run the recommended maintenance scripts, but still no luck. I've also made sure it's appropriately configured in my LocalSettings.php — the settings are present and identical to the default settings. Does anyone have any ideas/suggestions as to what might be causing thumbnails not to appear? Any assistance would be much appreciated! Huwmanbeing (talk) 14:33, 7 September 2019 (UTC)

This post was hidden by Heinebold (history)
Huwmanbeing (talkcontribs)

Thanks very much for the suggestions — unfortunately no luck. No thumbnails in links, and the file page still just shows the PDF icon and the 0 x 0 size.

I seem to have hit a wall here: everything's apparently set correctly as far as I can tell, and there are no obvious errors, but it just doesn't work. Could anyone suggest ways to debug this?

Kghbln (talkcontribs)

Try this:

  1. Have a look if you have a "temp" directory at path/to/images/temp
  2. If not create this directory: mkdir path/to/images/temp
  3. Make it writable for the webserver chown www-data:www-data path/to/images/temp
  4. Run php path/to/maintenance/refreshImageMetadata.php -f
  5. Run php path/to/maintenance/rebuildImages.php
Huwmanbeing (talkcontribs)

I've confirmed that "images/temp" is present and chown-ed properly to www-data, and have run the maintenance scripts, but unfortunately still no luck.

I'm curious, though — what should one normally see when running rebuildImages.php? Here's what it's showing me:

Processing image... [...] Finished image... 0 of 852 rows updated Processing oldimage... Finished oldimage... 0 of 13 rows updated

Is the fact that it's reporting no rows updated in any way significant?

Kghbln (talkcontribs)

0 just means that there was nothing to update. The more interesting script is the one of point 4. If this ran without throwing errors you should be fine, i.e. no longer pdf files with 0 x 0 size. Cannot tell why it is not working for you now. :( I guess I am really out of ideas now. The permissions of "temp" are ok with 755?

Huwmanbeing (talkcontribs)

A breakthrough — I decided to start disabling all installed extensions just to see if there might be something there that's interfering, and I found that turning off TimedMediaHandler allows PDFs to be displayed and thumbnailed correctly. Now when refreshImageMetadata runs it does so successfully (well, mostly — it gives some warnings about some metadata inconsistencies in some of my .ogg files). I'll investigate further and see if I can find out more specifically what's happening, but at least it's working now.

Huwmanbeing (talkcontribs)

Here's the fault:

PHP Notice: Undefined offset: 0 in [...]/includes/libs/mime/MimeAnalyzer.php on line 811
[5cd1086a420507df361326be] [no req]   Error from line 15 of [...]/extensions/TimedMediaHandler/includes/handlers/ID3Handler/ID3Handler.php: Class 'getID3' not found
Backtrace:
#0 [...]/extensions/TimedMediaHandler/includes/handlers/ID3Handler/ID3Handler.php(51): ID3Handler->getID3(string)
#1 [...]/includes/utils/MWFileProps.php(84): ID3Handler->getMetadata(FSFile, string)
#2 [...]/includes/filerepo/FileRepo.php(1560): MWFileProps->getPropsFromPath(string, string)
#3 [...]/includes/filerepo/file/LocalFile.php(402): FileRepo->getFileProps(string)
#4 [...]/includes/filerepo/file/LocalFile.php(710): LocalFile->loadFromFile()
#5 [...]/maintenance/refreshImageMetadata.php(173): LocalFile->upgradeRow()
#6 [...]/maintenance/doMaintenance.php(96): RefreshImageMetadata->execute()
#7 [...]/maintenance/refreshImageMetadata.php(264): require_once(string)
#8 {main}
Kghbln (talkcontribs)

Oh, that's interesting. Good find. Are you also on REL1_33 for TimedMediaHandler? If yes, this is a bug which should be reported on Phabricator for TimedMediaHandler.

Huwmanbeing (talkcontribs)

Yep, my version of TimedMediaHandler is indeed the latest — REL1_33.

Looks like there's already a thread about it here and that other users have experienced something similar. It sounds like those (like me) who download the TimedMediaHandler extension as a file via the ExtensionDistributor will miss out on certain necessary dependencies, and that instead one must install it through composer. I'm afraid I'm not familiar with Phabricator, but if the problem hasn't already been raised there then it seems like it should be.

Thank you again for your help!

Reply to "Thumbnails not appearing"

Error creating thumbnail: /bin/bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)

4
Jonathan3 (talkcontribs)

When I enable this extension and set the four path config variables, I get the message above. It appears several times on the File: pages. I'll look into it myself, but wonder if anyone can help put me on the right track. Thanks. ~~~~

Jonathan3 (talkcontribs)

It appears for every PDF file in Special:NewFiles - no problem with .txt and .gif files.

Additionally, two files have the following error: "**** Warning: Short look-up table in the Indexed color space was padded with 0's. **** Warning: Short look-up table in the Indexed color space was padded with 0's. **** This file had errors that were repaired or ignored. **** The file was produced by: **** >>>> Acrobat Distiller 9.3.3 (Windows) <<<< **** Please notify the author of the software that produced this **** file that it does not conform to Adobe's published PDF **** specification."

Jonathan3 (talkcontribs)

I've just upgraded to MW 1.34.1 and am having the same problem. Does anyone have any ideas? Thanks!

Jonathan3 (talkcontribs)
Reply to "Error creating thumbnail: /bin/bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)"

Problem with wgRestrictDisplayTitle set to false

2
T0lk (talkcontribs)

I ran into a strange problem on one of my wiki's which was url/index.php?title=File:SOMEFILE.pdf&page=0 failed to load the pdf page image. All other page images work correctly, and page=0 is only accessible by clicking the thumbnail on &page=2 (if you click "Previous page" it takes you to &page=1 while for some reason clicking the thumbnail takes you to &page=0). Anyway, this problem was caused by setting wgRestrictDisplayTitle to false. Caution, if you set this value to false you will see the problem, but seems to have made the problem permanent, setting it back to true doesn't return the expected behavior.

Has anyone run into this, or found a solution?

T0lk (talkcontribs)
Reply to "Problem with wgRestrictDisplayTitle set to false"

When updating PDF, thumbnails not being regenerated

2
213.61.254.67 (talkcontribs)

When I upload a new PDF-Version, the generated thumbnails from "Version 1" always shown. The Version 2 thumbnails are not being created.

Tosfos (talkcontribs)

We had this same issue and tracked it to Semantic MediaWiki. If you have it installed, you can test this by disabling enableSemantics(). Tested with SMW version 2.5.8. See also the likely related topic here.

Reply to "When updating PDF, thumbnails not being regenerated"