Verfasst: So 3. Jun 2007, 14:21
File does not begin with '%PDF' meldet der Netscape...
Das Diskussionsforum zum Open Source Content Management System
https://forum.contenido.org/
Code: Alles auswählen
Parse error: parse error, unexpected T_FUNCTION, expecting '{' in /homepages/17/d118844875/htdocs/cms/pdf/fpdf_eps.php on line 19Code: Alles auswählen
<?php
/*******************************************************************************
* Software: FPDF_EPS
* Version: 1.3
* Date: 2006-07-28
* Author: Valentin Schmidt
*
* Last Changes:
* - handle binary bytes in front of PS code (which before caused troubles for ereg)
* - fixed positioning and BoundingBox handling code (was totally screwed)
* - fix for BoundingBox detection without space after : (now Corel-compatible)
* - added some dirty code to handle compound paths
* - support for custom colors (x operator)
*******************************************************************************/
require('pdf/html2fpdf.php');
class PDF_EPS extends HTML2FPDF
function PDF_EPS($orientation='P',$unit='mm',$format='A4'){
parent::HTML2FPDF($orientation,$unit,$format);
}
function ImageEps ($file, $x, $y, $w=0, $h=0, $link='', $useBoundingBox=true){
$data = file_get_contents($file);
if ($data===false) $this->Error('EPS file not found: '.$file);
# strip binary bytes in front of PS-header
$start = strpos($data, '%!PS-Adobe');
if ($start>0) $data = substr($data, $start);
# find BoundingBox params
ereg ("%%BoundingBox:([^\r\n]+)", $data, $regs);
if (count($regs)>1){
list($x1,$y1,$x2,$y2) = explode(' ', trim($regs[1]));
}
else $this->Error('No BoundingBox found in EPS file: '.$file);
$start = strpos($data, '%%EndSetup');
if ($start===false) $start = strpos($data, '%%EndProlog');
if ($start===false) $start = strpos($data, '%%BoundingBox');
$data = substr($data, $start);
$end = strpos($data, '%%PageTrailer');
if ($end===false) $end = strpos($data, 'showpage');
if ($end) $data = substr($data, 0, $end);
# save the current graphic state
$this->_out('q');
$k = $this->k;
if ($useBoundingBox){
$dx = $x*$k-$x1;
$dy = $y*$k-$y1;
}else{
$dx = $x*$k;
$dy = $y*$k;
}
# translate
$this->_out(sprintf('%.3f %.3f %.3f %.3f %.3f %.3f cm', 1,0,0,1,$dx,$dy+($this->hPt - 2*$y*$k - ($y2-$y1))));
if ($w>0){
$scale_x = $w/(($x2-$x1)/$k);
if ($h>0){
$scale_y = $h/(($y2-$y1)/$k);
}else{
$scale_y = $scale_x;
$h = ($y2-$y1)/$k * $scale_y;
}
}else{
if ($h>0){
$scale_y = $h/(($y2-$y1)/$k);
$scale_x = $scale_y;
$w = ($x2-$x1)/$k * $scale_x;
}else{
$w = ($x2-$x1)/$k;
$h = ($y2-$y1)/$k;
}
}
# scale
if (isset($scale_x))
$this->_out(sprintf('%.3f %.3f %.3f %.3f %.3f %.3f cm', $scale_x,0,0,$scale_y, $x1*(1-$scale_x), $y2*(1-$scale_y)));
# handle pc/unix/mac line endings
$lines = split ("\r\n|[\r\n]", $data);
$u=0;
$cnt = count($lines);
for ($i=0;$i<$cnt;$i++){
$line = $lines[$i];
if ($line=='' || $line{0}=='%') continue;
$len = strlen($line);
if ($len>2 && $line{$len-2}!=' ') continue;
$cmd = $line{$len-1};
switch ($cmd){
case 'm':
case 'l':
case 'v':
case 'y':
case 'c':
case 'k':
case 'K':
case 'g':
case 'G':
case 's':
case 'S':
case 'J':
case 'j':
case 'w':
case 'M':
case 'd' :
case 'n' :
case 'v' :
$this->_out($line);
break;
case 'x': # custom colors
list($c,$m,$y,$k) = explode(' ', $line);
$this->_out("$c $m $y $k k");
break;
case 'Y':
$line{$len-1}='y';
$this->_out($line);
break;
case 'N':
$line{$len-1}='n';
$this->_out($line);
break;
case 'V':
$line{$len-1}='v';
$this->_out($line);
break;
case 'L':
$line{$len-1}='l';
$this->_out($line);
break;
case 'C':
$line{$len-1}='c';
$this->_out($line);
break;
case 'b':
case 'B':
$this->_out($cmd . '*');
break;
case 'f':
case 'F':
if ($u>0){
$isU = false;
$max = min($i+5,$cnt);
for ($j=$i+1;$j<$max;$j++)
$isU = ($isU || ($lines[$j]=='U' || $lines[$j]=='*U'));
if ($isU) $this->_out("f*");
}else
$this->_out("f*");
break;
case 'u':
if ($line{0}=='*') $u++;
break;
case 'U':
if ($line{0}=='*') $u--;
break;
#default: echo "$cmd<br>"; #just for debugging
}
}
# restore previous graphic state
$this->_out('Q');
if ($link)
$this->Link($x,$y,$w,$h,$link);
}
}# END CLASS
# for backward compatibility
if (!function_exists('file_get_contents')){
function file_get_contents($filename, $use_include_path = 0){
$file = @fopen($filename, 'rb', $use_include_path);
if ($file){
if ($fsize = @filesize($filename))
$data = fread($file, $fsize);
else {
$data = '';
while (!feof($file)) $data .= fread($file, 1024);
}
fclose($file);
return $data;
}else
return false;
}
}
?>Code: Alles auswählen
Warning: Cannot modify header information - headers already sent by (output started at /homepages/17/d118844875/htdocs/cms/front_content.php(792) : eval()'d code:10) in /homepages/17/d118844875/htdocs/cms/front_content.php(792) : eval()'d code on line 261
Warning: Cannot modify header information - headers already sent by (output started at /homepages/17/d118844875/htdocs/cms/front_content.php(792) : eval()'d code:10) in /homepages/17/d118844875/htdocs/cms/front_content.php(792) : eval()'d code on line 262
.... Code: Alles auswählen
Warning: Cannot modify header information - headers already sent by (output started at /homepages/17/d118844875/htdocs/cms/front_content.php(792) : eval()'d code:10) in /homepages/17/d118844875/htdocs/cms/pdf-converter/fpdf.php on line 1035
FPDF error: Some data has already been output to browser, can't send PDF fileNu lass ihm doch noch einen Augenblick...Hallo Zusammen ich werde heute abend das neue Modul veröffentlichen welches diese Probleme Alle beheben dürfte.
Hallo hohrstmann,hohorstmann hat geschrieben:Du hast ja recht. Sorry für meine Ungeduld - aber ich bin ganz schön interessiert an dem "Ding".
Aber ich bin noch jung - ich kann warten. Ho
Code: Alles auswählen
<?
////////////////////////////////////////////
//// Prüfen Aktion
///////////////////////////////////////////
if ($pdf != 1) {
$link = "pdf.php?client=$client&lang=$lang&idcat=$idcat&idart=$idart&pdf=1";
echo "<a target="_blank" href="$link">PDF</A>";
include_once ($contenido_path . "includes/startup.php");
$htmlFile = "pdf-converter/".$lang."_".$idcat."_".$idart.".txt";
$text = "CMS_HTMLHEAD[0] CMS_HTML[1]"; ///// Definition des CMS Headline und HTML
$fp = fopen ($htmlFile,"w");
fwrite($fp,$text);
fclose($fp);
}
?>Code: Alles auswählen
<?php
////////////////////////////////////////////
//// HTML Definition
///////////////////////////////////////////
$htmlFile = "pdf-converter/".$_REQUEST['lang']."_".$_REQUEST['idcat']."_".$_REQUEST['idart'].".txt";
////////////////////////////////////////////
//// PDF Ertstellen
///////////////////////////////////////////
define('FPDF_FONTPATH','font/');
require("pdf-converter/pdf_protection.php");
//Get file contents
$file = fopen($htmlFile,"r");
$size_of_file = filesize($htmlFile);
$html = fread($file, $size_of_file);
fclose($file);
// Löschen von HTML Code
ob_clean();
// Start Converting
$pdf= new PDF();
$pdf->SetProtection(array('print'), '', "dhx0708"); ///// Passwort für berechtigung zum änderen des PDF's
$pdf->SetDisplayMode (125);
$pdf->SetFontSize(10);
$pdf->SetFont('Arial');
$pdf->SetAuthor( 'Your Name' );
$pdf->SetCreator( 'PDF Converter V2.0 Copyright by Christian Schwan' );
$pagecount = $pdf->setSourceFile("pdf-converter/logo.pdf");
$tplidx = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($tplidx,10,10,90);
$pdf->Ln(20);
$pdf->WriteHTML($html);
$pdfFile = $_REQUEST['idcat'].".pdf";
$pdf->Output($pdfFile, "D");
$pdf->closeParsers();
// Schliesse Anwendung
exit();
?>
Supi das es funktioniert hat...hohorstmann hat geschrieben:Hallo Christian,
das war doch mal was! Ich werde das Modul auf jeden Fall für meine o.a. Doku einsetzen. So ganz läuft´s allerdings noch nicht.
Da gibt´s wohl noch Formatierungprobs. zb da: http://rv-rauxel.de/cms/front_content.php?idcat=52
Einen sonderbaren Fehler bekomme ich u.a. da: http://rv-rauxel.de/cms/front_content.php?idcat=12
Übrigens kann das Modul keine Newslisten und Terminpläne - aber damit kann ich gut leben.
... aber wie gesagt, ich bin erleichtert.
Gruß, Ho
PS: Der Aufruf für den PDF-Druck ist am Ender der Artikel.
Die Formatierung eigentlich übernommen, kommt halt drauf an ob die ne externe css datei hast oder nicht. CSS welches in einer externen .css datei liegen wird die formatierung nicht angezeit.Deddy hat geschrieben:Hi!
Soweit funzt es bei mir. Hat jemand eine Ahnung wie ich das Ganze um gif erweitere? Ich bekomme die Fehlermeldung:
FPDF error: Unsupported image type: gif
Bei Seiten mit jpg's funktioniert es, aber ich kann nicht alle Bilder in gif's umwandeln.
» Nachtrag: Jetzt habe ich es mit einer Klasse hinbekommen die gifs umwandelt. Nun wird die Formatierung nicht so dargestellt wie ich es wünsche. Geht das überhaupt, dass mir die Formatierung übernommen wird?
Gruß Deddy