Jump to content

Extension talk:Mpdf

*351 FastCGI sent in stderr: "PHP message: PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /mywiki/vendor/mpdf/mpdf/mpdf.php on line 30539" while reading response header from upstream

1
2003:C9:1F3C:F00:ECA0:C807:5E0D:219C (talkcontribs)

Hi,

I have installed the extension, and I can see the button and it tries to convert the page, but gets stuck with the above error in the logfile - the wikipage just goes blank.

I'm getting these errors about these "{ }" curly brackets in some hundred lines in mpdf.php. After changing these to [ ] brackets I could hop a bit further in the program. I have changed those incriminated brackets in mpdf.php and grad.php.

There after the webpage does not go blank anymore, but shows the fatal error on the wiki page. The logfile shows:

*441 FastCGI sent in stderr: "PHP message: PHP Warning:  A non-numeric value encountered in...

mpdf.php line 30572

My environment is mediawiki 1.42 and php8.2 on debian12.

I'm far from being able to "debug" the impressive code any further. My best guess is that the bracket use was changed from a certain php version onwards. So I'll disable the extension for now and hope for a solution or update.

Kind regards, Harald

Reply to "*351 FastCGI sent in stderr: "PHP message: PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /mywiki/vendor/mpdf/mpdf/mpdf.php on line 30539" while reading response header from upstream"

Get a HTTP500 Error when try to use Mpdf

1
Sarotar (talkcontribs)

Hello there,

so, I have installed the extension as stated in the extension description.

When I try to export a pdf using the link https://somedomain.de/index.php?somepage&action=mpdf all I get is an HTTP500 Error Page.

Is that a known issue? I gladly will provide more Details or Logs if needed.

Thank you

Reply to "Get a HTTP500 Error when try to use Mpdf"

Хак, чтобы заработал экспорт

1
37.214.26.60 (talkcontribs)

1.В корне вики запускаем установку mpdf композером:


composer require mpdf/mpdf


Поставится восьмая версия mpdf, которая работает с пхп8.


2.В папке самого раcширения Mpdf удаляем папку с библиотекой mpdf.


3.В файле MpdfAction вместо


$mpdf = new mPDF(...);


пишем


require_once __DIR__ . '/../../vendor/autoload.php';

$mpdf = new \Mpdf\Mpdf();

Reply to "Хак, чтобы заработал экспорт"
93.185.207.130 (talkcontribs)

PHP Fatal error:  Array and string offset access syntax with curly braces is no longer supported in /usr/share/mediawiki/extensions/Mpdf/vendor/mpdf/mpdf/mpdf.php on line 2349

93.185.207.130 (talkcontribs)

The extension is incompatible with php 8.0?

Reply to "php 8.0"

error on exporting to a pdf

4
Nicolas senechal (talkcontribs)

Hello,

I follow carefully the donwload part and the installation part but when I convert a article in pdf I have this error.

[b95a316a0df8370f20186161] 2022-07-05 15:14:27: Erreur fatale de type « Error »

