Extension talk:PDFEmbed

Jump to navigation Jump to search

About this board

64.140.229.250 (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

149.135.47.233 (talkcontribs)

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

103.108.94.8 (talkcontribs)

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

Same versions.

200.25.6.85 (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)
149.135.47.233 (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"
46.196.156.167 (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
2.239.139.214 (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.

93.41.255.164 (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()

1
Goodman Andrew (talkcontribs)

Now registered but doesn't work.

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

6
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];
128 
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.

Thanks!

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

6
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.

Which browsers is it broken on

1
Vicarage (talkcontribs)

The page says that it only works on some browsers from Mediawiki 1.30 onwards. Could we have a list of which browsers work, and which don't now. Vicarage (talk) 10:08, 25 July 2020 (UTC)

Reply to "Which browsers is it broken on"

Users unable to embed PDF

12
Legaulph (talkcontribs)
MediaWiki 1.25.5

When trying to embed a PDF the user is getting:

"you don't have permission to embed pdf files"

If I edit as admin and save it I get the same error.

I have to delete it save then edit and add the link and save then it is successful

Pisnaz (talkcontribs)

Are you using <pdf>File:FooBar.pdf</pdf> ?

I just had the same issue and am kicking myself for it now.

165.228.93.174 (talkcontribs)

Having the same issue as well any ideas

Pisnaz (talkcontribs)

Seems I had other issues as well once I started using my bot and normal users.

There is a embed_pdf permission showing now, that I did not see before. It seems it is only on Administrators by default.

For my Bot uploads I simply added in $wgGroupPermissions['bot']['embed_pdf'] = true; to my LocalSettings.php

I am running:

MediaWiki 1.26.2
PDFEmbed 1.1.2

Hope that helps. Also be careful as blanket permissions might cause issues.

RockSheep (talkcontribs)

This should be said in the configuration section of the extension article. Thanks!

Legaulph (talkcontribs)

Yes that works for me as well

This post was hidden by Pisnaz (history)
209.159.235.12 (talkcontribs)

That worked great! now that that has a permission line I can get my users to see or embed. Thanks a bunch!

77.20.30.72 (talkcontribs)

Hello,

I have added the

$wgGroupPermissions['*']['embed_pdf'] = true;

to my LocalSettings.php but I still get the error-message "you don't have permission to embed pdf files". MW Version 1.31.1

What else can I check?

Thanks in advance!

217.19.146.36 (talkcontribs)

Anyone on this problem ?

IMTS-TB (talkcontribs)

Hi,


I've installed the Extionsion, and can upload PDF files to our MediaWiki 1.31.

However, after linking to the uploaded file, and saving the page, a empty square shows, where the PDF image should be.

When I check the source code of the page, an URL is listed, and when I click on the URL, the PDF is opened.

All this happens in Google Chrome.


I also installed this extension in our TestWiki, and there I have no issues! Same browser., same Wiki version

212.236.21.221 (talkcontribs)

Hi

You have to replace line 92 in the PDFEmbed.hooks.pdf file

OLD

'src' => $file->getFullUrl().'#page='.$page,

NEW

'src' => preg_replace("/^http:/i", "https:", $file->getFullUrl()).'#page='.$page,


When not changed, you get an empty square, cause your side is loaded with https and the extension uses http, mixed content, blocked in chrome for example.

Reply to "Users unable to embed PDF"

Using page number as variable in template

3
Summary by WikiTeq

Use #tag parser function

ElmerG99 (talkcontribs)

Hey, need some assistance.

I have everything working well, except for one thing.

I have a page I'm trying to allow users to display PDFs on, and some of those may need to have other PDFs displayed.

So I'm using a {{{pagenum}}} to try to pass the provided page number through. I know it's pulling the number correctly because I can display it by itself elsewhere on the page. But it's not parsing in <pdf page={{{pagenum}}}"File:filename.pdf</pdf>

Any ideas or thoughts?

WikiTeq (talkcontribs)

You should do something like:

{{#tag:pdf 
|File:filename.pdf 
|page={{{pagenum}}} 
}}

See here for more info.

ElmerG99 (talkcontribs)

Hrm.

So that just gave me a URL or Filepath does not exist. error now. I'm using a {{{filename}}} call for the file as FIle:{{{filename}}}. WHen it's in the template, even with File:Actual_File_Here.pdf it throws an error. If I put it into a test wiki with hard parameters it displays fine.

EDIT: Aha, it won't take a partial. I have to pass the full FIle:File_Name_Here.pdf, I can't just pass the filename.pdf.


That's awesome, thank you so much.