[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc class.pdf.inc.php pdf/class.pdf.php
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc class.pdf.inc.php pdf/class.pdf.php |
Date: |
Sun, 02 Jul 2006 16:25:50 +0000 |
CVSROOT: /sources/phpgwapi
Module name: phpgwapi
Changes by: Sigurd Nes <sigurdne> 06/07/02 16:25:50
Modified files:
inc : class.pdf.inc.php
inc/pdf : class.pdf.php
Log message:
allow pdf with mod_deflate and IE
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.pdf.inc.php?cvsroot=phpgwapi&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/pdf/class.pdf.php?cvsroot=phpgwapi&r1=1.1&r2=1.2
Patches:
Index: class.pdf.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.pdf.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- class.pdf.inc.php 16 Mar 2006 19:23:38 -0000 1.1
+++ class.pdf.inc.php 2 Jul 2006 16:25:49 -0000 1.2
@@ -7,7 +7,7 @@
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package Cpdf
- * @version $Id: class.pdf.inc.php,v 1.1 2006/03/16 19:23:38 sigurdne
Exp $
+ * @version $Id: class.pdf.inc.php,v 1.2 2006/07/02 16:25:49 sigurdne
Exp $
*/
/* Example
@@ -23,13 +23,78 @@
//have a look at the function tender in
/property/inc/class.uiwo_hour.inc.php for usage.
$document= $pdf->ezOutput();
- $size=strlen($document);
+ $pdf->print_pdf($document,'document_name');
+ */
+
+ class pdf__
+ {
+ function print_pdf($document = '',$document_name = 'document')
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$browser = CreateObject('phpgwapi.browser');
- $browser->content_header('tender.pdf','application/pdf',$size);
+ if($browser->BROWSER_AGENT != 'IE')
+ {
+ $size=strlen($document);
+ $browser->content_header($document_name
.'.pdf','application/pdf',$size);
echo $document;
- */
+ }
+ else
+ {
+ $dir = PHPGW_API_INC . SEP . 'pdf' . SEP .
'pdf_files';
+
+ //save the file
+ if (!file_exists($dir))
+ {
+ die('Directory for temporary pdf-files
is missing - pleace notify the Administrator');
+ }
+
+ $fname = tempnam($dir.SEP,'PDF_').'.pdf';
+
+ $fp = fopen($fname,'wb');
+ fwrite($fp,$document);
+ fclose($fp);
+
+ if (!file_exists($fname))
+ {
+ die('Directory for temporary pdf-files
is not writeable to the webserver - pleace notify the Administrator');
+ }
+
+ $fname = $this->currentapp . '/pdf_files/'.
basename($fname);
+ echo '<html>
+ <head>
+ <SCRIPT LANGUAGE="JavaScript"><!--
+ function go_now () { window.location.href =
"'.$fname.'"; }
+ //--></SCRIPT>
+ </head>
+ <body onLoad="go_now()"; >
+ <a href="'.$fname.'">click here</a> if you are
not re-directed.
+ </body>
+ </html>
+ ';
+
+ // also have a look through the directory, and
remove the files that are older than a week
+ if ($d = @opendir($dir))
+ {
+ while (($file = readdir($d)) !== false)
+ {
+ if (substr($file,0,4)=="PDF_")
+ {
+ // then check to see if
this one is too old
+ $ftime =
filemtime($dir.'/'.$file);
+ if (time()-$ftime >
3600*24)
+ {
+
unlink($dir.'/'.$file);
+ }
+ }
+ }
+ closedir($d);
+ }
+ }
+ }
+ }
+
include (PHPGW_API_INC . '/pdf/class.pdf.php');
include (PHPGW_API_INC . '/pdf/class.ezpdf.php');
Index: pdf/class.pdf.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/pdf/class.pdf.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- pdf/class.pdf.php 16 Mar 2006 19:24:15 -0000 1.1
+++ pdf/class.pdf.php 2 Jul 2006 16:25:50 -0000 1.2
@@ -26,7 +26,8 @@
* @package Cpdf
*/
-class pdf_ {
+class pdf_ extends pdf__
+{
/**
* the current number of pdf objects in the document
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpgwapi/inc class.pdf.inc.php pdf/class.pdf.php,
Sigurd Nes <=