Jump to content

Extension talk:PDF Include

About this board

A methode to solve when not working with an android tablet browser

1
Chantoune (talkcontribs)

how to perform an update into PDFInclude.php to view the pdf on the android tablet (because pdf is not displayed or download in this case)

for memory I solved this problem in PDFEmbed as explain in the following post

and with PDFInclude I performed this modification

if( filter_var( $obj, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED ) ) {

$ua = strtolower($_SERVER['HTTP_USER_AGENT']);

     if(preg_match('/android/i',$ua)) {

      $myfile = "https://docs.google.com/gview?url=$obj&embedded=true";      

      return Html::rawElement('iframe', [

          'src' => $myfile,

        'height' => $height,

        'width'=> $width,

        'frameborder' => "1" ]  );

      } else {

         return pdfObject( $obj, $width, $height );

      }

} else {

        return pdfError( "Path is not valid" );

 }

Reply to "A methode to solve when not working with an android tablet browser"

ERROR : incompatibility with PDFEmbed extension

1
Chantoune (talkcontribs)

these 2 extensions uses the same tag <pdf> </pdf>

so we get error according to where the pdf file is located (internal to wiki : PDFEmbed) (external to wiki : PDFInclude)

So to prevent this incompatibility in the case of we have the 2 extensions installed

it is necessary for instance to update the tag as <pdfURL> in the delivery code of this extension PDFInclude.php

function pdfRegister() {

global $wgParser;

$wgParser->setHook( 'pdfURL', 'pdfInclude' );

return true;

}

Reply to "ERROR : incompatibility with PDFEmbed extension"
Seppl2013 (talkcontribs)

1.4 beta is intended to handle template parameters. Unforunately when calling the recursive tag parser for this it will already create fully useable html code like <nowiki><a href='some url'> ...</a> and we only need the href part. So the current code is somewhat hacky by reversing the process and fishing the href part back from this anchor code. It works in our environment and so we decided to share it. I didn't find the signature in the editor so I am linking to my own user @Seppl2013 instead,

Reply to "template parameters"

Preview works, but the attempt to save shows empty page

1
Domitori (talkcontribs)

I followed the instruction: I saved the code as extensions/pdf_include.php At LocalSettings.php, I added the lines require_once("$IP/extensions/pdf_include.php"); $wgPDF = array('width'=>'width', 'height'=>'height', 'black'=>array('Blocked Domain','Blocked Domain 2.....')); $wgPDF['black'] = array('Blocked Domain','Blocked Domain 2.....'); //The best way to block Domains/Do only write the $ $wgGroupPermissions['*']['pdf'] = true; //Allow it for ALL/SHOULD NOT USED!!!!!!!!! $wgGroupPermissions['user']['pdf'] = true; //Allow it for USERS/MAYBE SHOULD NOT USED!!! $wgGroupPermissions['bot']['pdf'] = true; //Allow it for BOT/SHOULD NOT USED!!!!!!!!! $wgGroupPermissions['sysop']['pdf'] = true; //Allow it for SYSOP/STANDART

Then, I type simple code at http://mizugadro.mydns.jp/h/index.php?title=Testpdf&action=edit <pdf width="80px" height="100px">http://mizugadro.mydns.jp/MIZU/14bw.pdf</pdf> This code shows the preview, but the attempt to save hangs the brouser.

What do I wrong?

Reply to "Preview works, but the attempt to save shows empty page"
80.131.179.188 (talkcontribs)

HEllo,

with MW 1.18 I receive the following error after trying to save the document: Fatal error: Call to a member function isAllowed() on a non-object in /www/htdocs/*************/************/w/extensions/pdf_include.php on line 39


---

I just deleted this part and now its working fine

Reply to "Fatal error"
There are no older topics