Topic on Extension talk:PDF Include

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"