public function pdf($content, $namafile, $paper_size = '', $orientation = 'P', $border = true, $title = '', $subject = '', $mode = 'D', $watermark = false)
 {
     $margin = 20;
     $namafile = preg_replace('/\\.pdf$/', '', $namafile);
     $mL = $mR = $mT = $mB = $margin;
     // $mB = $margin + 50;
     $mH = 0;
     $mF = 0;
     if (!$paper_size) {
         $paper_size = array(215, 330);
     }
     Yii::import('system.docotel.cms.extensions.mpdf.mPDF');
     $mpdf = new mPDF('', $paper_size, 0, '', $mL, $mR, $mT, $mB, $mH, $mF, $orientation);
     $mpdf->SetDefaultFont('Arial');
     $mpdf->SetProtection(array('print', 'print-highres'), '', md5(time()), 128);
     $mpdf->SetTitle($title);
     $mpdf->SetAuthor('Makarim & Taira');
     $mpdf->SetCreator('News');
     $mpdf->SetSubject($subject);
     $mpdf->h2toc = array('H4' => 0, 'H5' => 1);
     //$mpdf->setFooter('{PAGENO}');
     // $stylesheet = file_get_contents(Yii::app()->getBaseUrl(true).'/themes/flatlab/assets/css/bootstrap.min.css'); // external css
     // $mpdf->WriteHTML($stylesheet,1);
     // echo $content; exit;
     $mpdf->WriteHTML($content);
     $mpdf->Output($namafile . '.pdf', $mode);
     if ($mode === 'D' or $mode === 'I') {
         exit;
     }
 }
Esempio n. 2
0
*    PURPOSE.  See the GNU Affero General Public License for more details.      *
*                                                                               *
*    You should have received a copy of the GNU Affero General Public           *
*    License along with eLabFTW.  If not, see <http://www.gnu.org/licenses/>.   *
*                                                                               *
********************************************************************************/
require_once 'inc/common.php';
require_once ELAB_ROOT . 'inc/locale.php';
require_once ELAB_ROOT . 'vendor/autoload.php';
// Check id is valid and assign it to $id
if (isset($_GET['id']) && is_pos_int($_GET['id'])) {
    $id = $_GET['id'];
} else {
    die(_("The id parameter is not valid!"));
}
// check the type
if ($_GET['type'] === 'experiments' || $_GET['type'] === 'items') {
    $type = $_GET['type'];
} else {
    die(_("The type parameter is not valid."));
}
// do the pdf
$pdf = new \Elabftw\Elabftw\MakePdf($id, $type);
$mpdf = new mPDF();
$mpdf->SetAuthor($pdf->author);
$mpdf->SetTitle($pdf->title);
$mpdf->SetSubject('eLabFTW pdf');
$mpdf->SetKeywords($pdf->tags);
$mpdf->SetCreator('www.elabftw.net');
$mpdf->WriteHTML($pdf->content);
$mpdf->Output($pdf->getFileName(), 'I');
 public function setSubject($strSubject)
 {
     $this->objPdf->SetSubject($strSubject);
 }
