This is a continuation of my series of posts about MediaWiki on Windows. Previous post’s can be found at :
- Installing MediaWiki on Windows Server 2012 R2 Core
- Installing VisualEditor for MediaWiki on IIS
- Enabling Media / File Uploads For MediaWiki on Windows Server
Enable PDF Filetype for Upload to MediaWiki
Edit your LocalSettings.php file (usually found at the root of your MediaWiki install) – add the following lines at the end of the file.
#### Add Allowed Upload Filetypes #### $wgFileExtensions = 'pdf';
Initally, I thought this would be enough to host PDF files on my wiki – but unfortunately when I added a media entry via the VisualEditor menu, it looked like this :
I wasn’t happy with this result so found a better method of hosting PDF’s on mediawiki PDF Include Extension.
To enable this extension – all you need to do is create a folder called ‘PDFInclude’ in your extensions directory – download the code and add to a file called PDFInclude.php inside the newly created directory and add the following to the top of your LocalSettings.php file.
## PDF Include Extension require_once "$IP/extensions/PDFInclude/PDFInclude.php";
Check the Special:Version page of your wiki to ensure the extension has loaded correctly. You can then use it in your wiki pages by using the following syntax :
<pdf width="width" height="height">Path</pdf> <pdf width="800px" height="1000px">http://www.example.com/example.pdf</pdf>
This will give you an embeded PDF document in your wiki and you can control the size etc… see the extensions page for more information.