Extension talk:Mpdf/Archive

Images and TOC
Extension seems to be working great so far except for just a few issues...

The first is that no images appear in the exported pdf. They show up as little white boxes with a red x. Is there anything I need to tweak to get these to display properly? When I hover over the x icons it displays a URL in the format http://servernamehere/mediawiki/index.php?title=File:filenamehere.jpg ..could this be the problem since its not pointing to the actual file location?

The second issue is that the TOC doesn't seem to render properly and often breaks the formatting. Is there any way around this? And is it possible to have the TOC links point to the proper section of the actual exported pdf document itself when clicked? This type of extension is exactly what I've been looking for since I need to be able to export PDF but don't have root access so can't use any of the alternate htmldoc extensions, so appreciate any help you can provide! Thanks in advance


 * Hi. When I hover over the x icons it displays a URL - this is normal. By default, picture in the wiki have a link to the page file. This can be corrected by setting link=. Sample: myfile.jpg


 * TOC links point to the proper section of the actual exported pdf document - mPDF has its own means of ToC Index Bookmarks. Please, read mPDF manual


 * TOC doesn't seem to render properly - I'm working on improving render


 * They show up as little white boxes with a red x - This is true for all images or only some of them?


 * in the near future I will make a few examples showing work of this extension --Pastakhov (talk) 04:23, 7 August 2012 (UTC)


 * Thanks for your response, Pastakhov. The little white boxes with a red x show up for all images. I set showImageErrors to true in order to determine what the problem is and after doing so, I receive the msg "mPDF error: IMAGE Error (http://*serveriphere*/mediawiki/images/2/23/Flag-USA.png): Could not find image file" when attempting to export a page to PDF. Any idea what the fix could be?


 * Mpdf required also gd php module for works with images png, svg and etc... thanks for report problem --Pastakhov (talk) 05:26, 10 August 2012 (UTC)


 * Yeah I already have gd enabled, and have checked to make sure I followed the other requirements exactly as you had written. It's not just png files that don't show up, the other image files (i.e. jpg, gif, etc) are not working at all either. Everything else seems to render in the exported pdf without any issues, it's just the images that show up as red x..and if I click the link that the missing image (red x) refer to, the pictures load in the browser fine they just don't appear in the pdf file...any other ideas how to fix this issue? 

