当前位置: 首页>>代码示例>>PHP>>正文


PHP Printer::setPageFormat方法代码示例

本文整理汇总了PHP中Printer::setPageFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP Printer::setPageFormat方法的具体用法?PHP Printer::setPageFormat怎么用?PHP Printer::setPageFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Printer的用法示例。


在下文中一共展示了Printer::setPageFormat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Soap_generatePDF

function Soap_generatePDF($userid)
{
    $adb = PearDatabase::getInstance();
    $current_user = vglobal('current_user');
    $_SESSION['type'] = "single";
    $user = new Users();
    $current_user = $user->retrieveCurrentUserInfoFromFile($userid);
    require_once "modules/OSSPdf/Print.php";
    require_once 'modules/OSSPdf/ModulesQueries.php';
    $module = $_REQUEST['usingmodule'];
    $id = $_REQUEST['recordid'];
    if (isset($_REQUEST['fromdetailview']) && $_REQUEST['fromdetailview'] == 'yes') {
        $document_list = array();
        if ($_REQUEST['return_name'] == "yes" || isset($_REQUEST['pdfajax'])) {
            $_REQUEST['template'] = explode(';', trim($_REQUEST['template'], ';'));
        }
        /* ----------------------------- */
        ##############
        ### PRZETWANIA ZMIENNYCH POCZATKOWYCH
        foreach ($_REQUEST['template'] as $templateid) {
            $_SESSION['template_to_perfom'] = $_REQUEST['template_to_perfom'] = $templateid;
            $pobierzdane = $adb->query("select osspdf_pdf_format,osspdf_pdf_orientation, filename, left_margin, right_margin, top_margin, bottom_margin from vtiger_osspdf where osspdfid = '{$templateid}'", true);
            $_REQUEST['pdf_format'] = $adb->query_result($pobierzdane, 0, "osspdf_pdf_format");
            $pdf_orientation_result = $adb->query_result($pobierzdane, 0, "osspdf_pdf_orientation");
            $_REQUEST['file_name'] = $adb->query_result($pobierzdane, 0, "filename");
            $_REQUEST['left'] = $adb->query_result($pobierzdane, 0, "left_margin");
            $_REQUEST['right'] = $adb->query_result($pobierzdane, 0, "right_margin");
            $_REQUEST['top'] = $adb->query_result($pobierzdane, 0, "top_margin");
            $_REQUEST['bottom'] = $adb->query_result($pobierzdane, 0, "bottom_margin");
            $_SESSION['top'] = $_REQUEST['top'];
            if ($pdf_orientation_result == 'Portrait') {
                $pdf_orientation = "P";
            } elseif ($pdf_orientation_result == 'Landscape') {
                $pdf_orientation = "L";
            }
            /* ----------------------------- */
            ##############
            ### INICJOWANIE PDFA, POBIERANIE DANYCH ETC
            $pdf = new Printer();
            $pdf->setPageFormat($_REQUEST['pdf_format'], $pdf_orientation);
            //$pdf->setPrintHeader(false);
            //$pdf->setPrintFooter(false);
            //	$pdf->SetHeaderData( '','','asd','' );
            $pdf->SetCompression(true);
            //$pdf->SetMargins( $left,$top, $right = -1,$keepmargins = false );
            if (isset($_REQUEST['left']) && $_REQUEST['left'] != '' && $_REQUEST['left'] != 0) {
                $pdf->SetLeftMargin($_REQUEST['left']);
            }
            if (isset($_REQUEST['right']) && $_REQUEST['right'] != '' && $_REQUEST['right'] != 0) {
                $pdf->SetRightMargin($_REQUEST['right']);
            }
            /*
                        if (isset($_REQUEST['top']) && $_REQUEST['top'] != '' && $_REQUEST['top'] != 0) {
                            $pdf->SetTopMargin($_REQUEST['top']);
                        }
            
                        if (isset($_REQUEST['bottom']) && $_REQUEST['bottom'] != '' && $_REQUEST['bottom'] != 0) {
                            $pdf->SetAutoPageBreak(true, $_REQUEST['bottom']);
                        }*/
            /* ----------------------------- */
            ################
            $date_var = $adb->formatDate(date('Y-m-d H:i:s'), true);
            $query = "insert into vtiger_audit_trial values(?,?,?,?,?,?)";
            $qparams = array($adb->getUniqueID('vtiger_audit_trial'), $current_user->id, $module, 'Generate PDF', $id, $date_var);
            $adb->pquery($query, $qparams, true);
            TakeContent($pdf, $module, $id, $site_URL);
            $filepath = $_REQUEST['file_name'] . '_' . $id . $templateid . '_' . date("YmdHis") . '.pdf';
            $pdf->Output($filepath, 'F');
            ###
            $pobierz = $adb->query("select * from vtiger_osspdf_config where conf_id = 'GENERALCONFIGURATION'", true);
            ###
            $data = array();
            for ($i = 0; $i < $adb->num_rows($pobierz); $i++) {
                $data[$adb->query_result($pobierz, $i, "name")] = $adb->query_result($pobierz, $i, "value");
            }
            $docid = 0;
            if ($data['ifsave'] == 'yes') {
                $document_id = CreateDocument($filepath, $data['ifattach'], $id, $module, $docid);
                $nr = $document_id + 1;
                $document_list[] = $nr . '_' . $filepath;
                $storage_path = decideFilePath();
                $pelnasciezka = $storage_path . $nr . '_' . $filepath;
            } else {
                $document_list[] = $filepath;
                $storage_path = decideFilePath();
                $pelnasciezka = $storage_path . $filepath;
            }
            chmod('storage', 0777);
            if ($_REQUEST['return_name'] != "yes" || $_REQUEST['return_name'] == "") {
                rename($filepath, $pelnasciezka);
            } else {
                $sciezka = "storage/" . $filepath;
                rename($filepath, $sciezka);
            }
            if ($data['ifattach'] == 'yes') {
                $sql = "INSERT INTO vtiger_senotesrel (`crmid`,`notesid`) VALUES ('{$id}','{$docid}')";
                $wykonaj = $adb->query($sql, true);
            }
        }
        if ($_REQUEST['return_name'] != "yes" || $_REQUEST['return_name'] == "") {
//.........这里部分代码省略.........
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:101,代码来源:PDFExport.php


注:本文中的Printer::setPageFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。