Extension talk:PDFEmbed

About this board (talkcontribs)

I have get the extension working for Mediawiki 1.37 by replacing line no 160 of extensions/PDFEmbed/PDFEmbed.hooks.php from

$pdfFile =wfFindFile($filename);


$pdfFile = MediaWikiServices::getInstance()->getRepoGroup()->findFile($filename);

Stra2senBahn (talkcontribs)

I think,

$pdfFile = MediaWiki\MediaWikiServices::getInstance()->getRepoGroup()->findFile($filename);

is the right solution. It works on my MediaWiki.



Reply to "Mediawiki 1.37 Update" (talkcontribs)

i have installed pdfEmbed 2.0.1 in mediawiki and have uploaded the pdf document thru upload files in mediawiki. its showing a warning as application/PDF privacy consideration and the output on the pdf embed page showing as "The URL or file path given does not exist."

Please help me to resolve this issue. (talkcontribs)

I have the same error,

Since 3 months before it works fine, ..

Can you help us?

Thank .


Guindelo (talkcontribs)

I have the same error,

Since 3 months before it works fine, ..

Can you help us?

Thank .


Pooja2425 (talkcontribs)

Same issue for me also, Pls suggest any other extension or any fixed build.

Reply to "embed pdf error" (talkcontribs)

Internal error

[cd8dca3e4334fb046fddfec9] 2021-03-30 20:54:25: Fatal exception of type "Error"

I am getting the following error when trying to use PDFEmbed v2.02 on 1.35.1 (talkcontribs)

I have same problem with the same versions. Disabling PdfHandler didn't resolve the issue. (talkcontribs)

Same problem here: 2021-03-31 03:38:08: Fatal exception of type "Error"

Same versions. (talkcontribs)

Same Error here on any page that includes <pdf>File:Example.pdf</pdf> or any version of it (eg with height) the page won't even save if this is on it.

Just upgraded to version 1.35.1

Lambdacoresw (talkcontribs) (talkcontribs)

Thanks Lambdacoresw! That worked!

I had to re-save the pages with the embed code in, otherwise I got a permission error. After that, all good!

Reply to "Internal Error"

Pdf Document does not load into viewer.

Summary by Zed4242

Resolved by updating PDFEmbed extension.

Zed4242 (talkcontribs)

The pdf document viewer is displayed, but the document itself is not loaded into the viewer or displayed under all but the first tab on a wiki page. For example, when using the either the Header Tabs or Tabs extension, the document viewer is displayed and the document loads under the first tab only. In all subsequent tabs, only the viewer is displayed. In this situation, if the viewer is configured other than default (e.g., change page <pdf page=2>), the viewer is blank and still indicates page 1/1. By clicking the resize button on the viewer, the document then loads and displays correctly.

Is there a way to force the viewer to load and display the document when the markup code (i.e., <pdf></pdf>) is processed? (talkcontribs)

I had this error in 1.35.1:

'Internal Error [1e3bd7042d4fdba8255c57a6] 2021-03-30 19:32:36: Fatal exception of type "Error" '

How can I run properly this plugin?

Reply to "I got 'Internal Error'"

Error ShellDisabledError on pdf upload

2 (talkcontribs)

I had this error in 1.33 while uploadinf a pdf. Every pdf.

I do not understand why, but, looking for help in talks, I remembered I activate PDFHandler in the Wiki installation.

Disabled the default extension and now everything works fine.

So, PDFEmbed and PDFHandler does not works fine togheter. (talkcontribs)

It worked for me too on MW 1.31.

Thank you so much.

Reply to "Error ShellDisabledError on pdf upload"

MW 1_35 [X8eQyvnuCLpleT1MwUtyYgAAOQk] Exception caught: Call to undefined method Parser::disableCache()

Goodman Andrew (talkcontribs)

Now registered but doesn't work.

MW 1.35 Call to undefined method Parser::disableCache()

Seppl2013 (talkcontribs)

PDFEmbed/PDFEmbed.hooks.php: Call to undefined method Parser::disableCache()