Esempio n. 4
0
    /**
     * Create a PDF and export to defined path
     * @param $dir str directory of the source file to convert
     * @param $src str filename of the source file to convert
     * @param $path str path to export the resultant PDF to
     * @param $chapters array chapters to convert into a single PDF
     * @param $journalId int Id of the journal(imprint)
     * @param $args array arguments for the conversion (e.g. Description, cover image, etc)
     * @param $coverPath str path to export the front cover artwork to
     */
    function createPdf($dir = null, $src, $path, $chapters = array(), $journalId, $args = array(), $coverPath)
    {
        $mpdf = new mPDF('utf-8');
        $mpdf->useOddEven = 1;
        $htmlEncode = array('title', 'author');
        foreach ($htmlEncode as $encode) {
            $args[$encode] = htmlentities($args[$encode], ENT_QUOTES, "UTF-8");
        }
        isset($args['title']) ? $mpdf->SetTitle($args['title']) : $mpdf->SetTitle("No Title");
        isset($args['description']) ? $mpdf->SetSubject($args['description']) : $mpdf->SetSubject("No description");
        isset($args['author']) ? $mpdf->SetCreator($args['author']) : $mpdf->SetCreator("No author");
        $CBPPlatformDao =& DAORegistry::getDAO('CBPPlatformDAO');
        $imprintType = $CBPPlatformDao->getImprintType($journalId);
        $stylesheet = $CBPPlatformDao->getImprintStylesheet($journalId);
        $stylesheetContents = file_get_contents($this->stylesheetDir . "{$stylesheet}.css");
        $mpdf->WriteHTML($stylesheetContents, 1);
        $mpdf->WriteHTML($this->contentStart . '
			<htmlpagefooter name="myFooter1" style="display:none">
			<table width="100%" style="vertical-align: bottom; font-family: serif; font-size: 8pt; 
			    color: #000000; font-weight: bold; font-style: italic;"><tr>
			    <td width="33%" style="text-align: right; ">{PAGENO}</td>
			    </tr></table>
			</htmlpagefooter>
			<htmlpagefooter name="myFooter2" style="display:none">
			<table width="100%" style="vertical-align: bottom; font-family: serif; font-size: 8pt; 
			    color: #000000; font-weight: bold; font-style: italic;"><tr>
			    <td width="33%"><span style="font-weight: bold; font-style: italic;">{PAGENO}</span></td>
			    </tr></table>
			</htmlpagefooter>');
        $imagesize = getimagesize($args['cover']);
        if (substr($imagesize[1] / $imagesize[0], 0, strpos($imagesize[1] / $imagesize[0], '.') + 1 + 2) == 1.41 || substr($imagesize[1] / $imagesize[0], 0, strpos($imagesize[1] / $imagesize[0], '.') + 1 + 2) == 1.53) {
            $pdfContent .= '<div style="position: absolute; left:0; right: 0; top: 0; bottom: 0;"><img src="' . $args['cover'] . '" id="cover" /></div>';
        } else {
            $pdfContent .= "<div style='margin: 0 auto; width: 80%; text-align: center;'>";
            if (isset($args['title'])) {
                $pdfContent .= "<h1>" . $args['title'] . "</h1>";
            }
            if (isset($args['cover'])) {
                $pdfContent .= "<img src=\"" . $args['cover'] . "\" >";
            } else {
                $pdfContent .= "<br/>";
            }
            if (isset($args['author'])) {
                $pdfContent .= "<h2>" . $args['author'] . "</h2>";
            }
            $pdfContent .= "</div>";
        }
        $mpdf->WriteHTML($pdfContent);
        $mpdf->AddPage('', '', '', '', 'Off');
        $copyrightStatement = $CBPPlatformDao->getJournalCopyrightStatement($journalId);
        if (!empty($copyrightStatement)) {
            $copyrightStatement = reset($copyrightStatement);
            $mpdf->AddPage('', '', '', '', 'Off');
            $innerPageConent = "<div style='width: 90%; text-align: center; margin: 0 auto;'><p>" . $copyrightStatement . "</p></div>";
            $mpdf->WriteHTML($innerPageConent);
        }
        if (!empty($chapters)) {
            $mpdf->TOCpagebreakByArray(array('TOCusePaging' => true, 'TOCuseLinking' => true, 'toc_preHTML' => '<h1>Table of Contents</h1>', 'toc_postHTML' => '', 'resetpagenum' => 1, 'suppress' => 'true'));
            $chapterCount = 0;
            $authorBiographies = 0;
            foreach ($chapters as $chapter) {
                if (!isset($chapter['type']) && $chapter['type'] != "supp") {
                    $chapterCount++;
                } else {
                    if ($chapter['desc'] == "Author Biography") {
                        $authorBiographies++;
                    }
                    $suppChapters = true;
                }
            }
            for ($i = 0; $i < count($chapters); $i++) {
                $htmlEncode = array('name', 'author');
                foreach ($htmlEncode as $encode) {
                    $chapters[$i][$encode] = htmlentities($chapters[$i][$encode], ENT_QUOTES, "UTF-8");
                }
                $document = new TransformDoc();
                $document->setStrFile($chapters[$i]['src'], $chapters[$i]['dir']);
                $document->generateXHTML();
                //problem, here
                $document->validatorXHTML();
                if ($chapterCount == 1) {
                    $contentPreg = $this->stripTagsAddChapters($document->getStrXHTML());
                    $contentPreg = ltrim($contentPreg);
                    if (substr($contentPreg, 0, 13) == "<pagebreak />") {
                        $contentPreg = substr_replace($contentPreg, '', 0, 13);
                    }
                    $mpdf->addPage('', '', '', '', 'On');
                    $mpdf->PageNumSubstitutions[] = array('from' => $mpdf->page + 1, 'reset' => 1, 'type' => '1', 'suppress' => 'off');
                    $mpdf->WriteHTML("<div class='content'>", 2);
                    $mpdf->WriteHTML($contentPreg, 2);
                    if ($suppChapters == true) {
                        foreach ($chapters as $chapter) {
                            if (isset($chapter['type']) && $chapter['type'] == "supp") {
                                $document = new TransformDoc();
                                $document->setStrFile($chapter['src'], $chapter['dir']);
                                $document->generateXHTML();
                                $document->validatorXHTML();
                                if ($authorBiographies > 1) {
                                    $contentPreg = $this->stripTags($document->getStrXHTML());
                                    $mpdf->TOC_Entry($chapter['name']);
                                    $mpdf->WriteHTML("<pagebreak />" . $contentPreg, 2);
                                } else {
                                    $addAuthorBiographyToBack = true;
                                    $authorBiography = $this->stripTags($document->getStrXHTML());
                                }
                            }
                        }
                    }
                    break;
                } else {
                    $contentPreg = $this->stripTags($document->getStrXHTML());
                    $contentPreg = ltrim($contentPreg);
                    if (substr($contentPreg, 0, 13) == "<pagebreak />") {
                        $contentPreg = substr_replace($contentPreg, '', 0, 13);
                    }
                    if ($i != 0) {
                        $prepend = "<pagebreak />";
                    } else {
                        $mpdf->addPage('', 'E', '', '', 'On');
                        $mpdf->PageNumSubstitutions[] = array('from' => $mpdf->page + 1, 'reset' => 1, 'type' => '1', 'suppress' => 'off');
                        $mpdf->WriteHTML("<div class='content'>", 2);
                    }
                    if ($imprintType == "atomistic") {
                        $mpdf->WriteHTML($prepend . "<tocentry content='" . $chapters[$i]['name'] . "' level='0' />" . $contentPreg, 2);
                    } elseif ($imprintType == "collection") {
                        if ($chapters[$i]['description'] != "") {
                            $introduction = "<div class='submissionIntro'><h1>" . $chapters[$i]['author'] . "</h1>" . $this->stripTags($chapters[$i]['description'], true) . "</div><pagebreak /><tocentry content='" . $chapters[$i]['name'] . " by " . $chapters[$i]['author'] . "' level='0' />";
                        }
                        $mpdf->WriteHTML($prepend . $introduction . $contentPreg, 2);
                    }
                }
            }
            $mpdf->writeHTML("</div>");
            if (isset($args['description'])) {
                $mpdf->WriteHTML("<pagebreak page-selector='none' odd-footer-value = '' even-footer-value= '' /><pagebreak /><div style='width: 90%; text-align: center; margin: 0 auto;'><p>" . $this->stripTags($args['description'], true) . "</p></div>", 2);
                if ($addAuthorBiographyToBack == true) {
                    $backCoverContent .= "<div style='width: 90%; text-align: center; margin: 0 auto; margin-top: 10px;'><p>" . $authorBiography . "</p></div>";
                }
                $backCoverContent .= "<p style='width: 90%; text-align: center; margin: 0 auto;'><strong>Published " . date("F Y") . ", Scarborough, UK</strong></p>";
                $mpdf->WriteHTML($backCoverContent, 2);
            }
            $mpdf->WriteHTML("</body></html>");
            $pdfData = $mpdf->Output('', 'S');
            $pageCount = $mpdf->page;
            file_put_contents($path, $pdfData);
            if (file_exists($this->stylesheetDir . "{$stylesheet}-FC.css")) {
                $this->createCoverPdf($stylesheet, $pageCount, $args['cover'], $this->stripTags($args['description'], true), $addAuthorBiographyToBack, $authorBiography, $args['title'], $args['imprint'], $coverPath);
            }
            return true;
        } else {
            $document = new TransformDoc();
            $document->setStrFile($src, $dir);
            $document->generateXHTML();
            $document->validatorXHTML();
            $contentPreg = $this->stripTagsAddChapters($document->getStrXHTML());
            $contentPreg = ltrim($contentPreg);
            if (substr($contentPreg, 0, 13) == "<pagebreak />") {
                $contentPreg = substr_replace($contentPreg, '', 0, 13);
            }
            $mpdf->addPage('', 'E', '', '', 'On');
            $mpdf->PageNumSubstitutions[] = array('from' => $mpdf->page + 1, 'reset' => 1, 'type' => '1', 'suppress' => 'off');
            $mpdf->WriteHTML("<div class='content'>", 2);
            $mpdf->WriteHTML($contentPreg, 2);
            $mpdf->WriteHTML("</div></body></html>");
            $pdfData = $mpdf->Output('', 'S');
            file_put_contents($path, $pdfData);
            return true;
        }
    }
Esempio n. 5
0
 /**
  *  Save PHPExcel to file
  *
  *  @param     string     $pFilename   Name of the file to save as
  *  @throws    PHPExcel_Writer_Exception
  */
 public function save($pFilename = NULL)
 {
     $fileHandle = parent::prepareForSave($pFilename);
     //  Default PDF paper size
     $paperSize = 'LETTER';
     //    Letter    (8.5 in. by 11 in.)
     //  Check for paper size and page orientation
     if (is_null($this->getSheetIndex())) {
         $orientation = $this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
         $printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
         $printMargins = $this->_phpExcel->getSheet(0)->getPageMargins();
     } else {
         $orientation = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
         $printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
         $printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
     }
     $this->setOrientation($orientation);
     //  Override Page Orientation
     if (!is_null($this->getOrientation())) {
         $orientation = $this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT ? PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT : $this->getOrientation();
     }
     $orientation = strtoupper($orientation);
     //  Override Paper Size
     if (!is_null($this->getPaperSize())) {
         $printPaperSize = $this->getPaperSize();
     }
     if (isset(self::$_paperSizes[$printPaperSize])) {
         $paperSize = self::$_paperSizes[$printPaperSize];
     }
     //  Create PDF
     $pdf = new mPDF();
     $ortmp = $orientation;
     $pdf->_setPageSize(strtoupper($paperSize), $ortmp);
     $pdf->DefOrientation = $orientation;
     $pdf->AddPage($orientation);
     //  Document info
     $pdf->SetTitle($this->_phpExcel->getProperties()->getTitle());
     $pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator());
     $pdf->SetSubject($this->_phpExcel->getProperties()->getSubject());
     $pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords());
     $pdf->SetCreator($this->_phpExcel->getProperties()->getCreator());
     $pdf->WriteHTML($this->generateHTMLHeader(FALSE) . $this->generateSheetData() . $this->generateHTMLFooter());
     //  Write to file
     fwrite($fileHandle, $pdf->Output('', 'S'));
     parent::restoreStateAfterSave($fileHandle);
 }
