mPDF Manual – mPDF functions

SetDisplayMode()

(mPDF >= 1.0)

SetDisplayMode – Specify the initial Display Mode when the PDF file is opened in Adobe Reader

Description

void SetDisplayMode ( mixed $zoom [, string $layout ])

Specify the initial Display Mode when the PDF file is opened in Adobe Reader. When the user opens the finished file in Adobe Reader, these values will determine the initial appearance and layout.

Parameters

$zoom

This parameter specifies the magnification (zoom) of the display when the document is opened.

Values (case-sensitive)

fullpage: Fit a whole page in the screen

fullwidth: Fit the width of the page in the screen

real: Display at real size

default: User’s default setting in Adobe Reader

INTEGER : Display at a percentage zoom (e.g. 90 will display at 90% zoom)

$layout

Specify the page layout to be used when the document is opened.

DEFAULT: “continuous”

Values (case-sensitive)

single: Display one page at a time

continuous: Display the pages in one column

two: Display the pages in two columns (first page determined by document direction (e.g. RTL))

twoleft: Display the pages in two columns, with the first page displayed on the left side (mPDF >= 5.2)

tworight: Display the pages in two columns, with the first page displayed on the right side (mPDF >= 5.2)

default: User’s default setting in Adobe Reader

Examples

Example #1

<?php

$mpdf = new mPDF();

$mpdf->SetDisplayMode('fullwidth');

$mpdf->WriteHTML('
Hallo World
');

$mpdf->Output('filename.pdf');

?>

Example #2

<?php

// Display at 90% zoom - note the 90 is a number not a string

$mpdf->SetDisplayMode(90);

// Display two pages side by side (book style)

$mpdf->SetDisplayMode('fullpage','two');

Changelog

VersionDescription
1.0 Function was added.
5.2 2 options for layout parameter added (twoleft and tworight)

See Also