Seppl2013 (talkcontribs)
Kghbln (talkcontribs)

Thanks for working on this and providing a way out.

Spas.Z.Spasov (talkcontribs)

Hi, @Seppl2013, thank you for the solution. In order to do some combability with the old synaxis, <pdf>File:Name-of-the-file.pdf</pdf>, I've made an additional fix in my local copy of PDFEmbed.hooks.php in this way:

127 $filename = $re[1];
129 if (count($re) == 3) {
130 	$page = $re[2];
131 }
132 // the next lines are new
133 $ns_media_wiki_lang = MediaWiki\MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNsText( NS_MEDIA );
134 $ns_file_wiki_lang = MediaWiki\MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNsText( NS_FILE );
135 $ns_media_lang_en = MediaWiki\MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' )->getFormattedNsText( NS_MEDIA );
136 $ns_file_lang_en = MediaWiki\MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' )->getFormattedNsText( NS_FILE );
137 $filename = preg_replace("/^($ns_media_wiki_lang|$ns_file_wiki_lang|$ns_media_lang_en|$ns_file_lang_en):/", '', $filename);
Andreas Wachowski (talkcontribs)

FYI, I received a "File does not exist error" using Seppl2013's clone and it worked again after introducing Spas.Z.Spasov's changes. Thanks to you both!

Seppl2013 (talkcontribs)
Reply to "MW 1.35 Call to undefined method Parser::disableCache()"
Summary by Kghbln

A preliminary? working fork of the extension is mentioned in this thread.

2409:8A1E:84DD:AB0:40B6:2038:4D8E:6DB8 (talkcontribs)

The extension Do not work on MW 1.35, it can not be saved or be previewd. It gives a report says, Caught exception of type error. The same codes works on MW 1.33.1

PDFembed version is 2.03.


Use of "Parser::disableCache" was deprecated in MediaWiki 1.28.

Summary by Kghbln

A preliminary? working fork of the extension is mentioned in this thread.

Equalze (talkcontribs)

Any idea on how to remove this error across the top of the page? The pdf is embedding perfectly yet this error appears?

Use of Parser::disableCache was deprecated in MediaWiki 1.28. [Called from PDFEmbed::generateTag in xxxxxxxxxxxxxxxxxxxx  PDFEmbed\PDFEmbed.hooks.php at line 39] in xxxxxxxxxxxxxxxxx xxxxdebug\MWDebug.php

Any help appreciated

Kghbln (talkcontribs)

Probably you are not using the version of PDFEmbed matching the version of MediaWiki you are using, meaning that if you upgrade MediaWiki you also have to upgrade the extensions.

Probably you also have $wgShowExceptionDetails = true; somewhere in your "LocalSettings.php" file. You should change this to false if your wiki is live.

Equalze (talkcontribs)

@Kghbln Version has been updated to 2.0.2. the most up to date, MW Version is 1.34.0

Kghbln (talkcontribs)

Thanks for reporting back! So it appears that this issue is still part of the code base. I have created an issue report for the extension's developer.

Gracionsoft (talkcontribs)

MediaWiki 1.35 removed disableCache, so this is now a fatal exception. I've added this info and suggested code changes to the issue report that @Kghbin created.

VOIstri (talkcontribs)

So that others may find this, the error message was: "Error from line 39 of /var/www/html/w/extensions/PDFEmbed/PDFEmbed.hooks.php: Call to undefined method Parser::disableCache()". Path may, of course, be different.

In mediawiki version 1.34.4, the file includes/parser/Parser.php had a suggestion in the comments to the function disableCache() to "use getOutput()->updateCacheExpiry()". The function disableCache itself has the line "$this->mOutput->updateCacheExpiry( 0 ); // new style, for consistency" at the end.

I tried, therefore, changing the line "$parser->disableCache();" to "$parser->getOutput()->updateCacheExpiry(0);" in extensions/PDFEmbed/PDFEmbed.hooks.php. This seems to work, but I can't vouch for it's utility or safety.

Return to "PDFEmbed" page.