Esempio n. 6
0
 /**
  * Set PDF Meta Subject.
  *
  * @param string $str  The page subject
  *
  * @return PdfInterface The current instance
  */
 public function setMetaSubject(string $str) : PdfInterface
 {
     $this->setProperty('metaSubject', $str);
     $this->mpdf->SetSubject($this->metaSubject);
     return $this;
 }
Esempio n. 7
0
include "../mpdf-6.1.2/mpdf.php";
$html_data = file_get_contents("body-ar.html");
$style_data = file_get_contents("style-ar.css");
// Create new PDF with font subsetting, 210mm wide, 297mm high
$mpdf = new mPDF('s', array(210, 297));
// Make it a double sided document with 4mm bleed
$mpdf->mirrorMargins = 1;
$mpdf->bleedMargin = 4;
// Set right to left text
$mpdf->SetDirectionality('rtl');
// Generate the table of contents from H3 elements
$mpdf->h2toc = array('H3' => 0);
// Write the stylesheet
$mpdf->WriteHTML($style_data, 1);
// The parameter 1 tells mPDF that this is CSS and not HTML
// Write the main text
$mpdf->WriteHTML($html_data, 2);
// Set the metadata
$mpdf->SetTitle("An Example Title");
$mpdf->SetAuthor("Cicero");
$mpdf->SetCreator("mPDF 6.1.2");
$mpdf->SetSubject("Lorem Ipsum");
$mpdf->SetKeywords("Lorem, Ipsum");
// Generate the PDF file
$mpdf->Output('arabic.pdf', 'F');
// Stop mPDF
exit;
?>


