예제 #1
0
 private function initPdf($doc_info, $tmp_pdf)
 {
     try {
         $pdf = new FPDF2File('P', 'pt');
         $pdf->Open($tmp_pdf);
         $pdf->SetTitle($doc_info['title'], true);
         $pdf->SetSubject($doc_info['subject'], true);
         $pdf->SetCreator($doc_info['creator'], true);
         $pdf->SetAuthor($doc_info['author'], true);
         $pdf->SetKeywords($doc_info['keywords'], true);
         return $pdf;
     } catch (Exception $e) {
         return null;
     }
 }
예제 #2
0
파일: pdf.php 프로젝트: Boris-de/videodb
 function Image($file, $x, $y, $w = 0, $h = 0, $ext = '', $link = '')
 {
     global $config;
     $image_types = array(1 => 'gif', 2 => 'jpg', 3 => 'png', 6 => 'bmp');
     list($width, $height, $ext, $attr) = getimagesize($file);
     $ext = $image_types[$ext];
     // find image loading function
     switch ($ext) {
         case 'jpg':
             $func = 'jpeg';
             break;
         case 'bmp':
             $func = 'wbmp';
             break;
         default:
             $func = $ext;
     }
     $func = 'imagecreatefrom' . $func;
     // check if loading functions exists (especially for gif support)
     $im = function_exists($func) ? $func($file) : imagecreatetruecolor(1, 1);
     // scaling requested?
     if ($this->Scale) {
         $this->max_width = round($this->Scale * $config['pdf_image_max_width']);
         $this->max_height = round($this->Scale * $config['pdf_image_max_height']);
         $scale = min($this->max_width / $width, $this->max_height / $height);
         $thumb_x = round($width * $scale);
         $thumb_y = round($height * $scale);
     }
     // scaling requied?
     if ($this->Scale && ($thumb_x != $width || $thumb_y != $height)) {
         // create white truecolor image (in case original is transparent)
         $target = imagecreatetruecolor($thumb_x, $thumb_y);
         $white = imagecolorallocate($target, 255, 255, 255);
         imagefilledrectangle($target, 0, 0, $thumb_x, $thumb_y, $white);
         imagecopyresampled($target, $im, 0, 0, 0, 0, $thumb_x, $thumb_y, $width, $height);
         $this->GDImage($file, $x, $y, $w, $h, $target, $link, 'jpeg');
         // change to png if you receive acrobat errors
         imagedestroy($target);
     } elseif ($ext == 'gif') {
         // pdf doesn't support interlaced images
         if (imageinterlace($im)) {
             // claim non-interlaced image
             imageinterlace($im, false);
         }
         $this->GDImage($file, $x, $y, $w, $h, $im, $link);
     } else {
         parent::Image($file, $x, $y, $w, $h, $ext, $link);
     }
     imagedestroy($im);
 }
예제 #3
0
	{
		return false;
	}
	
} */
$subdir = get_subdir();
if (isset($inData['preview'])) {
    $subdir .= "/generated_documents_preview/";
} else {
    $subdir .= "/generated_documents/";
}
if (!is_dir($upload_dir . $subdir)) {
    mkdir($upload_dir . $subdir, 0700, true);
}
$filename = create_filename() . ".pdf";
$pdf = new FPDF2File();
$pdf->Open($upload_dir . $subdir . $filename);
$pdf->SetAutoPageBreak(false, 0);
$pdf->SetMargins(0, 0, 0);
//$pdf->AliasNbPages();
$csvHeaders = array();
if ($server->outData['data'][1]['datasource_file_name'] !== "") {
    if (isset($server->outData['data'][1]['datasource_file_name'])) {
        $csv->parse(".." . $server->outData['data'][1]['datasource_data_path'] . $server->outData['data'][1]['datasource_file_name'], 0, 1000);
        // At max 1000 lines.
        //Leon 24-03-14 - Add this back in, and add error handling into the page designer to print a handy error message to the user
        //if($csv->error_info) {
        //	die(array("error" => 1, "details" => print_r($csv->error_info, 1)) );
        //}
        foreach ($csv->titles as $key => $header) {
            $csvHeaders[] = "<" . $header . ">";