CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 dompdf

Print topic Send  topic

Author Message
delacosta456

Posts: 5
Posted: 09/23/2011, 1:03 AM

can somebody help please i can't make the dompdf work in CCS


i follow this link http://forums.yessoftware.com/posts.php?post_id=93514 about using dompdf in CCS ...
below are my modified dompdf.php file wich is in dompdf directory on my local server, and the before output.i created tmp directory with 777 property in both dompdf directory and server root directory.

i don't know how to call the convert event or the make figure in the url to start the conversion ....


My coses

dompdf.php file

  
  
function dompdf_usage() {  
echo  
" -s \tvery verbose: sets SERVER_FILENAME When running in cgi mode\n".  
"\nUsage: {$_SERVER["argv"][0]} [options] html_file\n\n".  
"html_file can be a filename, a url if fopen_wrappers are enabled, or the '-' \n".  
"character to read from standard input.\n\n".  
"Options:\n".  
" -h\t\tShow this message\n".  
" -l\t\tlist available paper sizes\n".  
" -p size\tpaper size; something like 'letter', 'A4', 'legal', etc. The default is\n".  
" \t\t'" . DOMPDF_DEFAULT_PAPER_SIZE . "'\n".  
" -o orientation\teither 'portrait' or 'landscape'. Default is 'portrait'.\n".  
" -b path\tset the 'document root' of the html_file. Relative urls (for \n".  
" \tstylesheets) are resolved using this directory. Default is the \n".  
" \tdirectory of html_file.\n".  
" -f file\tthe output filename. Default is the input [html_file].pdf.\n".  
" -v \tverbose: display html parsing warnings and file not found errors.\n".  
" -d \tvery verbose: display oodles of debugging output: every frame\n".  
" \tin the tree printed to stdout.\n".  
" -t comma separated list of debugging types (page-break,reflow,split)\n\n";  
}  
  
function getoptions() {  
  
case "-s":  
if ( !isset($_SERVER["argv"][$i+1]) )  
die("-f switch requires the SCRIPT_FINENAME parameter\n");  
$opts["s"] = $_SERVER["argv"][$i+1];  
$_SERVER["SCRIPT_FILENAME"]=$_SERVER["argv"][$i+1];  
$i += 2;  
break;  
  
$opts = array();  
  
if ( $_SERVER["argc"] == 1 )  
return $opts;  
  
$i = 1;  
while ($i < $_SERVER["argc"]) {  
  
switch ($_SERVER["argv"][$i]) {  
  
case "--help":  
case "-h":  
$opts["h"] = true;  
$i++;  
break;  
  
case "-l":  
$opts["l"] = true;  
$i++;  
break;  
  
case "-p":  
if ( !isset($_SERVER["argv"][$i+1]) )  
die("-p switch requires a size parameter\n");  
$opts["p"] = $_SERVER["argv"][$i+1];  
$i += 2;  
break;  
  
case "-o":  
if ( !isset($_SERVER["argv"][$i+1]) )  
die("-o switch requires an orientation parameter\n");  
$opts["o"] = $_SERVER["argv"][$i+1];  
$i += 2;  
break;  
  
case "-b":  
if ( !isset($_SERVER["argv"][$i+1]) )  
die("-b switch requires a path parameter\n");  
$opts["b"] = $_SERVER["argv"][$i+1];  
$i += 2;  
break;  
  
case "-f":  
if ( !isset($_SERVER["argv"][$i+1]) )  
die("-f switch requires a filename parameter\n");  
$opts["f"] = $_SERVER["argv"][$i+1];  
$i += 2;  
break;  
  
case "-v":  
$opts["v"] = true;  
$i++;  
break;  
  
case "-d":  
$opts["d"] = true;  
$i++;  
break;  
  
case "-t":  
if ( !isset($_SERVER['argv'][$i + 1]) )  
die("-t switch requires a comma separated list of types\n");  
$opts["t"] = $_SERVER['argv'][$i+1];  
$i += 2;  
break;  
  
default:  
$opts["filename"] = $_SERVER["argv"][$i];  
$i++;  
break;  
}  
  
}  
return $opts;  
}  
  

the beforeOutput i modified

  
  