I see befor other people who have the same (but I can"t find the topic...)

My configuration :

Produit Version
MediaWiki 1.37.1
PHP 8.1.2 (apache2handler)
MariaDB 10.4.22-MariaDB
ICU 70.1
Elasticsearch 6.8.23

So what I did wrong what I miss ?

thank you.

87.20.243.37 (talkcontribs)

I think that the extension is not compatible with php 8.

It uses a php syntax that is not more supported.

Try to migrate the wiki to php 7.x and it probably should resolve you problem.

Nicolas senechal (talkcontribs)

OK, I move to php 7.3.30 and I still have the same error.

Pooja2425 (talkcontribs)

87.20.243.37 But now php v7.3 life is going to end on 29th Nov, But need to upgrade php v8.0 .

with v8.0 mpdf 6.1 Extension:Mpdf is not woking .

pls suggest what we need to do ?

Reply to "error on exporting to a pdf"

When exporting a page, no images are inserted

3
Alechandrop (talkcontribs)

On pages that contain Math formulas, an error is displayed when exporting to PDF

Apatha11 (talkcontribs)

HI , Did you solve this issue? I am also facing same issue.

Alechandrop (talkcontribs)

No

I have this problem now

Reply to "When exporting a page, no images are inserted"

Does Mpdf Support Mediawiki Heavily formatted Tables?

1
GMShimokura (talkcontribs)

Hi. In my first attempts at using Mpdf, I get a PDF output.

MW 1.35.2, Mpdf 6.1.

However, I have many tables that do not render as seen on the screen nor similar to the output that would be produced by the browser print function.

Also I am creating a card game wiki with suit symbols formatted in different colours (ie red ♥) but the colours do not render either

Are tables and HTML characters supported?

Reply to "Does Mpdf Support Mediawiki Heavily formatted Tables?"

Mpdftags parsing and full copatibility with mPDF library

1
Michele.Fella (talkcontribs)

Methods 1 and 3 for mPDF Headers & Footers are deprecated


MpdfHooks parsing logic in mpdftags_Render function which replace open and close tag before re-including them in <> tags within did not allow me to use methods 2 and 4.


Not sure which are the "for security reason" for cirrent implementation, but simply passing the arguments of mpfdtags to mPDF would allow full compatibility with mPDF and enable usage of all possible mpdf control tags and HTML?

I changed the mpdftags_Render as following;

public static function mpdftags_Render( &$parser ) {
 // Get the parameters that were passed to this function
 $params = func_get_args();
 array_shift( $params );
 // Replace open and close tag for security reason
 //$values = str_replace( [ '<', '>' ], [ '<', '>' ], $params );
 // Insert mpdf tags between <!--mpdf ... mpdf-->
 $return = '<!--mpdf';
 /*
 foreach ( $values as $val ) {
  $return .= "<" . $val . " />\n";
 }
 */
 foreach ( $params as $val ) {
  $return .= "" . $val . "\n";
 }
 $return .= "mpdf-->\n";
 // Return mpdf tags as raw html
 return $parser->insertStripItem( $return );
}
Reply to "Mpdftags parsing and full copatibility with mPDF library"

HTML and PHP to Mpdftags

6
OOZ.MOO (talkcontribs)

Hi,

I have difficulty getting the mpdftags to work in Mediawiki. The example with the header and footer which is given in the Mediawiki entry for the extension, work just fine, but most of the HTML or mpdftags that I write in my wiki pages do not work. Is there any documentation on how to change, integrate or use the codes (that are provided in the documentation of the mpdf extension) for and in Mediawiki? what parameters should I change?

Would be very helpful to understand, and I'd really appreciate your help.


Pastakhov (talkcontribs)
OOZ.MOO (talkcontribs)

Took me long to figure out, since there's no documentation on the translation of the HTML tags to mediawiki.

OOZ.MOO (talkcontribs)

Hi Pastakhov. Thanks for your reply and sorry for my late reply. Actually using the tags is pretty easy, when you know how the tags translate from html to mediawiki to html:

{{#mpdftags: pagebreak}} -> <pagebreak\>


Obliva (talkcontribs)

+1 It would be very useful to have a list of translate tag from html to mediawiki

Obliva (talkcontribs)

For example, i want an orientation landscape for my table, but i can't find the mediawiki mpdftag...

Reply to "HTML and PHP to Mpdftags"

MPDF is not giving image with wiki 1.35

9
Apatha11 (talkcontribs)

HI Support Desk,

Following are the installed software product version(s) those are being used in our RHEL7 server environment.

Installed software

Product Version
MediaWiki 1.35.1
PHP 7.4.15 (apache2handler)
MySQL 8
OS LINUX


I have tried MPDF and its downgliding pdf but not giving image, can you please suggest where we can enable for image?


Yes I have set it up properly as given in MPDF documentation. (Extension:Mpdf)

The path is not coming full in HTML. (/wiki135/images/5/57/enterprise-wiki.jpg).

From where I can change it, or it should be pick this automatically. Path should be like  :

https://localhost/wiki135/images/5/57/enterprise-wiki.jpg not /wiki135/images/5/57/enterprise-wiki.jpg


Error: Error parsing image file - image type not recognised, and not supported by GD imagecreate


Steps I have done:

  1. wget https://extdist.wmflabs.org/dist/extensions/Mpdf-REL1_35-94bd27c.tar.gz

2. tar -xzf Mpdf-REL1_35-94bd27c.tar.gz -C /data/www/html/wiki135/extensions

3. cd data/www/html/wiki135

#php maintenance/update.php

4. added("extensions/Mpdf/composer.json") in wiki135/composer.local.json-sample

{

"extra": {

"merge-plugin": {

"include": [

"extensions/Mpdf/composer.json"] } } }

5. in mpdf dir

#composer update --no-dev

6.added in LocalSettings.php

require_once( "$IP/extensions/Mpdf/vendor/autoload.php");

wfLoadExtension( 'Mpdf' );

$wgMpdfSimpleOutput=true;

7.Given 777 to all 3 dir (/data/www/html/wiki135/extensions/Mpdf/vendor/mpdf/mpdf)

/ttfontdata/

/tmp/

/graph_cache/

http://localhost/wiki135/index.php/Main_Page?title=Main_Page&action=mpdf



Please help me to fix this.


Thanks

Apatha11 (talkcontribs)

Waiting for response.

AKlapper (WMF) (talkcontribs)
Apatha11 (talkcontribs)

Could you please let me know that which steps are pending. Please suggest if you know.. I have done all steps which is mentioned in the mpdf document.

In mpdf document they asked to add in composer.local.json-sample and add require_once in localsettings.Php. I did what mentioned in given mpdf doc.

https://m.mediawiki.org/wiki/Extension:Mpdf

AKlapper (WMF) (talkcontribs)

You state "In mpdf document they asked to add in composer.local.json-sample": No. That is not true. The page that you linked really does not say that.

Apatha11 (talkcontribs)

Thanks for your time !! Please check the doc, it’s mentioned there , Could you please help me to fix this rather than discus about above thing. . Please Suggest how can I fix this or correct me where I have done wrong .

Apatha11 (talkcontribs)
Please check here
AKlapper (WMF) (talkcontribs)

As your screenshot clearly shows, "composer.local.json-sample" it is NOT mentioned there, which I have now written three times. This conversation is not a good use of my time as you unfortunately do not seem to carefaully read and follow the docs, so you run into issues.

Apatha11 (talkcontribs)

HI Please Try to understand, They are using composer.local.json on the root as well we have composer.local.json-sample file on the root, our file name is not same in root of wiki.

You want me to rename composer.local.json-sample to composer.local.json? then It will work according to you? or I can include this line in composer.json ("extensions/Mpdf/composer.json")


Kindly clear this.

One more thing, please have look at the below info regarding our application.

We are using LDAP+SSO login in our application Can you confirm that is MPDF compatible with these Protocol services.

With LDAP+SSO it's not working and it's throwing us an unauthorized error in the image function. ( function _imageTypeFromString(&$data) )

$data is printing unauthorized error.

We have set 777 permission to the image folder.


The same code is working fine where we are not using LDAP+SSO. Can you confirm that MPDF works with the server which is secured with a password?

Reply to "MPDF is not giving image with wiki 1.35"