fpdf
PHP powered
home was ist fpdf? downloads & add-ons dokumentation faq forum impressum links kontakt
 

Downloads > Add-On

 
         
  DKMS - Registrieren Sie sich jetzt als Knochenmarkspender!      
         
 

View preferences

Informations

Author: Michel Poulain
License: Freeware

Description

This script allows to set some viewer preferences.

DisplayPreferences(string preferences)

Available options are (case-sensitive):
  • FullScreen: displays the document full-screen (escape key to restore the normal view)
  • HideMenubar: hides the menu
  • HideToolbar: hides all toolbars
  • HideWindowUI: hides all window elements (scroll bars, navigation controls, bookmarks...)
  • DisplayDocTitle: displays the title of the document instead of the file name (no effect inside web plug-in)
  • CenterWindow: centers the window (no effect inside web plug-in)
  • FitWindow: sizes the window (if it's not maximized) to fit the page (no effect inside web plug-in)

Source

<?php
define
('FPDF_FONTPATH', 'font/');
require(
'fpdf.php');

class
PDF extends FPDF {

var
$DisplayPreferences='';

function
DisplayPreferences($preferences) {
    $this->DisplayPreferences.=$preferences;
}

function
_putcatalog()
{
    parent::_putcatalog();
    if(is_int(strpos($this->DisplayPreferences, 'FullScreen')))
        $this->_out('/PageMode /FullScreen');
    if($this->DisplayPreferences) {
        $this->_out('/ViewerPreferences<<');
        if(is_int(strpos($this->DisplayPreferences, 'HideMenubar')))
            $this->_out('/HideMenubar true');
        if(is_int(strpos($this->DisplayPreferences, 'HideToolbar')))
            $this->_out('/HideToolbar true');
        if(is_int(strpos($this->DisplayPreferences, 'HideWindowUI')))
            $this->_out('/HideWindowUI true');
        if(is_int(strpos($this->DisplayPreferences, 'DisplayDocTitle')))
            $this->_out('/DisplayDocTitle true');
        if(is_int(strpos($this->DisplayPreferences, 'CenterWindow')))
            $this->_out('/CenterWindow true');
        if(is_int(strpos($this->DisplayPreferences, 'FitWindow')))
            $this->_out('/FitWindow true');
        $this->_out('>>');
    }
}
}

$pdf=new PDF();
$pdf->SetDisplayMode('fullpage');
$pdf->DisplayPreferences('HideMenubar, HideToolbar, HideWindowUI');
$pdf->AddPage();
$pdf->SetFont('Arial', '', 16);
$pdf->Write(6, 'Only the document should appear, no interface element.');
$pdf->Output();
?>

View the result here.

Download

ZIP | TGZ
 






 
         
         
 
 
fpdf.de © Copyright 2004-2006 carrib internet solutions - Beachten Sie bitte die Nutzungsbedingungen
Eine Verwendung der auf fpdf.de befindlichen Inhalte (Texte, Grafiken) ist nur mit Zustimmung des Betreibers zulässig.