2

I want to use Widget PDF to embed PDF files on my MediaWiki pages. So at first installed Extension:Widgets on MediaWiki and it seems it is installed (I can see it in Installed extensions list in Special:Version of the Wiki). The I copied and pasted the entire source of the PDF widget code page into a page called Widget:PDF on my Wiki:

<noinclude>__NOTOC__
<big>This widget allows you to '''embed PDF files''' on your wiki page.</big>

Created by [https://wiki.karlsregion.net/z/User:Wilhelm_Bühler Wilhelm Bühler] and adapted by [https://www.wikihoster.net Karsten Hoffmeyer].

== Using this widget ==
For information on how to use this widget, see [https://www.mediawikiwidgets.org/PDF widget description page on MediaWikiWidgets.org].

== Copy to your site ==
To use this widget on your site, just install [https://www.mediawiki.org/wiki/Extension:Widgets MediaWiki Widgets extension] and copy the [{{fullurl:{{FULLPAGENAME}}|action=edit}} full source code] of this page to your wiki as page '''{{FULLPAGENAME}}'''.
</noinclude><includeonly><object class="pdf-widget" data="<!--{$url|validate:url}-->" type="application/pdf" wmode="transparent" style="z-index: 999; height: 100%; min-height: <!--{$height|escape:'html'|default:680}-->px; width: 100%; max-width: <!--{$width|escape:'html'|default:960}-->px;"><param name="wmode" value="transparent">
<p>Currently your browser does not use a PDF plugin. You may however <a href="<!--{$url|validate:url}-->">download the PDF file</a> instead.</p></object></includeonly>

My PDF file is under this URL:

http://localhost/<wiki-name>/index.php/File:GraphicsandAnimations-Devoxx2010.pdf

And it's name is File:GraphicsandAnimations-Devoxx2010.pdf. So as described here, I added this code to my Wiki page:

{{#widget:PDF
 |url=http://localhost/<wiki-name>/index.php/File:GraphicsandAnimations-Devoxx2010.pdf
 |width=750
 |height=1050
}}

But this error occured:

The localhost page isn’t working
localhost is currently unable to handle this request. 
HTTP ERROR 500

What I did:

  1. Also I tried this (original example of the Widget PDF)

    {{#widget:PDF
     |url=https://www.semantic-mediawiki.org/w/images/e/e9/SMW_quick_reference.pdf
     |width=750
     |height=1050
    }}
    

    But result was the same.

  2. I read Extension talk:Widgets but did not find any thing.

  3. I opened Chrome DevTools (Ctrl+Shift+I), but there was no error.

How I can solve the problem?

Edit:

After some times, I tried to uninstall Widget PDF and Extension:Widgets and reinstall them. So I removed Extension:Widgets files/folder from $IP/extensions/ and also deleted Widget:PDF page from Wiki. Then I installed Extension:Widgets again, but now, I can not open the Wiki pages at all (I see above error again), unless I delete require_once "$IP/extensions/Widgets/Widgets.php"; from LocalSettings.php. So I even cannot try to load Extension:Widgets.

Now I see this error in DevTools:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Also after uninstalling Extension:Widgets, I tried Extension:PDFEmbed and unfortunately again I saw above error.

1
  • HTTP 500 errors will be logged on your server (e.g. the PHP error log, depends on your configuration), not your browser.
    – Tgr
    Feb 26, 2017 at 19:01

2 Answers 2

0

No idea if this will help, but the first thing I would try would be replacing localhost with the IP address 127.0.0.1

1
  • Thank you for your reply. But I have encountered with a new problem and cannot try your proposed way. I edited my question. Please see that again. Feb 24, 2017 at 17:37
0

I could not solve above problem for using extensions to embedding PDF in MediaWiki. So finally I used $wgRawHtml and uesed this code in my Wiki page:

<html>
<embed src="http://localhost/<wiki-name>/images/5/59/GraphicsandAnimations-Devoxx2010.pdf#page=14" width="1200px" height="500px" />
</html>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.