本文整理汇总了PHP中TCPDF::setViewerPreferences方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF::setViewerPreferences方法的具体用法?PHP TCPDF::setViewerPreferences怎么用?PHP TCPDF::setViewerPreferences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF
的用法示例。
在下文中一共展示了TCPDF::setViewerPreferences方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPdfOutput
public function testPdfOutput()
{
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 029');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 029', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
$pdf->setLanguageArray($this->langSettings);
// ---------------------------------------------------------
// set array for viewer preferences
$preferences = array('HideToolbar' => true, 'HideMenubar' => true, 'HideWindowUI' => true, 'FitWindow' => true, 'CenterWindow' => true, 'DisplayDocTitle' => true, 'NonFullScreenPageMode' => 'UseNone', 'ViewArea' => 'CropBox', 'ViewClip' => 'CropBox', 'PrintArea' => 'CropBox', 'PrintClip' => 'CropBox', 'PrintScaling' => 'AppDefault', 'Duplex' => 'DuplexFlipLongEdge', 'PickTrayByPDFSize' => true, 'PrintPageRange' => array(1, 1, 2, 3), 'NumCopies' => 2);
// Check the example n. 60 for advanced page settings
// set pdf viewer preferences
$pdf->setViewerPreferences($preferences);
// set font
$pdf->SetFont('times', '', 14);
// add a page
$pdf->AddPage();
// print a line
$pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 1', 1, 1, 'C');
$pdf->Ln(5);
$pdf->Write(0, 'You can use the setViewerPreferences() method to change viewer preferences.', '', 0, 'L', true, 0, false, false, 0);
// add a page
$pdf->AddPage();
// print a line
$pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 2', 0, 0, 'C');
// add a page
$pdf->AddPage();
// print a line
$pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 3', 0, 0, 'C');
$this->comparePdfs($pdf);
}
示例2:
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set display mode
$pdf->SetDisplayMode($zoom = 'fullpage', $layout = 'TwoColumnRight', $mode = 'UseNone');
// set pdf viewer preferences
$pdf->setViewerPreferences(array('Duplex' => 'DuplexFlipLongEdge'));
// set booklet mode
$pdf->SetBooklet(true, 10, 30);
// set core font
$pdf->SetFont('helvetica', '', 18);
// add a page (left page)
$pdf->AddPage();
$pdf->Write(0, 'Example of booklet mode', '', 0, 'L', true, 0, false, false, 0);
// print a line using Cell()
$pdf->Cell(0, 0, 'PAGE 1', 1, 1, 'C');
// add a page (right page)
$pdf->AddPage();
// print a line using Cell()
$pdf->Cell(0, 0, 'PAGE 2', 1, 1, 'C');
// add a page (left page)
$pdf->AddPage();
示例3: array
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
$preferences = array('HideToolbar' => true, 'HideMenubar' => true, 'HideWindowUI' => true, 'FitWindow' => true, 'CenterWindow' => true, 'DisplayDocTitle' => true, 'NonFullScreenPageMode' => 'UseNone', 'ViewArea' => 'CropBox', 'ViewClip' => 'CropBox', 'PrintArea' => 'CropBox', 'PrintClip' => 'CropBox', 'PrintScaling' => 'AppDefault', 'Duplex' => 'DuplexFlipLongEdge', 'PickTrayByPDFSize' => true, 'PrintPageRange' => array(1, 1, 2, 3), 'NumCopies' => 2);
// set pdf viewer preferences
$pdf->setViewerPreferences($preferences);
// set font
$pdf->SetFont('times', '', 14);
// add a page
$pdf->AddPage();
// print a line
$pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 1', 0, 0, 'C');
// add a page
$pdf->AddPage();
// print a line
$pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 2', 0, 0, 'C');
// add a page
$pdf->AddPage();
// print a line
$pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 3', 0, 0, 'C');
// ---------------------------------------------------------
示例4: loanPaperWorkPDF
function loanPaperWorkPDF()
{
$this->loan->LoanNumber = $this->loaninfo['LoanNumber'];
$this->Address();
$this->LoanAgentString();
$this->preptypes = array('Sheet' => 'sheet', 'Packet' => 'packet', 'Microscope slide' => 'microscope slide', 'Spirit' => 'spirit jar', 'Cibachrome' => 'cibachrome', 'Photograph of specimen' => 'photograph', 'Type' => 'type');
$this->LoanSummaryString();
$this->loanPrepHeader = array('LoanNumber' => $this->loan->LoanNumber, 'LoanAgent' => $this->LoanAgents, 'ShipmentDate' => $this->loaninfo['ShipmentDate'], 'LoanPrepSummary' => $this->LoanSummaryString());
$pdf = new TCPDF();
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Niels Klazenga');
$pdf->SetTitle('MEL Label');
$pdf->SetSubject('MEL Label');
//set margins
$pdf->SetMargins(25, 37, 25);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, 15);
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->setViewerPreferences(array('FitWindow' => true));
// set font
$pdf->SetFont('helvetica', '', 10);
// set cell padding
$pdf->setCellPaddings(0, 0, 0, 0);
// set cell margins
$pdf->setCellMargins(0, 0, 0, 0);
// start loan cover letter
$pdf->AddPage();
$image_file = base_url() . 'images/loans_paperwork_background.png';
$pdf->Image($image_file, 163, 0, 30, 0, 'PNG', '', 'T', true, 300, '', false, false, 0, false, false, false);
$pdf->MultiCell(120, 5, $this->loaninfo['ShipmentDate'], 0, 'L', 0, 1, 25, 15, true, false, true);
$pdf->MultiCell(120, 5, $this->loan->ShippedTo, 0, 'L', 0, 1, 25, 22, true, false, true);
$pdf->MultiCell(125, 5, '<span style="font-size:16pt;font-weight:bold">MEL loan ' . $this->loan->LoanNumber . '</span>', 0, 'L', 0, 1, 25, 65, true, false, true);
$pdf->MultiCell(130, 1, '<hr/>', 0, 'L', 0, 1, 22.5, $pdf->GetY() + 1, true, false, true);
$w = 30;
$y = $pdf->GetY() - 2;
$pdf->MultiCell($w, 5, 'For study by:', 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(120 - $w, 5, $this->LoanAgents, 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
$y = $pdf->GetY() + 1;
$pdf->MultiCell($w, 5, 'Description:', 0, 'L', 0, 1, 25, $y, true, false, true);
$description = $this->loaninfo['Description'];
if (strpos($description, '||')) {
$description = substr($description, 0, strpos($description, '||'));
}
$description = trim($description);
$pdf->MultiCell(120 - $w, 5, $description, 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
$y = $pdf->GetY() + 1;
$pdf->MultiCell($w, 5, 'Quantity:', 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(120 - $w, 5, $this->Quantity(), 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
$y = $pdf->GetY() + 1;
$pdf->MultiCell($w, 5, 'Due date:', 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(120 - $w, 5, $this->loaninfo['CurrentDueDate'], 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
$y = $pdf->GetY() + 1;
$pdf->MultiCell($w, 5, 'Shipment details:', 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(120 - $w, 5, $this->loaninfo['ShipmentMethod'], 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
if ($this->loaninfo['TrackingLabels']) {
$y = $pdf->GetY() + 1;
$pdf->MultiCell($w, 5, 'Tracking label(s):', 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(120 - $w, 5, $this->loaninfo['TrackingLabels'], 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
}
$y = $pdf->GetY() + 1;
$pdf->MultiCell($w, 5, 'Loan conditions:', 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(120 - $w, 5, 'See attached. ' . $this->loaninfo['SpecialConditions'], 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
$pdf->MultiCell(130, 5, '<hr/>', 0, 'L', 0, 1, 22.5, $pdf->GetY() + 1, true, false, true);
$paragraphs = array();
$paragraphs[] = <<<EOD
Please verify the contents of the loan against the attached specimen list and acknowledge
receipt by returning the yellow copy of this form. Any damage in transit should be noted
on the yellow form.
EOD;
$paragraphs[] = <<<EOD
This loan should be returned to MEL by the date shown above. An extension may be granted
on request.
EOD;
if (strstr($this->LoanAgents, ' and ')) {
$c = 'comply';
} else {
$c = 'complies';
}
$paragraphs[] = <<<EOD
Please ensure that {$this->LoanAgents} {$c} with the enclosed loan conditions.
EOD;
$paragraphs[] = <<<EOD
Electronic data for the specimens in this loan is available on request. For queries relating
to loans, exchange or donations, please email MEL at herbmel@rbg.vic.gov.au.
EOD;
foreach ($paragraphs as $para) {
$pdf->Multicell(125, 5, $para, 0, 'J', 0, 1, 25, $pdf->GetY() + 1, true, false, true);
}
$pdf->MultiCell(125, 5, $this->loaninfo['ShippedBy'] . ' on behalf of the Collections Manager', 0, 'L', 0, 1, 25, $pdf->GetY() + 8, true, false, true);
$y = 231;
//$image_file = base_url() . 'images/scissors.png';
//$pdf->Image($image_file, 22, $y-2.5, 5, 5, 'PNG', '', 'T', false, 300, '', false, false, 0, false, false, false);
//$pdf->MultiCell(127, 5, '<hr/>', 0, 'L', 0, 1, 25.5, $y, true, false, true);
$pdf->MultiCell(130, 5, '<hr/>', 0, 'L', 0, 1, 22.5, $y, true, false, true);
$y = $pdf->GetY() - 1;
$pdf->MultiCell(45, 5, 'Number of parcels: ' . $this->loaninfo['NumberOfPackages'], 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(75, 5, 'Number of specimens: ' . $this->Quantity(), 0, 'L', 0, 1, 75, $y, true, false, true);
//.........这里部分代码省略.........
示例5: invoicedownloadAction
//.........这里部分代码省略.........
}
$iterm_dtppcs[$k] = $tmp;
if ($hasTypeDesktopPublishingWin == 1) {
$subtotal = $subtotal + $iterm_dtppcs[$k]['total'];
}
}
//get iterm iterm_dtpmac
$repository = $entityManager->getRepository('User\\Entity\\Itermdtpmac');
$iterm_dtpmac = $repository->findBy(array('project' => $project));
$iterm_dtpmacs = array();
foreach ($iterm_dtpmac as $k => $v) {
$tmp = $v->getData();
if ($tmp['unit'] == 1) {
$tmp['unit'] = 'Day';
} else {
$tmp['unit'] = 'Half Day';
}
$iterm_dtpmacs[$k] = $tmp;
if ($hasTypeDesktopPublishingMac == 1) {
$subtotal = $subtotal + $iterm_dtpmacs[$k]['total'];
}
}
// Get Interpreting Price
$repository = $entityManager->getRepository('User\\Entity\\Iterminterpreting');
$iterm_interpreting = $repository->findBy(array('project' => $project));
$iterm_interpretings = array();
foreach ($iterm_interpreting as $k => $v) {
$tmp = $v->getData();
if ($tmp['unit'] == 1) {
$tmp['unit'] = 'Day';
} else {
if ($tmp['unit'] == 2) {
$tmp['unit'] = 'Half Day';
}
}
$iterm_interpretings[$k] = $tmp;
if ($hasTypeDesktopPublishingInterpreting == 1) {
$subtotal = $subtotal + $iterm_interpretings[$k]['total'];
}
}
// Get Itermengineering
$repository = $entityManager->getRepository('User\\Entity\\Itermengineering');
$iterm_engineering = $repository->findBy(array('project' => $project));
$iterm_engineerings = array();
foreach ($iterm_engineering as $k => $v) {
$tmp = $v->getData();
if ($tmp['unit'] == 1) {
$tmp['unit'] = 'Hour';
} else {
if ($tmp['unit'] == 2) {
$tmp['unit'] = 'Day';
} else {
if ($tmp['unit'] == 3) {
$tmp['unit'] = 'Month';
} else {
if ($tmp['unit'] == 4) {
$tmp['unit'] = 'Word';
} else {
if ($tmp['unit'] == 5) {
$tmp['unit'] = 'Graphic';
} else {
$tmp['unit'] = 'Page';
}
}
}
}
}
$iterm_engineerings[$k] = $tmp;
if ($hasTypeDesktopPublishingEngineer == 1) {
$subtotal = $subtotal + $iterm_engineerings[$k]['total'];
}
}
$view = $this->getServiceLocator()->get('Zend\\View\\Renderer\\RendererInterface');
$viewModel = new ViewModel();
$template = '/admin/project/invoicedownload';
$viewModel->setTemplate($template)->setVariables(array('id' => $id, 'lang_code' => $lang_code, 'project' => $project->getData(), 'companyinfo' => $companyinfo->getData(), 'bankinfo' => $bankinfo ? $bankinfo->getData() : null, 'hasTypeTranslationNoTM' => $hasTypeTranslationNoTM, 'hasTypeTranslationUseTM' => $hasTypeTranslationUseTM, 'hasTypeDesktopPublishingWin' => $hasTypeDesktopPublishingWin, 'hasTypeDesktopPublishingMac' => $hasTypeDesktopPublishingMac, 'hasTypeDesktopPublishingEngineer' => $hasTypeDesktopPublishingEngineer, 'hasTypeDesktopPublishingInterpreting' => $hasTypeDesktopPublishingInterpreting, 'iterm_translations' => $iterm_translations, 'iterm_translationtms' => $iterm_translationtms, 'iterm_dtppcs' => $iterm_dtppcs, 'iterm_dtpmacs' => $iterm_dtpmacs, 'iterm_interpretings' => $iterm_interpretings, 'iterm_engineerings' => $iterm_engineerings, 'serviceLevel' => $serviceLevel, 'subtotal' => $subtotal, 'invoices' => $invoices, 'dueDate' => $dueDate, 'invoiceDate' => $invoiceDate))->setTerminal(true);
//return $viewModel;
$content = $view->render($viewModel);
// set array for viewer preferences
$pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$font = new \TCPDF_FONTS();
//$fontx = $font->addTTFfont('public/fonts/STHeiti-Light.ttc');
//$pdf->SetFont($fontx, '', 12, '', false);
//$pdf->SetFont('microsoftyahei' , '', 12,'',false);
$pdf->SetFont('droidsansfallback', '', 7);
$pdf->setFontSubsetting(true);
$preferences = array('HideToolbar' => true, 'HideMenubar' => true, 'HideWindowUI' => true, 'FitWindow' => true, 'CenterWindow' => true, 'DisplayDocTitle' => true, 'NonFullScreenPageMode' => 'UseNone', 'ViewArea' => 'CropBox', 'ViewClip' => 'CropBox', 'PrintArea' => 'CropBox', 'PrintClip' => 'CropBox', 'PrintScaling' => 'AppDefault', 'Duplex' => 'DuplexFlipLongEdge', 'PickTrayByPDFSize' => true, 'PrintPageRange' => array(1, 1, 2, 3), 'NumCopies' => 2);
// set pdf viewer preferences
$pdf->setViewerPreferences($preferences);
// add a page
$pdf->AddPage();
// output the HTML content
$pdf->writeHTML($content, true, false, true, false, '');
$pdf->lastPage();
$name = "INV-" . $project_data['project_no'] . ".pdf";
ob_end_clean();
$pdf->Output($name, 'D');
//$pdf->Output("pdf-name.pdf", 'D');
exit;
}
示例6: btnPrint_Click
protected function btnPrint_Click()
{
if ($this->lstLabelStock->SelectedValue) {
$this->lstLabelStock->Warning = "";
set_time_limit(0);
// If the user clicked Cancel button
if ($_SESSION["intGeneratingStatus"] != -1) {
// If the user clicked outside of the modal dialog
if ($this->dlgPrintLabels->Visible && $this->dlgPrintLabels->Display) {
if ($this->intCurrentBarCodeLabel < count($this->strBarCodeArray)) {
array_push($this->strTablesBufferArray, $this->CreateTableByBarCodeArray());
$this->txtWarning->Text = "Please wait... PDF Generating: " . $_SESSION["intGeneratingStatus"] . "% Complete";
$this->txtWarning->Display = true;
$this->btnPrint->Enabled = true;
QApplication::ExecuteJavaScript("document.getElementById('" . $this->btnPrint->ControlId . "').click();");
} else {
include_once '../includes/php/tcpdf/config/lang/eng.php';
include_once '../includes/php/tcpdf/tcpdf.php';
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
// Set document information
$pdf->SetCreator("Tracmor");
$pdf->SetAuthor("Tracmor");
$pdf->SetTitle("Bar Codes");
// Set PDF viewer preferences
$arrPreferences = array('PrintScaling' => 'None');
$pdf->setViewerPreferences($arrPreferences);
// Disable header and footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// Disable auto page breaks
$pdf->SetAutoPageBreak(false);
// Set some language-dependent strings
$pdf->setLanguageArray($l);
// Set the color used for all drawing operations (lines, rectangles and cell borders).
$pdf->SetDrawColor(255);
// white
// Set Cell Padding
$pdf->SetCellPadding(0);
// Set Cell Spacing
$pdf->SetLineWidth(0);
// Initialize document
$pdf->AliasNbPages();
switch ($this->lstLabelStock->SelectedValue) {
case 1:
// Labels per row for Avery 6577 (5/8" x 3")
$pdf->SetFontSize(3);
$pdf->setCellHeightRatio(2.3);
// was 1.93
// Set margins
$pdf->SetMargins(12, 12, 12);
break;
case 2:
// Labels per row for Avery 6576 (1-1/4" x 1-3/4")
$pdf->SetFontSize(3);
$pdf->setCellHeightRatio(11.0);
// was 10.2
// Set margins
$pdf->SetMargins(10, 16, 10);
break;
default:
throw new QCallerException('Label Stock Not Provided');
break;
}
foreach ($this->strTablesBufferArray as $strTableBuffer) {
// add a page
$pdf->AddPage();
// output the HTML content
$pdf->writeHTML($strTableBuffer);
}
// Close and save PDF document
$pdf->Output(".." . __TRACMOR_TMP__ . "/" . $_SESSION['intUserAccountId'] . "_BarCodes.pdf", "F");
// Cleaning up
$this->btnCancel_Click();
// Uncheck all items but SelectAll checkbox
foreach ($this->GetAllControls() as $objControl) {
if (substr($objControl->ControlId, 0, 11) == 'chkSelected') {
$objControl->Checked = false;
}
}
$arrDataGridObjectNameId = $this->ctlSearchMenu->GetDataGridObjectNameId();
// Uncheck SelectAll checkbox
$this->ctlSearchMenu->{$arrDataGridObjectNameId}[0]->chkSelectAll->Checked = false;
// Open generated PDF in new window
QApplication::ExecuteJavaScript("window.open('.." . __TRACMOR_TMP__ . "/" . $_SESSION['intUserAccountId'] . "_BarCodes.pdf','Barcodes','resizeable,menubar=1,scrollbar=1,left=0,top=0,width=800,height=600');");
}
} else {
// Cleaning up
$this->btnCancel_Click();
}
}
} else {
$this->lstLabelStock->Warning = "Please select one";
$this->lstLabelStock->Enabled = true;
}
}
示例7: buildOutput
/**
*
*/
function buildOutput()
{
require_once Mage::getBaseDir() . '/lib/tcpdf/config/tcpdf_config.php';
require_once Mage::getBaseDir() . '/lib/tcpdf/config/lang/eng.php';
require_once Mage::getBaseDir() . '/lib/tcpdf/tcpdf.php';
$this->tmpType = 'pdf';
$printerMargin = 0;
$this->layoutInfo = array('leftMargin' => 0.15625, 'topMargin' => 0.5, 'rightMargin' => 0.15625, 'labelPadding' => 0.125);
if ($printerMargin > $this->layoutInfo['leftMargin']) {
$this->layoutInfo['labelPadding'] = $printerMargin - $this->layoutInfo['leftMargin'];
$this->layoutInfo['leftMargin'] = 0;
} else {
$this->layoutInfo['leftMargin'] -= $printerMargin;
}
if ($printerMargin > $this->layoutInfo['topMargin']) {
$this->layoutInfo['topMargin'] = 0;
} else {
$this->layoutInfo['topMargin'] -= $printerMargin;
}
if ($printerMargin > $this->layoutInfo['rightMargin']) {
$this->layoutInfo['rightMargin'] = 0;
} else {
$this->layoutInfo['rightMargin'] -= $printerMargin;
}
$this->layoutInfo['labelPage'] = false;
if ($this->labelsType == '5160' || $this->labelsType == '8160-s' || $this->labelsType == '8160-b' || $this->labelsType == 'barcodes') {
$this->layoutInfo['labelPage'] = '8160';
$this->layoutInfo['RowsPerPage'] = 10;
$this->layoutInfo['ColsPerRow'] = 3;
$this->layoutInfo['labelHeight'] = 1;
$this->layoutInfo['labelWidth'] = 2.625;
$this->layoutInfo['labelSpacerWidth'] = 0.15625;
$this->layoutInfo['barcodeMaxWidth'] = $this->layoutInfo['labelWidth'] - $this->layoutInfo['labelPadding'] * 2;
$this->layoutInfo['barcodeMaxHeight'] = $this->layoutInfo['labelHeight'] - $this->layoutInfo['labelPadding'] * 2;
$this->layoutInfo['barcodeMaxHeight'] -= 0.125;
//Allow For Text
if ($this->labelsType == '5160' || $this->labelsType == '8160-s') {
$buildfunction = 'buildLabel_Address';
} elseif ($this->labelsType == 'barcodes' || $this->labelsType == '8160-b') {
$buildfunction = 'buildLabel_Barcodes';
}
} elseif ($this->labelsType == '5164' || $this->labelsType == '8164') {
$this->layoutInfo['labelPage'] = '8164';
$this->layoutInfo['RowsPerPage'] = 3;
$this->layoutInfo['ColsPerRow'] = 2;
$this->layoutInfo['labelHeight'] = 3.3125;
$this->layoutInfo['labelWidth'] = 4;
$this->layoutInfo['labelSpacerWidth'] = 0.1875;
$this->layoutInfo['barcodeMaxWidth'] = $this->layoutInfo['labelWidth'] - $this->layoutInfo['labelPadding'] * 2;
$this->layoutInfo['barcodeMaxHeight'] = 1;
$this->layoutInfo['barcodeMaxHeight'] -= 0.125;
//Allow For Text
$buildfunction = 'buildLabel_ProductInfo';
}
if ($this->layoutInfo['labelPage'] !== false) {
$this->pdf = new TCPDF('P', 'in', array('8.5', '11.2'), true);
$this->pdf->SetCreator('Rental Extension');
$this->pdf->SetAuthor('Cristian Arcu');
$this->pdf->SetTitle('Rental Product Labels');
$this->pdf->SetSubject('Rental Product Labels');
$this->pdf->setViewerPreferences(array('PrintScaling' => 'None'));
$this->pdf->SetMargins($this->layoutInfo['leftMargin'], $this->layoutInfo['topMargin'], $this->layoutInfo['rightMargin'], true);
$this->pdf->SetCellPadding($this->layoutInfo['labelPadding']);
$this->pdf->setPrintHeader(false);
$this->pdf->setPrintFooter(false);
$this->pdf->SetAutoPageBreak(TRUE, 0.51);
$this->pdf->setImageScale(1);
//$this->pdf->setLanguageArray($l);
//$this->pdf->AliasNbPages();
$this->pdf->AddPage();
$this->pdf->SetFont("helvetica", "", 11);
$CurPage = 1;
$CurrentRow = 1;
$CurrentCol = 1;
$labelCnt = 0;
$lastLabel = sizeof($this->labels);
while ($CurrentRow <= $this->layoutInfo['RowsPerPage']) {
if (!isset($this->labels[$labelCnt])) {
break;
}
if ($CurPage == 1) {
if ($CurrentRow < $this->startLocation['row']) {
$blankRow = true;
} else {
$blankRow = false;
}
} else {
$blankRow = false;
}
while ($CurrentCol <= $this->layoutInfo['ColsPerRow']) {
//if ($CurPage == 1){
if (!isset($this->labels[$labelCnt])) {
break;
}
if ($blankRow === true || $CurrentCol < $this->startLocation['col']) {
$blankCol = true;
} else {
//.........这里部分代码省略.........
示例8: exchangePaperWorkPDF
function exchangePaperWorkPDF()
{
$this->loan->GiftNumber = $this->loaninfo['GiftNumber'];
$this->Address();
$this->LoanAgentString();
$this->preptypes = array('Duplicate' => 'duplicate', 'Seed duplicate' => 'seed duplicate', 'Silica gel sample' => 'silica gel sample', 'Shipping material' => 'shipping material', 'Type' => 'type');
$this->exchangeSummaryString();
$this->loanPrepHeader = array('ExchangeNumber' => $this->loan->GiftNumber, 'LoanAgent' => $this->LoanAgents, 'ShipmentDate' => $this->loaninfo['ShipmentDate'], 'LoanPrepSummary' => $this->exchangeSummaryString());
$pdf = new TCPDF();
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Niels Klazenga');
$pdf->SetTitle('MEL Label');
$pdf->SetSubject('MEL Label');
//set margins
$pdf->SetMargins(25, 37, 25);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, 15);
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->setViewerPreferences(array('FitWindow' => true));
// set font
$pdf->SetFont('helvetica', '', 10);
// set cell padding
$pdf->setCellPaddings(0, 0, 0, 0);
// set cell margins
$pdf->setCellMargins(0, 0, 0, 0);
// start loan cover letter
$pdf->AddPage();
$pdf->Image('images/mel-letterhead.jpg', 25, 0, '', '', '', '', 'T', true, 300, '', false, false, 0, false, false, false);
$pdf->MultiCell(120, 5, $this->loaninfo['ShipmentDate'], 0, 'L', 0, 1, 25, 15, true, false, true);
$pdf->MultiCell(120, 5, $this->loan->ShippedTo, 0, 'L', 0, 1, 25, 22, true, false, true);
$pdf->MultiCell(130, 5, '<span style="font-size:16pt;font-weight:bold">MEL ' . $this->loaninfo['ExchangeType'] . ' to ' . $this->loaninfo['Acronym'] . ' (MEL ref.' . $this->loan->GiftNumber . ')</span>', 0, 'L', 0, 1, 25, 65, true, false, true);
$pdf->MultiCell(130, 1, '<hr/>', 0, 'L', 0, 1, 22.5, $pdf->GetY() + 1, true, false, true);
$w = 30;
$y = $pdf->GetY() - 2;
if ($this->loaninfo['GiftAgents']) {
$pdf->MultiCell($w, 5, 'Attention:', 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(130 - $w, 5, $this->loaninfo['GiftAgents'], 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
$y = $pdf->GetY() + 1;
}
$pdf->MultiCell($w, 5, 'Description:', 0, 'L', 0, 1, 25, $y, true, false, true);
$description = $this->loaninfo['Description'];
if (strpos($description, '||')) {
$description = substr($description, 0, strpos($description, '||'));
}
$description = trim($description);
$pdf->MultiCell(120 - $w, 5, $description, 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
$y = $pdf->GetY() + 1;
$pdf->MultiCell($w, 5, 'Quantity:', 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(120 - $w, 5, $this->Quantity(), 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
if ($this->loaninfo['ExchangeType'] != 'shipping material') {
$y = $pdf->GetY() + 1;
$pdf->MultiCell($w, 5, 'Electronic data:', 0, 'L', 0, 1, 25, $y, true, false, true);
if ($this->LoanAgents) {
$when = $this->loaninfo['ShipmentDate'];
$what = $this->loaninfo['ExchangeFileName'];
$text = $what . ' emailed to ' . $this->LoanAgents;
} else {
$text = 'Available on request';
}
$pdf->MultiCell(120 - $w, 5, $text, 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
}
$y = $pdf->GetY() + 1;
$pdf->MultiCell($w, 5, 'Shipment details:', 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(120 - $w, 5, $this->loaninfo['ShipmentMethod'], 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
if ($this->loaninfo['TrackingLabels']) {
$y = $pdf->GetY() + 1;
$pdf->MultiCell($w, 5, 'Tracking label(s):', 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(120 - $w, 5, $this->loaninfo['TrackingLabels'], 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
}
$pdf->MultiCell(130, 5, '<hr/>', 0, 'L', 0, 1, 22.5, $pdf->GetY() + 1, true, false, true);
$paragraphs = array();
$paragraphs[] = <<<EOD
Please verify the contents of this consignment against the attached specimen list and acknowledge
receipt by returning the yellow copy of this form.
EOD;
$paragraphs[] = <<<EOD
For queries relating to loans, exchange or donations, please email MEL at herbmel@rbg.vic.gov.au.
EOD;
foreach ($paragraphs as $para) {
$pdf->Multicell(125, 5, $para, 0, 'J', 0, 1, 25, $pdf->GetY() + 1, true, false, true);
}
$pdf->MultiCell(125, 5, $this->loaninfo['ShippedBy'] . ' on behalf of the Collections Manager', 0, 'L', 0, 1, 25, $pdf->GetY() + 8, true, false, true);
$y = 231;
$pdf->MultiCell(130, 5, '<hr/>', 0, 'L', 0, 1, 22.5, $y, true, false, true);
$y = $pdf->GetY() - 1;
$pdf->MultiCell(45, 5, 'Number of parcels: ' . $this->loaninfo['NumberOfPackages'], 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(75, 5, 'Number of specimens: ' . $this->Quantity(), 0, 'L', 0, 1, 75, $y, true, false, true);
$pdf->MultiCell(125, 5, 'Material received in good condition.', 0, 'L', 0, 1, 25, $pdf->GetY() + 3, true, false, true);
$y = $pdf->GetY() + 3;
$pdf->MultiCell(25, 5, 'Comments: ', 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(105, 5, '<hr/>', 0, 'L', 0, 1, 45, $y + 4, true, false, true);
$pdf->MultiCell(125, 5, '<hr/>', 0, 'L', 0, 1, 25, $pdf->GetY() + 1, true, false, true);
$pdf->MultiCell(125, 5, '<hr/>', 0, 'L', 0, 1, 25, $pdf->GetY() + 1, true, false, true);
$y = $pdf->GetY() + 1;
$pdf->MultiCell(35, 5, 'Receiving officer:', 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(60, 5, '<hr/>', 0, 'L', 0, 1, 53, $y + 4, true, false, true);
$pdf->MultiCell(15, 5, 'Date: ', 0, 'L', 0, 1, 115, $y, true, false, true);
//.........这里部分代码省略.........
示例9: update
//.........这里部分代码省略.........
WHERE nf_fornecedor IN (SELECT nf_fornecedor FROM nota_fiscal WHERE tipo_nota = 1)
GROUP BY idproduto
) AS pn_sum_1 ON pn_sum_1.idp_sum_1 = idproduto');
$stm->bindValue(':data_inicio_1', $_SESSION['data_inicio']);
$stm->bindValue(':data_final_1', $_SESSION['data_fim']);
$stm->bindValue(':data_inicio_2', $_SESSION['data_inicio']);
$stm->bindValue(':data_final_2', $_SESSION['data_fim']);
$stm->execute();
$result = $stm->fetchAll(PDO::FETCH_ASSOC);
if (isset($result[0]['tipo'])) {
for ($i = 0; isset($result[$i]['tipo']); $i++) {
switch ($result[$i]['tipo']) {
case 1:
$result[$i]['tipo'] = 'UN';
break;
case 2:
$result[$i]['tipo'] = 'LT';
break;
case 3:
$result[$i]['tipo'] = 'PC';
break;
case 4:
$result[$i]['tipo'] = 'OT';
break;
}
}
}
if (isset($result[0]['data_1'])) {
for ($i = 0; isset($result[$i]['data_1']); $i++) {
$result[$i]['data_1'] = implode(preg_match("~\\/~", $result[$i]['data_1']) == 0 ? "/" : "-", array_reverse(explode(preg_match("~\\/~", $result[$i]['data_1']) == 0 ? "-" : "/", $result[$i]['data_1'])));
}
}
if (isset($result[0]['data_2'])) {
for ($i = 0; isset($result[$i]['data_2']); $i++) {
$result[$i]['data_2'] = implode(preg_match("~\\/~", $result[$i]['data_2']) == 0 ? "/" : "-", array_reverse(explode(preg_match("~\\/~", $result[$i]['data_2']) == 0 ? "-" : "/", $result[$i]['data_2'])));
}
}
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$data_inicio = explode('-', $_SESSION['data_inicio']);
$data_fim = explode('-', $_SESSION['data_fim']);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetTitle('Inventário Período: ' . $data_inicio[2] . '/' . $data_inicio[1] . '/' . $data_inicio[0] . ' até ' . $data_fim[2] . '/' . $data_fim[1] . '/' . $data_fim[0]);
// set default header data
$pdf->SetHeaderData('', '', 'Inventário de ' . $data_inicio[2] . '/' . $data_inicio[1] . '/' . $data_inicio[0] . ' até ' . $data_fim[2] . '/' . $data_fim[1] . '/' . $data_fim[0], '');
// $pdf->setFooterData($tc=array(0,64,0), $lc=array(0,64,128));
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
// $pdf->setLanguageArray($l);
// --------------------------------------------------------------------------------------------------------
// set array for viewer preferences
$preferences = array('HideToolbar' => true, 'HideMenubar' => true, 'HideWindowUI' => true, 'FitWindow' => true, 'CenterWindow' => true, 'DisplayDocTitle' => true, 'NonFullScreenPageMode' => 'UseNone', 'ViewArea' => 'CropBox', 'ViewClip' => 'CropBox', 'PrintArea' => 'CropBox', 'PrintClip' => 'CropBox', 'PrintScaling' => 'AppDefault', 'Duplex' => 'DuplexFlipLongEdge', 'PickTrayByPDFSize' => true, 'PrintPageRange' => array(1, 1, 2, 3), 'NumCopies' => 2);
// Check the example n. 60 for advanced page settings
// set pdf viewer preferences
$pdf->setViewerPreferences($preferences);
// set font
$pdf->SetFont('times', '', 14);
// add a page
$pdf->AddPage();
$pdf->Cell(0, 12, 'INVENTÁRIO', 1, 1, 'C');
$tbl = '<table cellspacing="0" cellpadding="1" border="1">
<tr>
<td width="159" align="center" style="font-weight:bold">Produto</td>
<td align="center" style="font-weight:bold">Quantidade</td>
<td align="center" style="font-weight:bold">Valor Unit.</td>
<td align="center" style="font-weight:bold">Tipo</td>
</tr>
</table>';
for ($i = 0; isset($result[$i]['idproduto']); $i++) {
$tbl .= '<table cellspacing="0" cellpadding="1" border="1">
<tr>
<td width="159" style="font-size:12pt">' . $result[$i]['produto'] . '</td>
<td align="center" style="font-size:12pt">' . $result[$i]['quantidade_nf'] . '</td>
<td align="center" style="font-size:12pt">' . $result[$i]['valor_unit_nf'] . '</td>
<td align="center" style="font-size:12pt">' . $result[$i]['tipo'] . '</td>
</tr>
</table>';
}
$pdf->writeHTML($tbl, true, false, false, false, '');
$pdf->Ln(5);
//Close and output PDF document
$pdf->Output('inventario periodo_' . $_SESSION['data_inicio'] . '_ate_' . $_SESSION['data_fim'] . '.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
echo json_encode(array("success" => true, "message" => "Inventário gerado com sucesso!"));
}
示例10: testPdfOutput
public function testPdfOutput()
{
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 040');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 040', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
$pdf->setLanguageArray($this->langSettings);
// ---------------------------------------------------------
// set display mode
$pdf->SetDisplayMode($zoom = 'fullpage', $layout = 'TwoColumnRight', $mode = 'UseNone');
// set pdf viewer preferences
$pdf->setViewerPreferences(array('Duplex' => 'DuplexFlipLongEdge'));
// set booklet mode
$pdf->SetBooklet(true, 10, 30);
// set core font
$pdf->SetFont('helvetica', '', 18);
// add a page (left page)
$pdf->AddPage();
$pdf->Write(0, 'Example of booklet mode', '', 0, 'L', true, 0, false, false, 0);
// print a line using Cell()
$pdf->Cell(0, 0, 'PAGE 1', 1, 1, 'C');
// add a page (right page)
$pdf->AddPage();
// print a line using Cell()
$pdf->Cell(0, 0, 'PAGE 2', 1, 1, 'C');
// add a page (left page)
$pdf->AddPage();
// print a line using Cell()
$pdf->Cell(0, 0, 'PAGE 3', 1, 1, 'C');
// add a page (right page)
$pdf->AddPage();
// print a line using Cell()
$pdf->Cell(0, 0, 'PAGE 4', 1, 1, 'C');
$this->comparePdfs($pdf);
}