Esempio n. 8
0
<?php

# THIS ONE DOES NOT HAVE AddPageByArray ANY MORE :-)
include "../mpdf.php";
$html_data = file_get_contents("body.html");
$html = substr($html_data, 12, strlen($html_data) - 27);
$style_data = file_get_contents("style_current.css");
$frontmatter_data = file_get_contents("frontmatter_current.html");
// Create new PDF with font subsetting, 234mm wide, 297mm high
$mpdf = new mPDF('s', array(234, 297));
// Make it DOUBLE SIDED document with 4mm bleed
$mpdf->mirrorMargins = 1;
$mpdf->bleedMargin = 4;
$mpdf->WriteHTML($style_data, 1);
$mpdf->WriteHTML($frontmatter_data, 2);
$mpdf->WriteHTML($html, 2);
$mpdf->SetTitle("An Example Title");
$mpdf->SetAuthor("Aco");
$mpdf->SetCreator("Booktype 2.0 and mPDF 6.0");
$mpdf->SetSubject("History");
$mpdf->SetKeywords("Middle Ages, Jet Travel");
$mpdf->Output();
?>


Esempio n. 9
0
 /**
  * Generate the PDF file using the mPDF library.
  *
  * @param string $html
  *   contents of the template already with the node data.
  * @param string $filename
  *   name of the PDF file to be generated.
  */
 public function generate($html, $config, $filename = 'newPdfDocument')
 {
     // International Paper Sizes ( width x height).
     $paper_size = array('4A0' => array('w' => 1682, 'h' => 2378), '2A0' => array('w' => 1189, 'h' => 1682), 'A0' => array('w' => 841, 'h' => 1189), 'A1' => array('w' => 594, 'h' => 841), 'A2' => array('w' => 420, 'h' => 594), 'A3' => array('w' => 297, 'h' => 420), 'A4' => array('w' => 210, 'h' => 297), 'A5' => array('w' => 148, 'h' => 210), 'A6' => array('w' => 105, 'h' => 148), 'A7' => array('w' => 74, 'h' => 105), 'A8' => array('w' => 52, 'h' => 74), 'A9' => array('w' => 37, 'h' => 52), 'A10' => array('w' => 26, 'h' => 37), 'B0' => array('w' => 1000, 'h' => 1414), 'B1' => array('w' => 707, 'h' => 1000), 'B2' => array('w' => 500, 'h' => 707), 'B3' => array('w' => 353, 'h' => 500), 'B4' => array('w' => 250, 'h' => 353), 'B5' => array('w' => 176, 'h' => 250), 'B6' => array('w' => 125, 'h' => 176), 'B7' => array('w' => 88, 'h' => 125), 'B8' => array('w' => 62, 'h' => 88), 'B9' => array('w' => 44, 'h' => 62), 'B10' => array('w' => 31, 'h' => 44), 'C0' => array('w' => 917, 'h' => 1297), 'C1' => array('w' => 648, 'h' => 917), 'C2' => array('w' => 458, 'h' => 648), 'C3' => array('w' => 324, 'h' => 458), 'C4' => array('w' => 229, 'h' => 324), 'C5' => array('w' => 162, 'h' => 229), 'C6' => array('w' => 114, 'h' => 162), 'C7' => array('w' => 81, 'h' => 114), 'C8' => array('w' => 57, 'h' => 81), 'C9' => array('w' => 40, 'h' => 57), 'C10' => array('w' => 28, 'h' => 40), 'RA0' => array('w' => 860, 'h' => 1220), 'RA1' => array('w' => 610, 'h' => 860), 'RA2' => array('w' => 430, 'h' => 610), 'SRA0' => array('w' => 900, 'h' => 1280), 'SRA1' => array('w' => 640, 'h' => 900), 'SRA2' => array('w' => 450, 'h' => 640), 'Letter' => array('w' => 215.9, 'h' => 279.4), 'Legal' => array('w' => 215.9, 'h' => 355.6), 'Ledger' => array('w' => 279.4, 'h' => 431.8));
     $page = $config['page_type'];
     //conf
     $font_size = $config['font_size'];
     $font_style = $config['font_style'];
     // DEFAULT PDF margin Values.
     $margin_top = $config['margin_top'];
     //conf
     $margin_right = $config['margin_right'];
     $margin_bottom = $config['margin_bottom'];
     $margin_left = $config['margin_left'];
     $margin_header = $config['margin_header'];
     $margin_footer = $config['margin_footer'];
     // Creating Instance of mPDF Class Library.
     require_once 'Src/Modules/Pdf/Libs/mpdf60/mpdf.php';
     $mpdf = new \mPDF('', array($paper_size[$page]['w'], $paper_size[$page]['h']), $font_size, $font_style, $margin_left, $margin_right, $margin_top, $margin_bottom, $margin_header, $margin_footer);
     // set document DPI
     $mpdf->dpi = 96;
     // Set image DPI
     $mpdf->img_dpi = 96;
     // Enabling header option if available.
     $header = $config['header'];
     //string in conf
     if (isset($header) && $header != NULL) {
         //$header = token_replace($header);
         $mpdf->SetHTMLHeader($header);
     }
     // Enabling Footer option if available.
     $footer = $config['footer'];
     if (isset($footer) && $footer != NULL) {
         //$footer = token_replace($footer);
         $mpdf->SetHTMLFooter($footer);
     }
     // Setting Watermark Text to PDF.
     $watermark_option = 'text';
     //conf
     $watermark_opacity = $config['watermark_opacity'];
     // For watermark Text.
     if ($watermark_option == 'text') {
         $text = $config['watermark_text'];
         if (isset($text) && $text != NULL) {
             $mpdf->SetWatermarkText($text, $watermark_opacity);
             $mpdf->showWatermarkText = TRUE;
         }
     }
     // Setting Title to PDF.
     $title = $config['doc_title'];
     if (isset($title) && $title != NULL) {
         $mpdf->SetTitle($title);
     }
     // Setting Author to PDF.
     $author = $config['doc_author'];
     //conf
     if (isset($author) && $author != NULL) {
         $mpdf->SetAuthor($author);
     }
     // Setting Subject to PDF.
     $subject = $config['doc_subject'];
     if (isset($subject) && $subject != NULL) {
         $mpdf->SetSubject($subject);
     }
     // Setting creator to PDF.
     $creator = $config['doc_creator'];
     if (isset($creator) && $creator != NULL) {
         $mpdf->SetCreator($creator);
     }
     // Setting Password to PDF.
     $password = $config['password'];
     if (isset($password) && $password != NULL) {
         // Print and Copy is allowed.
         $mpdf->SetProtection(array('print', 'copy'), $password, $password);
     }
     // Setting CSS stylesheet to PDF.
     if (!empty($config['stylesheets'])) {
         $cssArr = explode('<br />', nl2br($config['stylesheets']));
         $cssArr = array_map('trim', $cssArr);
         $cssArr = array_filter($cssArr);
         foreach ($cssArr as $key => $stylesheet) {
             $stylesheet_content = NULL;
             if (isset($stylesheet) && $stylesheet != NULL) {
                 $stylesheet_content = file_get_contents($stylesheet);
                 $mpdf->WriteHTML($stylesheet_content, 1);
             }
         }
     }
     // Writing html content for pdf buffer.
     $mpdf->WriteHTML($html);
     return $mpdf->Output($filename . '.pdf', $config['save_option']);
 }
