Pressbooks\Modules\Export\Mpdf\Pdf::convert PHP Method

convert() public method

Book Assembly. Create $this->outputPath
public convert ( ) : boolean
return boolean
    function convert()
    {
        $filename = $this->timestampedFileName('._oss.pdf');
        $this->outputPath = $filename;
        $contents = $this->getOrderedBookContents();
        // set up mPDF
        if (!$this->hasDependencies()) {
            return false;
            // mPDF is not installed
        }
        require_once PB_MPDF_DIR . 'symbionts/mpdf/mpdf.php';
        $this->mpdf = new \mPDF('');
        $this->mpdf->SetAnchor2Bookmark(1);
        $this->mpdf->ignore_invalid_utf8 = true;
        if (1 == $this->options['mpdf_mirror_margins']) {
            $this->mpdf->mirrorMargins = true;
        }
        $this->mpdf->setBasePath(home_url('/'));
        $this->setCss();
        // all precontent page_options are suppressed and omitted from the TOC
        $this->addPreContent($contents);
        // all front matter page numbers are romanized
        $this->addFrontMatter($contents);
        // all parts, chapters, back-matter
        $this->addPartsandChapters($contents);
        $this->mpdf->Output($this->outputPath, 'F');
        // TODO trap errors
        return true;
    }