This extension
comes with MediaWiki 1.21and above. Thus you do not have to download it again. However, you still need to follow the other instructions provided.
The PdfHandler extension shows uploaded PDF files in a multipage preview layout.[1]
Together with the Proofread Page extension, PDF files can be displayed side-by-side with text. This allows users to transcribe books and other documents.[2]
[[File:myPdfFile.pdf|page=1|600px]]
. The page
and size
parameters are optional; the default page is page #1. Instead of a size
-parameter, you can also use the thumb
-parameter, with or without captions: [[File:myPdfFile.pdf|page=1|thumb|My PDF]]
.[3]thumb
, right
/left
, caption
, border
, link
, etc.[[File:myPdfFile.pdf|page=1]] [[File:myPdfFile.pdf|page=2]]
This extension requires the following packages to be installed first:
Package Description Linkghostscript
Renders the page images.
It provides the command gs
.
imagemagick
Does dynamic resizing and thumbnailing of images.
It provides the command convert
.
xpdf-utils
poppler-utils
Extracts metadata from PDF files. If you see "0 × 0 pixel" on the file description of a PDF, you lack this package.
It provides the command pdfinfo
.
On Ubuntu and Debian, the "poppler-utils" package can be used instead of "xpdf-utils".
Type the following in your shell to see if you have the above installed first (it should list 4 rows):
which gs convert pdfinfo pdftotext
If something is missing, install the related packages. Example in Debian and Ubuntu:
sudo apt install ghostscript imagemagick xpdf-utils
If you are unable to install these packages, kindly contact your server administrator for assistance in your environment.
PdfHandler
folder to your extensions/
directory.cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/PdfHandler
wfLoadExtension( 'PdfHandler' );
You can (or, depending on the operating system of the server, will have to) set some variables in the "LocalSettings.php" file:
$wgPdfProcessor
(default = "gs")
$wgPdfPostProcessor
(default = "convert")
$wgPdfInfo
(default = "pdfinfo")
$wgPdftoText
(default = "pdftotext")
$wgPdfOutputExtension
(default = "jpg")
$wgPdfHandlerDpi
(default = "150" )
$wgPdfHandlerJpegQuality
(default = "95" / since MW 1.24+ )
$wgFileExtensions [] = 'pdf';
$wgUseImageMagick = true;
$wgMaxShellMemory
- memory limit for gs, convert and pdfinfo. The default value might be too low.Note: This is identical to the default settings for this extension.
$wgPdfProcessor = 'gs'; $wgPdfPostProcessor = $wgImageMagickConvertCommand; // if defined via ImageMagick // $wgPdfPostProcessor = 'convert'; // if not defined via ImageMagick $wgPdfInfo = 'pdfinfo'; $wgPdftoText = 'pdftotext';
$wgPdfProcessor = '/usr/bin/gs'; $wgPdfPostProcessor = $wgImageMagickConvertCommand; // if defined via ImageMagick // $wgPdfPostProcessor = '/usr/bin/convert'; // if not defined via ImageMagick $wgPdfInfo = '/usr/bin/pdfinfo'; $wgPdftoText = '/usr/bin/pdftotext';
$wgPdfProcessor = 'C:\Program Files\gs\gs8.60\bin\gswin32.exe'; $wgPdfPostProcessor = $wgImageMagickConvertCommand; // if defined via ImageMagick // $wgPdfPostProcessor = 'C:\Program Files\ImageMagick-6.6.2-Q16\convert.exe'; // if not defined via ImageMagick $wgPdfInfo = 'C:\Program Files\xpdf-3.02pl1-win32\pdfinfo.exe'; $wgPdftoText = 'C:\Program Files\xpdf-3.02pl1-win32\pdftotext.exe';
$wgPdfProcessor = '/usr/local/bin/gs'; $wgPdfPostProcessor = $wgImageMagickConvertCommand; // if defined via ImageMagick // $wgPdfPostProcessor = '/usr/local/bin/convert'; // if not defined via ImageMagick $wgPdfInfo = '/usr/local/bin/pdfinfo'; $wgPdftoText = '/usr/local/bin/pdftotext';
$wgPdfInfo
is set properly. Also check your error log, and make sure that your host hasn't disabled running external commands.php refreshImageMetadata.php --mime application/pdf --force
locale -a
.src=
path, not by $wgPdfOutputExtension
. The server-side choice can be overridden with a user script – see example.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4