Manual:How to use DjVu with MediaWiki/pl
From Linux Web Expert
- DjVu redirects here. This page explains how MediaWiki could work with DjVu. For help page on how to create a DjVu file from a PDF, see Creating a DjVu file.
How that works?
- Podręcznik:$wgDjvuDump — Path of the djvudump executable.
- Podręcznik:$wgDjvuOutputExtension — File extension for the DJVU post processor output.
- Podręcznik:$wgDjvuPostProcessor — Path of the DJVU post processor.
- Podręcznik:$wgDjvuRenderer — Path of the ddjvu DJVU renderer.
- Podręcznik:$wgDjvuToXML — Path of the djvutoxml executable.
- Podręcznik:$wgDjvuTxt — Path of the djvutxt executable.
How to install on GNU/Linux
For MediaWiki-Docker , run the following command to install all the necessary packages.
docker compose exec -u 0 mediawiki bash -c 'apt update && apt install djvulibre-bin netpbm'
- Install DjVuLibre:
- − Download the DjVuLibre package (which includes "djvudump" and "ddjvu" files). And, in the path:
./configure make make install
- − Or use aptitude or Synaptic in Debian derivatives (package djvulibre-bin)
- − Download the DjVuLibre package (which includes "djvudump" and "ddjvu" files). And, in the path:
- Install netpbm and netpbm-progs packages (use aptitude or Synaptic in Debian derivatives)
- Finally, add (or modify) the code lines below in the LocalSettings.php file (not in the DefaultSettings.php):
$wgFileExtensions[] = 'djvu'; $wgDjvuDump = "djvudump"; $wgDjvuRenderer = "ddjvu"; $wgDjvuTxt = "djvutxt"; $wgDjvuPostProcessor = "pnmtojpeg"; $wgDjvuOutputExtension = 'jpg';
- For better thumbnails quality:
$wgDjvuPostProcessor = "ppmtojpeg -quality=100";
- Can also use png thumbnails with:
$wgDjvuPostProcessor = "pnmtopng";
$wgDjvuOutputExtension = 'png';
How to install on Win32
- Download the DjVuLibre software (which includes "djvudump.exe" and "ddjvu.exe" files).
- Install in
C:\DjVuLibre
(for example). - Download the NetPbm complete package (which includes "pnmtojpeg.exe", "pnmtopng.exe", ... files).
- Install in "C:\GnuWin32\NetPbm"
- Add
C:\GnuWin32\NetPbm\bin
to the WindowsPATH
Environment Variable (and reboot the computer). - Finally, add (or modify) the code lines below in the LocalSettings.php file (not in the DefaultSettings.php):
$wgFileExtensions[] = 'djvu';
$wgDjvuDump = 'C:/DjVuLibre/djvudump.exe';
$wgDjvuRenderer = 'C:/DjVuLibre/ddjvu.exe';
$wgDjvuTxt = 'C:/DjVuLibre/djvutxt.exe';
#$wgDjvuPostProcessor = 'pnmtojpeg.exe';
$wgDjvuOutputExtension = 'jpg';
PHP needs memory to create thumbnails: this means a high "memory_limit" (~ 128MB) in the php.ini.
How to install on OS X
- Install djvu and netpbm using the Homebrew package manager.
brew install djvulibre netpbm
- Follow last step of install on GNU/Linux
Next to do
- How to install DjVuLibre, Qt and netpbm on a server.
Problems and solutions
- If you got “Error creating thumbnail: terminate called after throwing an instance of 'DJVU::GException' ppmtojpeg: EOF / read error reading magic number” when view file, increase the $wgMaxShellMemory .
- Under
$wgDjvuOutputExtension = 'jpg'
you can force pictures to PNG format with a client-side script. Useful wherever you don′t control MediaWiki setup.
Other page