Jump to content

Extension talk:PdfHandler

Add topic
From mediawiki.org
Latest comment: 6 days ago by Ignacio Rodríguez in topic 0x0 thumbnail problem

Adding a PDF to a page results in a text link.

[edit]

I am running MediaWiki on my personal computer via XAMPP as a private wiki. When I add, say, [[File:MediaWikiRefCard_v1-0.pdf]] to a page, all that appears is a text link to the file page.

What you may need to know

Operating system: Widows 10

Version:
MediaWiki 1.43.0
PHP 8.2.12 (apache2handler)
ICU 71.1
MariaDB 10.4.32-MariaDB
Lua 5.1.5
Pygments 2.19.1


Extension prerequisites
Both ghostscript and Xpdf have been installed and added to the system PATH.

Following is at lines 100 through 102:

$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = 'C:\Program Files (x86)\ImageMagick-7.1.1-Q16\magick.exe';

LocalSettings.php
This is lines 155 through 157:

$wgFileExtensions = array_merge(
	$wgFileExtensions, [ 'docx', 'xls', 'pdf', 'mpp', 'odt', 'ods', 'svg', 'bmp' ]
);

This is line 195:

wfLoadExtension( 'PdfHandler' );

This is lines 293 through 297:

$wgPdfProcessor = 'C:\Program Files\gs\gs10.06.0\bin\gswin64.exe';
$wgPdfPostProcessor = $wgImageMagickConvertCommand;
$wgPdfInfo = 'C:\Program Files\xpdf-tools-win-4.06\bin64\pdfinfo.exe';
$wgPdftoText = 'C:\Program Files\xpdf-tools-win-4.06\bin64\pdftotext.exe';

Am I missing something? BrigidTheIrish (talk) 16:58, 6 March 2026 (UTC)Reply

You are.
https://stackoverflow.com/a/20819109/3924641
https://stackoverflow.com/questions/14743548/php-on-windows-path-comes-up-with-backward-slash
Incnis Mrsi (talk) 16:23, 9 March 2026 (UTC)Reply
Okay, so I have to do what, exactly? Because there seems to be some disagreement on those pages regarding the proper handling of backslashes. Do I need to replace \ with \\ or \\\? Do I need to surround it with ~? BrigidTheIrish (talk) 14:21, 10 March 2026 (UTC)Reply
Tried using \\\ and it didn't work. Tried replacing all backslashes with forward slashes and it didn't work. I don't want to screw around any more with LocalSettings.php for fear of breaking something. BrigidTheIrish (talk) 14:34, 10 March 2026 (UTC)Reply

0x0 thumbnail problem

[edit]

I'm trying to install a local MediaWiki with ProofreadPage for development. I'm suffering from the infamous 0x0 thumbnail problem. This is a completely new install. I have managed to upload a local PDF file, did the maintenance scripts and purged the file page, but it still fails to render the thumbnails. Ignacio Rodríguez (talk) 15:58, 10 July 2026 (UTC)Reply

I managed to get thumbnails for my local MediaWiki environment, with the help of an LLM scanning the logs. I don't understand this much but this are the steps I think were necessary to solve all errors. For clarification, this is a fresh php and mediawiki install on Windows 11:
  1. The log showed that despite modifying my LocalSettings.php, the system kept defaulting to hardcoded Linux paths (/bin/sh and /usr/bin/convert), so I had to create symlinks to the actual paths
  2. I downgraded ghostscript to version 9.56.1
  3. I modified the settings repeatedly until the machine found this configuration that was usable:
wfLoadExtension( 'PdfHandler' );
$wgPdfProcessor = 'C:\Program Files\gs\gs9.56.1\bin\gswin64c.exe';
$wgPdfPostProcessor = 'C:\Program Files\ImageMagick-7.1.2-Q16-HDRI\magick.exe';
$wgPdfInfo = 'C:\ProgramData\chocolatey\bin\pdfinfo.exe';
$wgPdfText = 'C:\ProgramData\chocolatey\bin\pdftotext.exe';
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = 'C:\Program Files\ImageMagick-7.1.2-Q16-HDRI\magick.exe';
$wgConvertCommand = 'C:\Program Files\ImageMagick-7.1.2-Q16-HDRI\magick.exe';
I dont know what of this is really needed. Ignacio Rodríguez (talk) 17:30, 10 July 2026 (UTC)Reply