if (CCGetFromGet("_convert")) {  
global $main_block;  
$server=" -s ".$_SERVER["SCRIPT_FILENAME"]." ";// Fixes a big in running dompdf in PHP CGI mode rather than CLI mode  
$Command = "php -f dompdf/dompdf.php -- "; // Relative path for the -f switch for the dompdf script  
// $Options = " -f {ResultFile} {InputFile} ";  
$TempFolder = "./tmp/"; //Relative to this directory CCS Script is executing in  
$ResultFolder = "./dompdf/tmp/";//Relative to directory dompdf is running in  
if (CCSubStr($TempFolder, -1) != DIRECTORY_SEPARATOR && CCSubStr($TempFolder, -1) != "/" && CCSubStr($TempFolder, -1) != "\\") $TempFolder .= DIRECTORY_SEPARATOR;  
$TempFileName = "pdf" . session_id() . mt_rand(100000, 999999);  
$ResultFileName = $TempFolder.$TempFileName. ".pdf"; //Where CSS will look for created PDF by dompdf  
$InFileName=$ResultFolder.$TempFileName.".html"; //Where dompdf will find the html to convert  
$OutFileName=$ResultFolder.$TempFileName.".pdf"; //Where dompdf will put the pdf output  
$TempFileName=$TempFolder.$TempFileName.".html"; //Where CSS will put the HTML for dompdf to convert  
  
// echo $TempFileName." ".$ResultFileName;die();  
$WindowsQuote = DIRECTORY_SEPARATOR == "\\" ? '"' : "";  
if ($TempFileName && $TmpFH = @fopen($TempFileName, "wb")) {  
fwrite($TmpFH, $main_block);  
fclose($TmpFH);  
// echo $TempFileName." ".$ResultFileName;die();  
// $Options = str_replace("{InputFile}", escapeshellarg($TempFileName), $Options);  
// $Options = str_replace("{Root}", escapeshellarg(getcwd()), $Options);  
if ($go==1) {  
// $Options = str_replace("{ResultFile}", escapeshellarg($ResultFileName), $Options);  
// $Command=$Command.chr(32).chr(32).$ResultFileName.chr(32).chr(32).$TempFileName;  
$Command=$Command." -f ".$OutFileName." -b ./ ".$server." ".$InFileName;  
exec($Command);  
// echo "<br>".$PDFfilename." ".$ResultFileName."</br>".$Command;die();  
if ($fh = @fopen($ResultFileName , "rb")) {  
$now = time();  
$ServerDate = gmdate("D, d M Y H:i:s", $now) . " GMT";  
$ExpireDate = gmdate("D, d M Y H:i:s", $now + 60) . " GMT";  
Header("Cache-control: ");  
Header("Pragma: ");  
Header("Date: " . $ServerDate);  
Header("Expires: " . $ExpireDate);  
Header("Content-Type: application/pdf");  
while($str = fread($fh, 1024)) echo $str;  
fclose($fh);  
unlink($ResultFileName);  
$Page_BeforeOutput = false;  
}  
} elseif ($fh = popen($WindowsQuote . $Command . " " . $Options . $WindowsQuote, "rb")) {  
$firstPass = true;  
while($str = fread($fh, 1024)) {  
if ($firstPass) {  
$now = time();  
$ServerDate = gmdate("D, d M Y H:i:s", $now) . " GMT";  
$ExpireDate = gmdate("D, d M Y H:i:s", $now + 60) . " GMT";  
Header("Cache-control: ");  
Header("Pragma: ");  
Header("Date: " . $ServerDate);  
Header("Expires: " . $ExpireDate);  
Header("Content-Type: application/pdf");  
$firstPass = false;  
}  
echo $str;  
}  
pclose($fh);  
$Page_BeforeOutput = false;  
}  
unlink($TempFileName);  
}  
}  
View profile  Send private message
phpminer

Posts: 28
Posted: 09/23/2011, 1:37 AM

Can you be more specific . . . what exactly are you having problems with?
View profile  Send private message
bannedone


Posts: 273
Posted: 09/23/2011, 6:32 AM

Try

http://cc se lite.com/online_store.php?pid=24

remove spaces in the URL above

_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.