$individual = file_get_contents("individual-contributor-license-agreement.html");
$style_data = file_get_contents("contributor.css");
$entity = file_get_contents("entity-contributor-license-agreement.html");
// Create new PDF with font subsetting, 210mm wide, 297mm high
$mpdf = new mPDF('s', array(210, 297));
// Make it DOUBLE SIDED document
$mpdf->mirrorMargins = 1;
$mpdf->WriteHTML($style_data, 1);
$mpdf->WriteHTML($individual, 2);
$mpdf->SetTitle("Booktype GmbH Individual Contributor License Agreement");
$mpdf->SetAuthor("Booktype GmbH");
$mpdf->SetCreator("mPDF 6.0");
$mpdf->SetSubject("Booktype Contributor Agreements");
$mpdf->SetKeywords("Booktype, AGPL, GitHub");
$mpdf->Output("individual-contributor-license-agreement.pdf", 'F');
// Create new PDF with font subsetting, 210mm wide, 297mm high
$mpdf = new mPDF('s', array(210, 297));
// Make it DOUBLE SIDED document
$mpdf->mirrorMargins = 1;
$mpdf->WriteHTML($style_data, 1);
$mpdf->WriteHTML($entity, 2);
$mpdf->SetTitle("Booktype GmbH Entity Contributor License Agreement");
$mpdf->SetAuthor("Booktype GmbH");
$mpdf->SetCreator("mPDF 6.0");
$mpdf->SetSubject("Booktype Contributor Agreements");
$mpdf->SetKeywords("Booktype, AGPL, GitHub");
$mpdf->Output("entity-contributor-license-agreement.pdf", 'F');
?>


