Extension:PdfHandler/fr

From mediawiki.org
This page is a translated version of the page Extension:PdfHandler and the translation is 100% complete.
Cette extension est fournie avec MediaWiki 1.21 et supérieur. Ainsi vous n'avez pas besoin de la télécharger à nouveau. Néanmoins, vous devez encore suivre les autres instructions fournies.
Manuel des extensions MediaWiki
PdfHandler
État de la version : stable
Implémentation Média
Description Allows to handle PDF files like multipage DJVU
Auteur(s) Martin Seidel (xarax)
Politique de compatibilité Versions ponctuelles alignées avec MediaWiki. Le master n'est pas compatible arrière.
MediaWiki >= 1.42
Modifie la base
de données
Non
Licence Licence publique générale GNU v2.0 ou supérieur
Téléchargement
Exemple
  • $wgPdfHandlerJpegQuality
  • $wgPdfOutputExtension
  • $wgPdfInfo
  • $wgPdfProcessor
  • $wgPdftoText
  • $wgPdfPostProcessor
  • $wgPdfHandlerDpi
Téléchargements trimestriels 244 (Ranked 27th)
Utilisé par les wikis publics 3,575 (Ranked 185th)
Traduire l’extension PdfHandler sur translatewiki.net si elle y est disponible
Rôle Vagrant pdfhandler
Problèmes Tâches ouvertes · Signaler un bogue

L'extension PdfHandler présente les fichiers PDF téléversés, dans un format d'affichage multi-pages.[1]

Avec l'extension Proofread Page, les fichiers PDF peuvent être affichés côte à côte avec le texte. Cela permet aux utilisateurs de transcrire des livres et d'autres documents.[2]

Utilisation

  • Un utilisateur peut afficher les fichiers PDF sous forme d'image, montrant une seule page à la fois, comme ceci : [[File:myPdfFile.pdf|page=1|600px]]. La page et les paramètres de taille sont facultatifs; la page par défaut est la page numéro 1. Au lieu d'un paramètre de taille size, vous pouvez également utiliser le paramètre de vignette thumb , avec ou sans légende : [[File:myPdfFile.pdf|page=1|thumb|My PDF]].[3]
  • Because PdfHandler extends ImageHandler, you can use all the arguments that you would for an Image -- for example: thumb, right/left, caption, border, link, etc.
If you would like to present a 2-page pdf, for example, do the following: [[File:myPdfFile.pdf|page=1]] [[File:myPdfFile.pdf|page=2]]
  • The main usage of the PdfHandler extension is without user interaction. If you upload a new pdf file, the metadata will be stored in the database, and then this file can be shown in a multipage preview layout like the djvu handler does. Without this extension, pdfs will not display properly when uploaded.
  • Additionally, this extension allows Extension:ProofreadPage to handle pdfs in side-by-side view for transcribing/proofreading, as is done on Wikisource

Pré-requis

L'extension nécessite que les paquets suivants soient d'abord installés :

Package Description Link
ghostscript Renders the page images.

Fournit la commande gs.

www.ghostscript.com
imagemagick Does dynamic resizing and thumbnailing of images.

It provides the command convert.

www.imagemagick.org
xpdf-utils
or
poppler-utils
Extracts metadata from PDF files. If you see "0 × 0 pixel" on the file description of a PDF, you lack this package.

Fournit la commande pdfinfo.

www.xpdfreader.com

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

S'il manque quelque chose, installez les paquets correspondants. Exemple dans Debian et Ubuntu :

sudo apt install ghostscript imagemagick xpdf-utils

Si vous ne pouvez pas installer ces paquets, veuillez contacter votre administrateur de serveur pour obtenir de l'aide concernant votre environnement.

Installation

  • Assurez-vous que le logiciel nécessaire est installé avant de continuer !
  • Téléchargez et placez le(s) fichier(s) dans un répertoire appelé PdfHandler dans votre dossier extensions/.
    Les développeurs et les contributeurs au code doivent à la place installer l'extension à partir de Git en utilisant:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/PdfHandler
  • Ajoutez le code suivant à la fin de votre fichier LocalSettings.php  :
    wfLoadExtension( 'PdfHandler' );
    
  • Configurez si nécessaire. (see also the examples provided)
  • Yes Fait – Accédez à Special:Version sur votre wiki pour vérifier que l'extension a bien été installée.

Configuration

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")
path to your ghostscript implementation
$wgPdfPostProcessor (default = "convert")
path to your imagemagick convert
$wgPdfInfo (default = "pdfinfo")
path to your pdfinfo
$wgPdftoText (default = "pdftotext")
path to your pdftotext
$wgPdfOutputExtension (default = "jpg")
preferred output format[4]
$wgPdfHandlerDpi (default = "150" )
resolution in dpi
The extension extracts a bitmap image for each page of the PDF, using this resolution (dpi = dots per inch). For example, a PDF page with the European size A4 is 210 mm wide, corresponding to 595 points (at 72 dpi). This yields an image 1240 pixels wide (at 150 dpi). If instead this parameter is set to 300 dpi, the width will be 2480 pixels.
$wgPdfHandlerJpegQuality (default = "95" / since MW 1.24+ )
Quality level, which the post processor should use.
Variables below are not specific to this extension

Ubuntu

Note 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';

Debian

$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';

Windows

$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';

macOS

$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';

Dépannage

General issues
  • If PDF files do not display after upload, make sure that MediaWiki can execute the pdfinfo command and that configuration parameter $wgPdfInfo is set properly. Also check your error log, and make sure that your host hasn't disabled running external commands.
  • If PDF files do not show properly after installation (for example saying 0 height and width) you may need to use the maintenance scripts "refreshImageMetadata.php -f" and "rebuildImages.php"
    Example:
    php refreshImageMetadata.php --mime application/pdf --force
    Also try to purge the page of the file. See Manual:Purge.
  • If PDF files are rendered randomly check if the "C.UTF-8" locale is available on your server by running locale -a and make sure that configuration parameter $wgShellLocale is set to this locale.
  • If the main preview image of PDF files is broken (image not found by browser), but all other images are working, also check your configuration parameter $wgShellLocale . If it is set to a locale that does not use the point. as a decimal separator (e.g. "de-de", which use a comma), the srcset for the img tags will be broken. MediaWiki strongly recommends to use the "C.UTF-8" locale.
Special solutions for Windows Server running MW 1.31.x

If you are running this extension on a windows machine with PHP 7, please see Tommeyheyser's workaround description.

If you are having pdfoinfo and/or pdftotext hanging issue that prevents a big PDF upload, please check the modified extension by SeongMoon

Notes

  1. PROBABLY not required any more: with WebStore enabled, the extension automatically generates images from the specified page
  2. Cela permet aux utilisateurs de transcrire des livres et d'autres documents comme c'est généralement le cas avec les fichiers DjVu (en particulier dans Wikisource).
  3. Cette option de page unique a été introduite il y a longtemps (r25575)
  4. This does not preclude rendering to other formats, as the picture is served in a format determined by the extension (suffix) in its src= path, not by $wgPdfOutputExtension. The server-side choice can be overridden with a user script – see example.

Voir aussi