本文整理汇总了PHP中FPDI类的典型用法代码示例。如果您正苦于以下问题:PHP FPDI类的具体用法?PHP FPDI怎么用?PHP FPDI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FPDI类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: pdf_getInstance
/**
* Return a PDF instance object. We create a FPDI instance that instanciate TCPDF (or FPDF if MAIN_USE_FPDF is on)
* @param format Array(width,height)
* @param metric Unit of format ('mm')
* @param pagetype 'P' or 'l'
* @return PDF object
*/
function pdf_getInstance($format, $metric = 'mm', $pagetype = 'P')
{
global $conf;
// Protection et encryption du pdf
if ($conf->global->PDF_SECURITY_ENCRYPTION) {
/* Permission supported by TCPDF
- print : Print the document;
- modify : Modify the contents of the document by operations other than those controlled by 'fill-forms', 'extract' and 'assemble';
- copy : Copy or otherwise extract text and graphics from the document;
- annot-forms : Add or modify text annotations, fill in interactive form fields, and, if 'modify' is also set, create or modify interactive form fields (including signature fields);
- fill-forms : Fill in existing interactive form fields (including signature fields), even if 'annot-forms' is not specified;
- extract : Extract text and graphics (in support of accessibility to users with disabilities or for other purposes);
- assemble : Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if 'modify' is not set;
- print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality.
- owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions.
*/
if ($conf->global->MAIN_USE_FPDF) {
$pdf = new FPDI_Protection($pagetype, $metric, $format);
// For FPDF, we specify permission we want to open
$pdfrights = array('print');
} else {
$pdf = new FPDI($pagetype, $metric, $format);
// For TCPDF, we specify permission we want to block
$pdfrights = array('modify', 'copy');
}
$pdfuserpass = '';
// Mot de passe pour l'utilisateur final
$pdfownerpass = NULL;
// Mot de passe du proprietaire, cree aleatoirement si pas defini
$pdf->SetProtection($pdfrights, $pdfuserpass, $pdfownerpass);
} else {
$pdf = new FPDI($pagetype, $metric, $format);
}
return $pdf;
}
开发者ID:netors,项目名称:dolibarr,代码行数:42,代码来源:pdf.lib.php
示例2: createPDF
public function createPDF(FPDI $fpdi, $filename)
{
$fpdi->setSourceFile(__DIR__ . '/A.pdf');
$template = $fpdi->importPage(1);
$size = $fpdi->getTemplateSize($template);
$fpdi->AddPage('P', array($size['w'], $size['h']));
$fpdi->useTemplate($template);
$template = $fpdi->importPage(1);
$fpdi->AddPage('P', array($size['w'], $size['h']));
$fpdi->useTemplate($template);
file_put_contents($filename, $fpdi->Output('', 'S'));
}
开发者ID:mneuhaus,项目名称:fpdi,代码行数:12,代码来源:IntegrationTest.php
示例3: handle
/**
* Handle the event.
*
* @param BookPublished $event
* @return void
*/
public function handle(CreateChapter $event)
{
// create PDF
$fpdi = new \FPDI();
// count the book page
$pageCount = $fpdi->setSourceFile($this->uploadPath . $event->chapter->url);
// this one is used within the CreatePDF to include it within the template
Session::put('total_pages', $pageCount);
// update the database with total page count
$event->chapter->update(['total_pages' => $pageCount]);
$event->chapter->save();
}
开发者ID:uusa35,项目名称:ebook,代码行数:18,代码来源:CalculateChapterPage.php
示例4: testMerge
public function testMerge()
{
$fpdi = new FPDI();
$fpdi->setSourceFile(__DIR__ . '/A.pdf');
$template = $fpdi->importPage(1);
$size = $fpdi->getTemplateSize($template);
$fpdi->AddPage('P', array($size['w'], $size['h']));
$fpdi->useTemplate($template);
$template = $fpdi->importPage(1);
$fpdi->AddPage('P', array($size['w'], $size['h']));
$fpdi->useTemplate($template);
file_put_contents(__DIR__ . '/AA.pdf', $fpdi->Output('', 'S'));
}
开发者ID:CodeSomethingMX,项目名称:barney,代码行数:13,代码来源:IntegrationTest.php
示例5: split_pdf
function split_pdf($filename, $end_directory = false, $num = 1)
{
require_once 'fpdf/fpdf.php';
require_once 'fpdi/fpdi.php';
$end_directory = $end_directory ? $end_directory . date("d-m-Y__H-i-s") . "/" : './';
$new_path = preg_replace('/[\\/]+/', '/', $end_directory . '/' . substr($filename, 0, strrpos($filename, '/')));
if (!is_dir($new_path)) {
// Will make directories under end directory that don't exist
// Provided that end directory exists and has the right permissions
mkdir($new_path, 0777, true);
}
$pdf = new FPDI();
$pagecount = $pdf->setSourceFile($filename);
// How many pages?
$j = 0;
// Split each page into a new PDF
$new_pdf = new FPDI();
for ($i = 1; $i <= $pagecount; $i++) {
$new_pdf->AddPage();
$new_pdf->setSourceFile($filename);
$new_pdf->useTemplate($new_pdf->importPage($i));
if ($i != 1 && $i % $num == 0 || $num == 1) {
try {
$new_filename = $end_directory . str_replace('.pdf', '', $filename) . '_' . $i . ".pdf";
$new_pdf->Output($new_filename, "F");
$url = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . "/";
echo "File: <a href='" . $url . $new_filename . "'>" . $url . $new_filename . "</a><br />\n";
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
unset($new_pdf);
$new_pdf = new FPDI();
$j = 0;
}
$j++;
}
if ($j != 0) {
try {
$new_filename = $end_directory . str_replace('.pdf', '', $filename) . '_' . ($i - 1) . ".pdf";
$new_pdf->Output($new_filename, "F");
$url = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . "/";
echo "File: <a href='" . $url . $new_filename . "'>" . $url . $new_filename . "</a><br />\n";
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
}
}
开发者ID:stdex,项目名称:pdf_splitter,代码行数:47,代码来源:splitter.php
示例6: merge
/**
* Merges your provided PDFs and outputs to specified location.
* @param $outputmode
* @param $outputname
* @return PDF
*/
public function merge($outputmode = 'browser', $outputpath = 'newfile.pdf')
{
if (!isset($this->_files) || !is_array($this->_files)) {
throw new exception("No PDFs to merge.");
}
$fpdi = new FPDI();
$fpdi->setPrintHeader(FALSE);
$fpdi->setPrintFooter(FALSE);
//merger operations
foreach ($this->_files as $file) {
$filename = $file[0];
$filepages = $file[1];
$count = $fpdi->setSourceFile($filename);
//add the pages
if ($filepages == 'all') {
for ($i = 1; $i <= $count; $i++) {
$template = $fpdi->importPage($i);
$size = $fpdi->getTemplateSize($template);
$orientation = $size['w'] <= $size['h'] ? 'P' : 'L';
$fpdi->AddPage($orientation, array($size['w'], $size['h']));
$fpdi->useTemplate($template);
}
} else {
foreach ($filepages as $page) {
if (!($template = $fpdi->importPage($page))) {
throw new exception("Could not load page '{$page}' in PDF '{$filename}'. Check that the page exists.");
}
$size = $fpdi->getTemplateSize($template);
$orientation = $size['w'] <= $size['h'] ? 'P' : 'L';
$fpdi->AddPage($orientation, array($size['w'], $size['h']));
$fpdi->useTemplate($template);
}
}
}
//output operations
$mode = $this->_switchmode($outputmode);
if ($mode == 'S') {
return $fpdi->Output($outputpath, 'S');
} else {
if ($fpdi->Output($outputpath, $mode) == '') {
return true;
} else {
throw new exception("Error outputting PDF to '{$outputmode}'.");
return false;
}
}
}
开发者ID:icfr,项目名称:PDFMerger,代码行数:53,代码来源:PDFMerger.php
示例7: renderPDF
function renderPDF($id,$mode)
{
$pdf = new FPDI();
$db_catalogue_pages = new catalogue_pages;
$db_catalogue_pages->get_one_catalogue_pages($id);
$db_catalogue_pages->load();
$template_id = $db_catalogue_pages->get_pag_template();
$template = new catalogue_templates;
$template->getOne($template_id);
$template->load();
$pdf->addPage("Landscape","Letter");
$db_catalogue_objects = new catalogue_objects;
$db_catalogue_objects->get_all($id);
$pdf->SetFont('Arial','',14);
$pdf->Image("pdftemplates/".$template->get_tem_file().".jpg",0,0);
while($db_catalogue_objects->load())
{
$var = explode("_",$db_catalogue_objects->get_obj_var());
if($var[0] == "image")
{
if(file_exists($db_catalogue_objects->field->obj_image)) $pdf->Image($db_catalogue_objects->field->obj_image,($db_catalogue_objects->field->obj_posx*0.353),($db_catalogue_objects->field->obj_posy*0.353),"50","50");
}
$pdf->SetXY($db_catalogue_objects->field->obj_posx*0.353,($db_catalogue_objects->field->obj_posy*0.35) + 60);
$pdf->Write(5,$db_catalogue_objects->field->obj_text);
}
$db_catalogue_objects->close();
$db_catalogue_pages->close();
//if($mode=="I") $pdf->Output("page_".$id.".pdf", "I");
//else $pdf->Output("pages/page_".$id.".pdf", "F");
$pdf->Output("pages/page_".$id.".pdf", "F");
}
开发者ID:highestgoodlikewater,项目名称:scrumban,代码行数:40,代码来源:static.php
示例8: carl_merge_pdfs_fpdi
function carl_merge_pdfs_fpdi($pdffiles, $titles = array(), $metadata = array(), $metadata_encoding = 'UTF-8')
{
// FPDI throws some notices that break the PDF
$old_error = error_reporting(E_ERROR | E_WARNING | E_PARSE);
include_once INCLUDE_PATH . 'pdf/tcpdf/tcpdf.php';
include_once INCLUDE_PATH . 'pdf/fpdi/fpdi.php';
if (gettype($pdffiles) != 'array') {
trigger_error('$pdffiles must be an array');
return false;
}
if (!(class_exists('TCPDF') && class_exists('FPDI'))) {
trigger_error('You must have TCPDF/FPDI installed in order to run carl_merge_pdfs()');
return false;
}
if (empty($pdffiles)) {
return NULL;
}
$fpdi = new FPDI();
foreach ($pdffiles as $pdffile) {
if (file_exists($pdffile)) {
$count = $fpdi->setSourceFile($pdffile);
for ($i = 1; $i <= $count; $i++) {
$template = $fpdi->importPage($i);
$size = $fpdi->getTemplateSize($template);
$fpdi->AddPage('P', array($size['w'], $size['h']));
$fpdi->useTemplate($template, null, null, null, null, true);
if ($i == 1) {
if (isset($titles[$pdffile])) {
$bookmark = html_entity_decode($titles[$pdffile]);
} else {
$bookmark = $pdffile;
}
$fpdi->Bookmark($bookmark, 1, 0, '', '', array(0, 0, 0));
}
}
}
}
error_reporting($old_error);
return $fpdi->Output('ignored.pdf', 'S');
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:40,代码来源:pdf_utils.php
示例9: split_multi_pdf
function split_multi_pdf($arrayOfFiles)
{
$new_path = storage_path() . '/Macyspos';
if (!is_dir($new_path)) {
// Will make directories under end directory that don't exist
// Provided that end directory exists and has the right permissions
mkdir($new_path, 0777, true);
}
foreach ($arrayOfFiles as $file) {
$tempArrayOfPos = array();
$tempArrayOfPos = $this->getArrayOfPOs($file);
$pdf = new FPDI();
$pagecount = $pdf->setSourceFile($file);
// How many pages?
for ($i = 1; $i <= $pagecount; $i++) {
$singleItem = $tempArrayOfPos[$i - 1];
// dd($singleItem);
$tempPackingList = MacysPackingList::where('po', '=', $singleItem['PO'])->first();
if ($tempPackingList == null) {
$new_pdf = new FPDI();
$new_pdf->AddPage();
$new_pdf->setSourceFile($file);
$newPackingList = new MacysPackingList();
$newPackingList->po = trim($singleItem['PO']);
$newPackingList->shipterms = trim($singleItem['shipterms']);
$new_pdf->useTemplate($new_pdf->importPage($i));
try {
$new_filename = storage_path() . '/Macyspos/' . $singleItem['PO'] . '.pdf';
$newPackingList->pathToFile = $new_filename;
$new_pdf->Output($new_filename, "F");
$newPackingList->save();
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
}
}
}
}
开发者ID:rowej83,项目名称:ShipAdmin,代码行数:38,代码来源:MacysController.php
示例10: FPDI
break;
case 'legal':
$page_width = 14;
//in
$page_height = 8.5;
//in
break;
case 'letter':
default:
$page_width = 11;
//in
$page_height = 8.5;
//in
}
// initialize pdf
$pdf = new FPDI('L', 'in');
$pdf->SetAutoPageBreak(false);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetMargins(0.5, 0.5, 0.5, true);
//set default font
$pdf->SetFont('helvetica', '', 7);
//add new page
$pdf->AddPage('L', array($page_width, $page_height));
$chunk = 0;
//write the table column headers
$data_start = '<table cellpadding="0" cellspacing="0" border="0" width="100%">';
$data_end = '</table>';
$data_head = '<tr>';
$data_head .= '<td width="7.5%"><b>' . $text['label-direction'] . '</b></td>';
$data_head .= '<td width="15%"><b>' . $text['label-cid-name'] . '</b></td>';
开发者ID:urueedi,项目名称:fusionpbx,代码行数:31,代码来源:xml_cdr_export.php
示例11: save_design
public function save_design()
{
if ($this->input->post('mode') == 'edit') {
$this->db->delete('designs', array('id' => $this->input->post('design_id')));
}
$faceMacket = str_replace('http://klever.media/', '', $this->input->post('faceMacket'));
$backMacket = str_replace('http://klever.media/', '', $this->input->post('backMacket'));
$face = $this->input->post('face');
$back = $this->input->post('back');
// get all fonts
$query = $this->db->get('fonts');
$fonts = array();
foreach ($query->result() as $font) {
$fonts[$font->family] = $font->source;
}
// generate pdf face template name and preview name
$face_pdf = 'uploads/redactor/face_' . md5(microtime(true)) . '.pdf';
$face_preview = 'uploads/redactor/face_' . md5(microtime(true)) . '.jpg';
// convert face image to pdf
$img = new Imagick($faceMacket);
$img->setresolution(300, 300);
$img->setcolorspace(Imagick::COLORSPACE_CMYK);
$img->resizeimage(1076, 720, Imagick::FILTER_LANCZOS, 1);
$img->setimageformat('pdf');
$img->writeimage($face_pdf);
// include TCPDF ana FPDI
include_once APPPATH . 'libraries/tcpdf/tcpdf.php';
include_once APPPATH . 'libraries/tcpdf/fpdi.php';
include_once APPPATH . 'libraries/tcpdf/include/tcpdf_fonts.php';
$fontMaker = new TCPDF_FONTS();
// создаём лист
$pdf = new FPDI('L', 'mm', array(91, 61), true, 'UTF-8', false);
$pdf->SetMargins(0, 0, 0, true);
$pdf->AddPage('L');
// загрузим ранее сохранённый шаблон
$pdf->setSourceFile($face_pdf);
$pdf->SetMargins(0, 0, 0, true);
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx, null, null, 0, 0, true);
// установим опции для pdf
$pdf->setCellHeightRatio(1);
$pdf->setCellPaddings(0, 0, 0, 0);
$pdf->setCellMargins(0, 0, 0, 0);
$pdf->SetAutoPageBreak(false, 0);
$pdf->SetPrintHeader(false);
$pdf->SetPrintFooter(false);
if (!empty($face)) {
// отрисуем сначала изображения лица
foreach ($face as $item) {
if ($item['type'] == 'image') {
$pdf->Image($_SERVER['DOCUMENT_ROOT'] . '/' . str_replace('http://klever.media/', '', $item['content']), $this->px_to_mm($item['left']), $this->px_to_mm($item['top']), $this->px_to_mm($item['width']), '', '', '', '', false, 300);
}
}
// потом текст на лице
foreach ($face as $item) {
if ($item['type'] == 'text') {
$cmyk = $this->rgbToCmyk($item['color']);
$pdf->SetTextColor($cmyk['c'] * 100, $cmyk['m'] * 100, $cmyk['y'] * 100, $cmyk['k'] * 100);
// set font
$tcpdfFont = $fontMaker->addTTFfont(realpath('fonts/redactor/' . $fonts[$item['font']]));
$pdf->SetFont($tcpdfFont, '', $item['size'] / 2, '', 'false');
$pdf->Text($this->px_to_mm($item['left']), $this->px_to_mm($item['top']), $item['content'], false, false, true, 0, 0, 'L', false, '', 0, false, 'T', 'L', false);
}
}
}
// сохраним пдф лица
$pdf->Output($_SERVER['DOCUMENT_ROOT'] . '/' . $face_pdf, 'F');
// сделаем превью для пользователя
$im = new Imagick();
$im->setResolution(300, 300);
$im->readimage($face_pdf . '[0]');
$im->flattenimages();
$im->setImageFormat('jpg');
$im->resizeimage(1076, 720, Imagick::FILTER_LANCZOS, 1);
$im->writeImage($face_preview);
$im->clear();
$im->destroy();
//exec('$ convert ' . $_SERVER['DOCUMENT_ROOT'] . '/' . $face_pdf . ' ' . $_SERVER['DOCUMENT_ROOT'] . '/' . $face_preview);
// есть ли оборот
if (!empty($backMacket)) {
// generate pdf back template name and preview name
$back_pdf = 'uploads/redactor/back_' . md5(microtime(true)) . '.pdf';
$back_preview = 'uploads/redactor/back_' . md5(microtime(true)) . '.jpg';
// convert back image to pdf
$img = new Imagick($backMacket);
$img->setresolution(300, 300);
$img->setcolorspace(Imagick::COLORSPACE_CMYK);
$img->resizeimage(1076, 720, Imagick::FILTER_LANCZOS, 1);
$img->setimageformat('pdf');
$img->writeimage($back_pdf);
// создаём лист
$pdf = new FPDI('L', 'mm', array(91, 61), true, 'UTF-8', false);
$pdf->AddPage('L');
// загрузим ранее сохранённый шаблон
$pdf->setSourceFile($_SERVER['DOCUMENT_ROOT'] . '/' . $back_pdf);
$pdf->SetMargins(0, 0, 0, true);
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx, null, null, 0, 0, true);
// установим опции для pdf
$pdf->SetMargins(0, 0, 0, true);
//.........这里部分代码省略.........
开发者ID:n0rp3d,项目名称:klever,代码行数:101,代码来源:admin.php
示例12: save_ticket_data
/**
* Save post metadata when a post is saved.
*
* @param int $post_id The post ID.
* @param post $post The post object.
* @param bool $update Whether this is an existing post being updated or not.
*/
public function save_ticket_data($post_id, $post, $update)
{
global $product;
/*
* In production code, $slug should be set only once in the plugin,
* preferably as a class property, rather than in each function that needs it.
*/
$slug = 'product';
// If this isn't a 'product' post, don't update it.
if ($slug != $post->post_type) {
return;
}
$getprod = get_product($post_id);
//If it's not a ticket return aswell
if ($getprod->product_type != 'ticket') {
return;
}
$getmeta = get_post_meta($post_id, '_downloadable_files', true);
//Traverse the return array since we don't know the first key
foreach ($getmeta as $key => $value) {
$url = $value['file'];
}
$path = $_SERVER['DOCUMENT_ROOT'] . parse_url($url, PHP_URL_PATH);
//To get the dir, use: dirname($path)
require_once 'fpdf/fpdf.php';
require_once 'fpdi/fpdi.php';
//Get stuff to add to pdf :D
$getmetaall = get_post_meta($post_id);
$getcontent = get_post_meta($post_id, 'frs_woo_product_tabs', true);
$i = 1;
$pdf = new FPDI();
// $pdf->AddPage();
//Set the source PDF file
//$pagecount = $pdf->setSourceFile($path);
//Import the first page of the file
//$tpl = $pdf->importPage($i);
//Use this page as template
//$pdf->useTemplate($tpl);
#Print Hello World at the bottom of the page
//Clear all
$pdf->SetFillColor(255, 255, 255);
$pdf->SetY(1);
$pdf->SetFont('Arial', 'I', 19);
$pdf->Cell(0, $pdf->h - 2, ' ', 0, 0, 'C', true);
//Go to 1.5 cm from bottom
$pdf->SetY(1);
//Select Arial italic 8
$pdf->SetFont('Arial', 'I', 19);
//Print centered cell with a text in it
$pdf->Cell(0, 10, $post->post_title, 0, 0, 'C');
/*
$pdf->SetY(10);
$pdf->SetFont('Arial','I',16);
$pdf->Cell(0, 10, gmdate("Y-m-d", $getmetaall["wpcf-event-start-date"][0]), 0, 0, 'C');
$pdf->SetY(20);
$pdf->SetFont('Arial','I',16);
$pdf->Cell(0, 10, 'Start time: ' . $getmetaall["wpcf-event-start-time"][0], 0, 0, 'C');
$pdf->SetY(27);
$pdf->SetFont('Arial','I',16);
$pdf->Cell(0, 10, 'End time: ' . $getmetaall["wpcf-event-end-time"][0], 0, 0, 'C');
$pdf->SetY(1);
$pdf->Image('http://dancenergy.zenutech.com/production/wp-content/uploads/2014/06/Logo.png', 5, 0, 33.78);
*/
//Select Arial italic 8
$pdf->SetY(20);
$pdf->SetFont('Arial', 'I', 15);
$pdf->WriteHTML($getcontent[0]['ticket_content']);
$pdf->Output($path, "F");
/*
echo "<pre>";
var_dump( $getmetaall );
echo "</pre>";
*/
return;
}
开发者ID:jvcanote,项目名称:woocommerce_simple_tickets,代码行数:87,代码来源:Class_update_ticket.php
示例13: array
$curs = null;
$params = array(":nrosolicitud" => $numeroSolicitud);
$sql = "BEGIN art.cotizacion.get_valor_carta(:nrosolicitud, :data); END;";
$stmt = DBExecSP($conn, $curs, $sql, $params);
$rowValorFinal = DBGetSP($curs, false);
$cuotaInicial = $rowValorFinal["COSTOMENSUAL"];
$porcentajeVariable = $rowValorFinal["PORCVARIABLE"];
$sumaFija = $rowValorFinal["SUMAFIJA"];
}
if ($autoPrint)
$pdf = new PDF_AutoPrint();
else
$pdf = new FPDI();
$pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"]."/modules/solicitud_afiliacion/templates/solicitud_afiliacion.pdf");
//Página 1..
$pdf->AddPage();
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx);
$pdf->SetFont("Arial", "", 8);
if (($row2["SA_MOTIVOALTA"] == "03") or ($row2["SA_MOTIVOALTA"] == "04") or ($row2["SA_MOTIVOALTA"] == "05")) {
$pdf->Ln(6);
$pdf->Cell(-0.4);
$pdf->Cell(0, 0, "X");
$pdf->Ln(8.2);
开发者ID:javierlov,项目名称:FuentesWeb,代码行数:30,代码来源:reporte_solicitud_afiliacion.php
示例14: DBGetSP
$rowValorFinal = DBGetSP($curs, false);
// Hago el query de abajo para formatear 2 campos que salian mal..
$sql = "SELECT TO_CHAR(".str_replace(array("$", ","), array("", "."), $rowValorFinal["COSTOANUAL"]).", '$9,999,999,990.00') costoanual, TO_CHAR(".str_replace(array("$", ","), array("", "."), $rowValorFinal["COSTOCAPITAS"]).", '$9,999,999,990.00') costocapitas FROM DUAL";
$stmt = DBExecSql($conn, $sql, array());
$row2 = DBGetQuery($stmt, 1, false);
$row["CUOTAANUAL"] = $row2["COSTOANUAL"];
$row["CUOTAMENSUAL"] = $rowValorFinal["COSTOMENSUAL"];
$row["CUOTATRABAJADOR"] = $row2["COSTOCAPITAS"];
$row["PORCENTAJEVARIABLETRABAJADOR"] = $rowValorFinal["PORCVARIABLE"];
$row["SUMAFIJATRABAJADOR"] = $rowValorFinal["SUMAFIJA"];
}
$pdf = new FPDI();
// Dibujo la hoja de análisis comparativo de costos..
if ($row["DIFPORCENTUALSINFORMATO"] < -5) {
// INICIO - Generación de gráfico que va incrustado en el reporte..
try {
$_REQUEST["actual"] = $row["PRIMAANUALCOMPSINFORMATO"];
$_REQUEST["archivo"] = "W_".$_SESSION["usuario"]."_".date("YmdHis").".png";
$_REQUEST["provart"] = $row["PRIMAANUALSINFORMATO"];
require_once($_SERVER["DOCUMENT_ROOT"]."/modules/solicitud_cotizacion/generar_grafico_comparativo.php");
$graficoOk = true;
}
catch (Exception $e) {
$graficoOk = false;
}
开发者ID:javierlov,项目名称:FuentesWeb,代码行数:31,代码来源:generar_carta_intencion.php
示例15: mysql_query
$sql = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($sql) == 1) {
$row = mysql_fetch_assoc($sql);
} else {
print "<meta http-equiv=\"Refresh\" content=\"0;URL=MainPage.php\">";
exit;
}
}
if ($_SESSION['status'] == "admin") {
$query = "SELECT * FROM `abiturients` WHERE `ab_id` = '" . $id . "'";
$sql = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($sql) == 1) {
$row = mysql_fetch_assoc($sql);
}
}
$pdf = new FPDI();
$pageCount = $pdf->setSourceFile("img/ugoda2014.pdf");
$pageNo = 1;
$templateId = $pdf->importPage($pageNo);
$size = $pdf->getTemplateSize($templateId);
$pdf->AddPage('P', array($size['w'], $size['h']));
$pdf->useTemplate($templateId);
$pdf->AddFont('Times', '', 'times.php');
$pdf->SetFont('Times', '', 10);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFontSize(11);
$pdf->SetXY(35, 61);
$pdf->Write(5, $row['lastname'] . " " . $row['firstname'] . " " . $row['patronymic']);
$pdf->SetXY(55, 70);
if ($row['type'] == "mag") {
$pdf->Write(5, "6-й курс, " . $row['faculty']);
开发者ID:AlexSlovinskiy,项目名称:magistr.zu.edu.ua,代码行数:31,代码来源:PatternGenAgreement.php
示例16: uuid
}
//add file to array
$tif_files[] = $dir_fax_temp . '/' . $fax_name . '.tif';
}
//if
}
//foreach
// unique id for this fax
$fax_instance_uuid = uuid();
//generate cover page, merge with pdf
if ($fax_subject != '' || $fax_message != '') {
//load pdf libraries
require_once "resources/tcpdf/tcpdf.php";
require_once "resources/fpdi/fpdi.php";
// initialize pdf
$pdf = new FPDI('P', 'in');
$pdf->SetAutoPageBreak(false);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetMargins(0, 0, 0, true);
if (strlen($fax_cover_font) > 0) {
if (substr($fax_cover_font, -4) == '.ttf') {
$pdf_font = TCPDF_FONTS::addTTFfont($fax_cover_font);
} else {
$pdf_font = $fax_cover_font;
}
}
if (!$pdf_font) {
$pdf_font = 'times';
}
//add blank page
开发者ID:bdstephenson,项目名称:fusionpbx,代码行数:31,代码来源:fax_send.php
示例17: FPDF
($recipient['form_type']==1 ? $recipient[1]['country'] : $recipient[2]['country']).", ".
($recipient['form_type']==1 ? $recipient[1]['city'] : $recipient[2]['city']).", ".
($recipient['form_type']==1 ? $recipient[1]['address'] : $recipient[2]['address']);
$pdf = new FPDF('L', 'mm', 'A4');
$pdf->AddFont('TimesNewRomanPSMT','','5f37f1915715e014ee2254b95c0b6cab_times.php');
$pdf->SetFont('TimesNewRomanPSMT','',12);
$pdf->SetTextColor(0,0,0);
$pdf->AddPage('L');
$pdf->SetXY(197,145);
$pdf->SetDrawColor(50,60,100);
$pdf->MultiCell(65,6,"Кому: ".html_entity_decode($user_name)."\nКуда: ".html_entity_decode($address),0,'L');
$pdf->Output($pdf_f_name, "F");
*/
$pdf_name = '/tmp/' . uniqid() . '.pdf';
$pdf = new FPDI();
$pagecount = 1;
/*
$pagecount = $pdf->setSourceFile($pdf_f_name);
$tplidx = $pdf->importPage($pagecount, '/MediaBox');
$pdf->addPage('L');
$pdf->useTemplate($tplidx, 0, 0);
*/
$save = true;
$access = is_emp($user->role) ? 2 : 1;
$fnames = array();
$count_docs = 0;
//foreach($sbr->getStages() as $stage) {
$doc_act = $DB->rows('select * from sbr_docs where is_deleted <> true AND sbr_id = ?', $row['sbr_id']);
// $doc_act = $sbr->getDocs(NULL, NULL, true, $stage->id, true);
if ($doc_act) {
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:31,代码来源:import_docs.php
示例18: valorSql
else
$sql = "SELECT sr_idformulario FROM asr_solicitudreafiliacion WHERE sr_id = :id";
$idFormulario = valorSql($sql, "", $params);
$params = array(":idformulario" => $idFormulario);
$sql =
"SELECT art.utiles.armar_cuit(sa_cuit) cuit, sa_nombre
FROM asa_solicitudafiliacion
WHERE sa_idformulario = :idformulario";
$stmt = DBExecSql($conn, $sql, $params);
$row2 = DBGetQuery($stmt, 1, false);
if ($autoPrint)
$pdf = new PDF_AutoPrint();
else
$pdf = new FPDI();
$pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"]."/modules/solicitud_afiliacion/templates/nomina_personal_expuesto.pdf");
$pdf->AddPage("L");
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx, null, null, 0, 0, true);
$pdf->SetFont("Arial", "B", 9);
$pdf->Ln(17);
$pdf->Cell(14);
$pdf->Cell(226, 0, $row2["SA_NOMBRE"]);
$pdf->Cell(16);
$pdf->Cell(0, 0, $row2["CUIT"]);
开发者ID:javierlov,项目名称:FuentesWeb,代码行数:30,代码来源:reporte_nomina_personal_expuesto.php
示例19: runProcessStep
public function runProcessStep($dokument)
{
$file = $dokument->getLatestRevision()->getFile();
$extension = array_pop(explode(".", $file->getExportFilename()));
#$this->ziphandler->addFile($file->getAbsoluteFilename(), $file->getExportFilename());
// Print Metainfo for PDFs
if (strtolower($extension) == "pdf") {
try {
$fpdf = new FPDI();
$pagecount = $fpdf->setSourceFile($file->getAbsoluteFilename());
$fpdf->SetMargins(0, 0, 0);
$fpdf->SetFont('Courier', '', 8);
$fpdf->SetTextColor(0, 0, 0);
$documentSize = null;
for ($i = 0; $i < $pagecount; $i++) {
$string = $dokument->getLatestRevision()->getIdentifier() . " (Seite " . ($i + 1) . " von " . $pagecount . ", Revision " . $dokument->getLatestRevision()->getRevisionID() . ")";
$fpdf->AddPage();
$tpl = $fpdf->importPage($i + 1);
$size = $fpdf->getTemplateSize($tpl);
// First Page defines documentSize
if ($documentSize === null) {
$documentSize = $size;
}
// Center Template on Document
$fpdf->useTemplate($tpl, intval(($documentSize["w"] - $size["w"]) / 2), intval(($documentSize["h"] - $size["h"]) / 2), 0, 0, true);
$fpdf->Text(intval($documentSize["w"]) - 10 - $fpdf->GetStringWidth($string), 5, $string);
}
$this->ziphandler->addFromString($dokument->getLatestRevision()->getIdentifier() . "." . $extension, $fpdf->Output("", "S"));
} catch (Exception $e) {
$this->ziphandler->addFile($file->getAbsoluteFilename(), $dokument->getLatestRevision()->getIdentifier() . "." . $extension);
}
} else {
$this->ziphandler->addFile($file->getAbsoluteFilename(), $dokument->getLatestRevision()->getIdentifier() . "." . $extension);
}
}
开发者ID:jungepiraten,项目名称:vpanel,代码行数:35,代码来源:dokumenttransitiondownload.class.php
示例20: splitPages
protected function splitPages($pages)
{
if (!isset($pages) || empty($pages) || !is_array($pages)) {
static::raiseError(__METHOD__ . '(), $pages parameter is invalid!');
return false;
}
try {
$pdf = new \FPDI();
} catch (\Exception $e) {
static::raiseError(__METHOD__ . '(), failed to load FPDI!');
return false;
}
if (($fqfn = $this->tempItem->getFilePath()) === false) {
static::raiseError(get_class($this->tempItem) . '::getFilePath() returned false!');
return false;
}
try {
$page_count = $pdf->setSourceFile($fqfn);
} catch (\Exception $e) {
static::raiseError(getClass($pdf) . '::setSourceFile() has thrown an exception! ' . $e->getMessage());
return false;
}
if ($page_count == count($pages)) {
try {
@$pdf->cleanUp();
} catch (\Exception $e) {
static::raiseError(get_class($pdf) . '::cleanUp() has thrown an exception! ' . $e->getMessage());
return false;
}
return true;
}
for ($page_no = 1; $page_no <= $page_count; $page_no++) {
if (!in_array($page_no, $pages)) {
continue;
}
// import a page
$templateId = $pdf->importPage($page_no);
// get the size of the imported page
$size = $pdf->getTemplateSize($templateId);
// create a page (landscape or portrait depending on the imported page size)
if ($size['w'] > $size['h']) {
$pdf->AddPage('L', array($size['w'], $size['h']));
} else {
$pdf->AddPage('P', array($size['w'], $size['h']));
}
// use the imported page
$pdf->useTemplate($templateId);
}
try {
$pdf->Output($fqfn, 'F');
} catch (\Exception $e) {
static::raiseError(get_class($pdf) . '::Output() returned false!');
return false;
}
if (!$this->tempItem->refresh()) {
static::raiseError(get_class($this->tempItem) . '::refresh() returned false!');
return false;
}
return true;
}
开发者ID:unki,项目名称:mtlda,代码行数:60,代码来源:PdfSplittingController.php
注:本文中的FPDI类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论