Esempio n. 11
-1
function pdf_echo($filename = "")
{
    global $__pdf_html, $__pdf_orientation, $__pdf_wm_text, $__pdf_wm_img, $__pdg_pgn_pos, $__pdf_title, $__pdf_subject, $__pdf_author, $__pdf_creator, $__pdf_keywords, $__pdf_wm_talpha, $__pdf_wm_font, $__pdf_wm_ialpha, $__pdf_pgn_text, $__pdf_pgn_pos, $__pdf_pgn_oalign, $__pdf_pgn_ealign, $__pdf_pgn_show, $__pdf_pgn_fcolor, $__pdf_pgn_ftype, $__pdf_pgn_fsize, $__pdf_pgn_fstyle, $__pdf_pgn_lstyle, $__pdf_pgn_lwidth, $__pdf_pgn_lcolor, $__pdf_pgmargin_l, $__pdf_pgmargin_r, $__pdf_pgmargin_t, $__pdf_pgmargin_b, $__pdf_pgmargin_h, $__pdf_pgmargin_f;
    require_once dirname(__FILE__) . "/__RES__/mpdf.php";
    $pdf = new mPDF("th");
    $pdf->useOddEven = 1;
    if ($__pdf_pgn_show) {
        $dv1 = "<div style=\"{$__pdf_pgn_fcolor};width:auto;text-align:";
        $dv2 = ";{$__pdf_pgn_ftype}{$__pdf_pgn_fsize}{$__pdf_pgn_fstyle}";
        $dv3 = "style:{$__pdf_pgn_lstyle};";
        $dv4 = "width:{$__pdf_pgn_lwidth};";
        $dv5 = "color:{$__pdf_pgn_lcolor};";
        $dv6 = "\">{$__pdf_pgn_text}</div>";
        if ($__pdf_pgn_pos == "TOP") {
            $align = $__pdf_pgn_oalign;
            $border = "border-bottom-";
            $pgh_o = "{$dv1}{$align}{$dv2}{$border}{$dv3}{$border}{$dv4}{$border}{$dv5}{$dv6}";
            $pdf->DefHTMLHeaderByName("ho", $pgh_o);
            $align = $__pdf_pgn_ealign;
            $pgh_e = "{$dv1}{$align}{$dv2}{$border}{$dv3}{$border}{$dv4}{$border}{$dv5}{$dv6}";
            $pdf->DefHTMLHeaderByName("he", $pgh_e);
            $pdf->AddPage($__pdf_orientation, '', '', '', '', $__pdf_pgmargin_l, $__pdf_pgmargin_r, $__pdf_pgmargin_t, $__pdf_pgmargin_b, $__pdf_pgmargin_h, $__pdf_pgmargin_f, 'html_ho', 'html_he', '', '', 1, 1, 0, 0);
        } else {
            if ($__pdf_pgn_pos == "BOTTOM") {
                $align = $__pdf_pgn_oalign;
                $border = "border-top-";
                $pgf_o = "{$dv1}{$align}{$dv2}{$border}{$dv3}{$border}{$dv4}{$border}{$dv5}{$dv6}";
                $pdf->DefHTMLFooterByName("fo", $pgf_o);
                $align = $__pdf_pgn_ealign;
                $pgf_e = "{$dv1}{$align}{$dv2}{$border}{$dv3}{$border}{$dv4}{$border}{$dv5}{$dv6}";
                $pdf->DefHTMLFooterByName("fe", $pgf_e);
                $pdf->AddPage($__pdf_orientation, '', '', '', '', $__pdf_pgmargin_l, $__pdf_pgmargin_r, $__pdf_pgmargin_t, $__pdf_pgmargin_b, $__pdf_pgmargin_h, $__pdf_pgmargin_f, '', '', 'html_fo', 'html_fe', 0, 0, 1, 1);
            }
        }
    } else {
        $pdf->AddPage($__pdf_orientation);
    }
    $pdf->SetTitle($__pdf_title);
    $pdf->SetAuthor($__pdf_author);
    $pdf->SetCreator($__pdf_creator);
    $pdf->SetSubject($__pdf_subject);
    $pdf->SetKeywords($__pdf_keywords);
    if ($__pdf_wm_text != "") {
        $pdf->SetWatermarkText($__pdf_wm_text, $__pdf_wm_talpha);
        $pdf->showWatermarkText = true;
        if ($__pdf_wm_font) {
            $pdf->watermark_font = $__pdf_wm_font;
        }
    }
    if (file_exists($__pdf_wm_img)) {
        $pdf->SetWatermarkImage($__pdf_wm_img, $__pdf_wm_ialpha);
        $pdf->showWatermarkImage = true;
    }
    $pdf->WriteHTML($__pdf_html);
    $pdf->Output($filename, $dest);
}