Topic on Extension talk:Pdf Export

blank pdf when exporting pages with titles with spaces in them

1
1.128.108.145 (talkcontribs)

I found a bug in PdfExport: REL1_30 (2017-09-21T22:16:05) where the pages only export to pdf if the page name is one word. For example:

   /MediaWiki/index.php?title=Special:Pdfprint&page=Page

exports fine, but

   /MediaWiki/index.php?title=Special:Pdfprint&page=Main_Page

exports an almost empty pdf.

The fix was to merely replace the underscores in the URL with spaces. To do this, I changed the following lines in PdfExport.php (in the extensions folder) from this:

       $nav_urls['pdfprint'] = array(
           'text' => $skintemplate->msg('pdf_print_link')->text(),
           'href' => $skintemplate->makeSpecialUrl('PdfPrint', "page=".wfUrlencode("{$skintemplate->thispage}"))

to this:

       $page_name=wfUrlencode("{$skintemplate->thispage}");
       $page_name_with_spaces=str_replace('_','%20',$page_name);
       $nav_urls['pdfprint'] = array(
           'text' => $skintemplate->msg('pdf_print_link')->text(),
           'href' => $skintemplate->makeSpecialUrl('PdfPrint', "page=".$page_name_with_spaces)

then run update.php

Reply to "blank pdf when exporting pages with titles with spaces in them"