PHP Класс Pressbooks\Modules\Export\Mpdf\Pdf

Наследование: extends Pressbooks\Modules\Export\Export
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$bookMeta array Book Metadata
$bookTitle string Holds the title of the book being published
$exportStylePath string Fullpath to book CSS file.
$globalOptions array Global theme options, set by the user
$memoryNeeded integer mPDF uses a lot of memory, this the recommended minimum
$mpdf object MPDF Class
$numbered boolean Number the chapters
$options array mPDF theme options, set by the user

Открытые методы

Метод Описание
__construct ( )
addBookInfo ( ) Add book information page, otherwise known as title page
addCopyright ( ) Copyright information on a separate page
addCover ( ) Add the cover for the book.
addFrontMatter ( array $contents ) Adds front matter, resets the page numbering on the first loop, romanizes the numeric style
addFrontMatterByType ( string $type, array $contents ) Add front matter of a specific/special type
addPage ( array $page, array $page_options = [], boolean $display_footer = true, boolean $display_header = true ) : boolean Add a page to the pdf
addPartsAndChapters ( $contents )
addPreContent ( array $contents ) Add all specially handled content.
addToc ( ) Add the mpdf Table of Contents.
convert ( ) : boolean Book Assembly. Create $this->outputPath
fixAnnoyingCharacters ( string $html ) : string This function prevents mPDF from completely aborting the export routine, or replacing each non-breaking space with a '?' if ignore_invalid_utf8 is true. Important to leave this in.
getBookmarkEntry ( array $page ) : string Return the PDF bookmark entry for this page should be unique, using static variable for cheap cache
getFilteredContent ( string $content ) : string Cleans up html
getFooter ( boolean $display = true, string $content = '' ) : string Return formatted footers.
getHeader ( boolean $display = true, string $content = '' ) : string Return formatted headers.
getOrderedBookContents ( ) : array Restructures \Pressbooks\Book::getBookContents() into a format more useful for direct iteration, and tracks a nesting level for Bookmark and ToC entries.
getThemeCss ( object $theme ) : string Get current child and parent theme css files. Child themes only have one parent theme, and 99% of the time this is 'Luther' or /pressbooks-book/ whose stylesheet is named 'style.css'
getTocEntry ( string $page ) : string Return the Table of Contents entry for this page.
hasDependencies ( ) : boolean Dependency check.
setCss ( ) Add all css files
validate ( ) : boolean Check the sanity of $this->outputPath

Защищенные методы

Метод Описание
atLeastOneExport ( array $chapters ) : boolean Does array of chapters have at least one export? Recursive.
isPdf ( string $file ) : boolean Verify if file has 'application/pdf' mimeType.

Приватные методы

Метод Описание
stripUnwantedStyles ( array $styles ) : array Helper function to omit unwanted stylesheets in the output

Описание методов

__construct() публичный Метод

public __construct ( )

addBookInfo() публичный Метод

Add book information page, otherwise known as title page
public addBookInfo ( )

addCopyright() публичный Метод

Copyright information on a separate page
public addCopyright ( )

addCover() публичный Метод

Add the cover for the book.
public addCover ( )

addFrontMatter() публичный Метод

Adds front matter, resets the page numbering on the first loop, romanizes the numeric style
public addFrontMatter ( array $contents )
$contents array

addFrontMatterByType() публичный Метод

Add front matter of a specific/special type
public addFrontMatterByType ( string $type, array $contents )
$type string - special content placed ahead of everything else
$contents array - book contents

addPage() публичный Метод

Add a page to the pdf
public addPage ( array $page, array $page_options = [], boolean $display_footer = true, boolean $display_header = true ) : boolean
$page array - the content
$page_options array - numbering reset, style, suppress adding to TOC
$display_footer boolean turn on/off footer display
$display_header boolean turn on/off header display
Результат boolean

addPartsAndChapters() публичный Метод

public addPartsAndChapters ( $contents )

addPreContent() публичный Метод

Add all specially handled content.
public addPreContent ( array $contents )
$contents array - the book

addToc() публичный Метод

Note, the functionality of the TOC is limited: its behavior varies according mirrored margin settings, and will always generate blank pages after. http://mpdf1.com/forum/discussion/comment/6417#Comment_6417
public addToc ( )

atLeastOneExport() защищенный Метод

Does array of chapters have at least one export? Recursive.
protected atLeastOneExport ( array $chapters ) : boolean
$chapters array
Результат boolean

convert() публичный Метод

Book Assembly. Create $this->outputPath
public convert ( ) : boolean
Результат boolean

fixAnnoyingCharacters() публичный Метод

This function prevents mPDF from completely aborting the export routine, or replacing each non-breaking space with a '?' if ignore_invalid_utf8 is true. Important to leave this in.
public fixAnnoyingCharacters ( string $html ) : string
$html string
Результат string

getBookmarkEntry() публичный Метод

Return the PDF bookmark entry for this page should be unique, using static variable for cheap cache
public getBookmarkEntry ( array $page ) : string
$page array
Результат string

getFilteredContent() публичный Метод

Cleans up html
public getFilteredContent ( string $content ) : string
$content string
Результат string

getFooter() публичный Метод

Return formatted footers.
public getFooter ( boolean $display = true, string $content = '' ) : string
$display boolean
$content string The post type being added to the page.
Результат string

getHeader() публичный Метод

Return formatted headers.
public getHeader ( boolean $display = true, string $content = '' ) : string
$display boolean
$content string The post type being added to the page
Результат string

getOrderedBookContents() публичный Метод

Restructures \Pressbooks\Book::getBookContents() into a format more useful for direct iteration, and tracks a nesting level for Bookmark and ToC entries.
public getOrderedBookContents ( ) : array
Результат array

getThemeCss() публичный Метод

Get current child and parent theme css files. Child themes only have one parent theme, and 99% of the time this is 'Luther' or /pressbooks-book/ whose stylesheet is named 'style.css'
public getThemeCss ( object $theme ) : string
$theme object
Результат string $css

getTocEntry() публичный Метод

Return the Table of Contents entry for this page.
public getTocEntry ( string $page ) : string
$page string
Результат string

hasDependencies() статический публичный Метод

Dependency check.
static public hasDependencies ( ) : boolean
Результат boolean

isPdf() защищенный Метод

Verify if file has 'application/pdf' mimeType.
protected isPdf ( string $file ) : boolean
$file string
Результат boolean

setCss() публичный Метод

Add all css files
public setCss ( )

validate() публичный Метод

Check the sanity of $this->outputPath
public validate ( ) : boolean
Результат boolean

Описание свойств

$bookMeta защищенное свойство

Book Metadata
protected array $bookMeta
Результат array

$bookTitle защищенное свойство

Holds the title of the book being published
protected string $bookTitle
Результат string

$exportStylePath защищенное свойство

Fullpath to book CSS file.
protected string $exportStylePath
Результат string

$globalOptions защищенное свойство

Global theme options, set by the user
protected array $globalOptions
Результат array

$memoryNeeded защищенное свойство

mPDF uses a lot of memory, this the recommended minimum
См. также: http://mpdf1.com/manual/index.php?tid=408
protected int $memoryNeeded
Результат integer

$mpdf защищенное свойство

MPDF Class
protected object $mpdf
Результат object

$numbered защищенное свойство

Number the chapters
protected bool $numbered
Результат boolean

$options защищенное свойство

mPDF theme options, set by the user
protected array $options
Результат array