You can place them on http://pastebin.com/ --Pastakhov (talk) 04:14, 17 August 2012 (UTC)
 * I need to see the html source of a wiki page and logs from a web server at the time of export to pdf format.


 * What exactly is it that you are looking for from the webserver log? I'm using IIS, and the only line that prints out in the server log when I try to export a page to pdf (with imageerrors set to true in the mpdf file), is for example a line like this: "GET /mediawikiold/skins/common/images/poweredby_mediawiki_88x31.png - 80 - 10.1.19.124 - 401 2 5 0" And on the webpage itself I get a blank page with the error: "mPDF error: IMAGE Error (http://10.1.19.124/mediawikiold/skins/common/images/poweredby_mediawiki_88x31.png): Could not find image file"


 * If I'm not mistaken, IIS return 401 error - Unauthorized. You configure authorization on the web server? --Pastakhov (talk) 06:56, 21 August 2012 (UTC)


 * There are no IIS errors that appear. The pdf itself exports without any IIS error, its just that when I open the exported file on my computer, all of the images are missing and have red x in their place. If I set "$this->showImageErrors = true" in mpdf's config.php file and try exporting a pdf again, it gives me the mpf IMAGE error I wrote in the msg above. Again, the missing images (that show up as red x in the pdf) appear to point to the right file (i.e. if I type them into a webbrowser, the image displays fine), it is just that they are not getting rendered properly in the exported pdf. This goes for both internal images that I've uploaded onto my server (i.e. http://10.1.19.124/mediawikiold/skins/common/images/poweredby_mediawiki_88x31.png) and for external images (i.e. http://upload.wikimedia.org/wikipedia/mediawiki/a/a9/Example.jpg)--none of them show up on the exported pdf.


 * Any ideas for how to resolve this issue so that images show up properly??

I am sorry for the long wait, I'm on vacation until September 17 --Pastakhov (talk) 04:50, 7 September 2012 (UTC)


 * No problem, upon your return if you do have any ideas how to resolve this, I'd love to hear!


 * mpdf return error 'Could not find image file' if can't download image file from web server. it is possible for one of the following reasons:


 * allow-url-fopen disabled by settings in php.ini.
 * not exist or disabled curl library


 * In my php.ini I have php_curl.dll enabled and allow_url_fopen = On . Any other ideas what might be causing this error?
 * no, ideas ended ... I can offer download a clean mpdf and see how it will be generated pdf files of the examples. If there is a problem with the images, you will need to contact the developer mpdf. Unfortunately there is a very tangled source code and few means for debugging. if I have more ideas at the expense of this problem, I will write here--Pastakhov (talk) 04:07, 21 September 2012 (UTC)

Header and Footer
We use Mediawiki 1.19 and want to export some pages as PDF. Mpdf works fine but i would like to add a header (Mediawiki-Pagename) and a footer (Page x of y) on any page. Anyone an idea how to realize this?

Thank you in advance

Michael


 * According to the documentation mpdf, this is done by using special tags. At an early date i will try to solve the problem of adding these tags in a wiki page.--Pastakhov (talk) 10:18, 15 November 2012 (UTC)


 * Please download and try new version of Mpdf extension. Sample in http://www.xboct.org/wiki/Mpdf, PDF --Pastakhov (talk) 13:38, 15 November 2012 (UTC)


 * Sorry, hurried and forgot to mention use magic word for adds mpdf tags in wiki page. --Pastakhov (talk) 14:20, 15 November 2012 (UTC)

How to not include Wiki header and sidebar tools in PDF output
When exporting a wiki page to PDF with Mpdf extension, the resulting PDF has also the wiki page header / footer (e.g. search, "powered by mediawiki") and the sidebar included at the end of the PDF page. How to prevent this? Thanks. Kai,


 * Does the printable version have wiki page header / footer? --Pastakhov (talk) 04:11, 7 April 2014 (UTC)


 * No, printable version is without header and footer.


 * Thanks you for feedback. It is fixed in version 0.4.0. --Pastakhov (talk) 05:01, 8 April 2014 (UTC)


 * Looks much better now. Thanks a lot. One small issue. At each chapter heading, there is a preceding "[edit]" link which links to editing this chapter. Is it possible to remove this? Thanks, Kai.


 * I've removed it in version 0.4.1. Feel free to contact me if you need else something. --Pastakhov (talk) 12:13, 8 April 2014 (UTC)


 * Works perfectly now. Thanks, Kai.

Ignorance in using the
So this is probably something very easy and I have tried to educate myself before posting here but I'm out of ideas. I have attempted to use the #mpdftags but it does nothing when I select the PDF Export Button. I have even copied the example and tried that with no luck. I am running MW 1.21 with Mpdf (Version 0.4.1, 2014-04-08). Any thoughts or ideas would be a big help. Thanks. Clifford.kasper (talk) 14:03, 6 August 2014 (UTC)
 * Hi, please select the correct statement describing your problem:


 * 1) pdf files are not generated in any way
 * 2) pdf files are not generated when used #mpdftags
 * 3) pdf files are generated but usage #mpdftags has no effect
 * It will also be helpful if you check the webserver logs for errors. --Pastakhov (talk) 17:32, 6 August 2014 (UTC)


 * Pastakhov, thank you for the quick response. My situation fits into number 3, I will get a PDF file but nothing specified on in the tag is applied.  I will try and check the logs but I am a remote user with limited access, however, I'll make every attempt and post here if successful.  It might also be helpful if I explain how I am using it, maybe that is where I am going wrong.  I have pasted the #mpdftags example given on the extension page.  I then save the page and then click on the PDF Export button at the top (in the area of the page where the edit page button/link is located).  Thanks again for your help.

Clifford.kasper (talk) 17:51, 6 August 2014 (UTC)


 * it seems you're doing it right. I'll check it out, maybe there is some bug. --Pastakhov (talk) 18:06, 6 August 2014 (UTC)

There is no bug :-) I've looked for the reason, and finally realized that the problem as a result of missed tags.

mPDF class is really hard to understand. --Pastakhov (talk) 10:56, 7 August 2014 (UTC)

Landscape?
Hello again. Thanks for your help last time. I have been able to do some very useful things with this extension. I was trying to switch the PDF to Landscape and cannot figure out how to do that. I am successful with the HTML Control Tags but I have not figured out the mPDF Functions. Can they be used with this extension? Thanks. Clifford.kasper (talk) 18:03, 26 September 2014 (UTC)
 * Hello, you can switch the PDF to Landscape by using tag   Example: , but it adds new page. I will add parser function   for setting initialization parameters. --Pastakhov (talk) 03:58, 29 September 2014 (UTC)
 * Pastakhov many thanks for the speedy response and your dedication to this extension. It is EXTREMELY useful.  I look forward to the new functionality (mpdfconstructor).  Thanks again. Clifford.kasper (talk) 13:46, 29 September 2014 (UTC)
 * ✅ in v 0.5.0. Just put (for example) and You can put it in any place in wiki page.

It is possible to set several parameters:
 * format
 * margin-left
 * margin-right
 * margin-top
 * margin-bottom
 * margin-header
 * margin-footer
 * orientation

"orientation" does not work as expected, it possibly a bug in the original mpdf library or I just don't understand how it should work here. If you want to get landscape page orientation, just add '-L' to format (for example 'A4-L'). You can use this documentation for get help with parameter values. Have a lot of fun :-) --Pastakhov (talk) 10:52, 30 September 2014 (UTC)

Mpdf Image not rendering
Hi installed Mpdf Extension   all the necessary permission & php librabries are enabled.But if there is any image in the page, it is not rendering in pdf it is breaking there itself. Please guide me how to fix, i want to export any page without installing anything more on server Mediawiki 1.21PHP : 5.3.3