CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 PDF in PHP

Print topic Send  topic

Author Message
enko


Posts: 74
Posted: 05/18/2007, 3:32 PM

There is some library for create pdf file from php page generate with ccs ??
thanks a lot !
_________________
Italy - CodeCargeStudio (5.1.1.18992) - Dephi RIO - Lazarus (Free Pascal) - www.egsoft.it - www.egauto.it - www.egcourier.it - www.egestetica.it - Windows, Linux, Raspberry Apps.
View profile  Send private message
tagen

Posts: 19
Posted: 05/19/2007, 1:00 AM

I have used FPDF from www.fpdf.org for a long time now.
It's easy to 'install' and easy to use.
View profile  Send private message
enko


Posts: 74
Posted: 05/19/2007, 8:24 AM

thanks for your replay ...
have you an example to show me ho redirect a result php page to pdf ?
thanks !
_________________
Italy - CodeCargeStudio (5.1.1.18992) - Dephi RIO - Lazarus (Free Pascal) - www.egsoft.it - www.egauto.it - www.egcourier.it - www.egestetica.it - Windows, Linux, Raspberry Apps.
View profile  Send private message
Benjamin Krajmalnik
Posted: 05/21/2007, 8:41 AM

With fPdf you will need to hand code your PDF. The advantage is that it
gives you full control which you otherwsie do not have.
There is another open source project called DOMPDF which will read generated
html and output it as PDF.
Essentially, it has parsers which process the html and convert it.
I did some preliminary testing on it and it worked fairl well, but it will
depend on the make up of your specific pages.

enko


Posts: 74
Posted: 05/21/2007, 4:28 PM

I've did some test with dompdf-0.5.1 but I don't understand who use with ccs pages :( :(
_________________
Italy - CodeCargeStudio (5.1.1.18992) - Dephi RIO - Lazarus (Free Pascal) - www.egsoft.it - www.egauto.it - www.egcourier.it - www.egestetica.it - Windows, Linux, Raspberry Apps.
View profile  Send private message
Benjamin Krajmalnik
Posted: 05/22/2007, 8:37 AM

You would call the dompdf script passing it the url of your CCS page.
It will then load it and render it.

enko


Posts: 74
Posted: 05/22/2007, 2:56 PM

Installed dompdf ... using php example included in zip file located in http://localhost/dompdf/www/examples.php the php file is processed and i can see the pdf file.
I build a very simple example and i deploied this in http://localhost/dompdf/www/test direcotry
(the same dir of dompdf examples) the php file is Page.php
Then I execute this line http://localhost/dompdf/dompdf.php?base_path=www%2Ftest...test%2FPage.php
(I copy and paste the url of the last exampe of dompdf exampe.php)
I have got a lot of warnng and a errors ... see below
============================================================

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 17

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 18

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 19

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 20

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 21

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 22

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 23

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 24

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 25

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 26

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 27

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 28

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 29

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 30

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 31

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 32

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 34

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 35

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 37

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 38

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 41

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 42

Strict Standards: Assigning the return value of new by reference is deprecated in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 72

Strict Standards: Assigning the return value of new by reference is deprecated in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 73

Strict Standards: Assigning the return value of new by reference is deprecated in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 74

Strict Standards: Assigning the return value of new by reference is deprecated in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 75

Strict Standards: Assigning the return value of new by reference is deprecated in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 76

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 185

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 186

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 187

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 188

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 189

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 191

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 192

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 196

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 197

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 198

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 199

Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 200

Strict Standards: Assigning the return value of new by reference is deprecated in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 299

Warning: include(./Common.php) [function.include]: failed to open stream: No such file or directory in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 6

Warning: include() [function.include]: Failed opening './Common.php' for inclusion (include_path='.;C:\php5\pear') in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 6

Warning: include(./Template.php) [function.include]: failed to open stream: No such file or directory in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 7

Warning: include() [function.include]: Failed opening './Template.php' for inclusion (include_path='.;C:\php5\pear') in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 7

Warning: include(./Sorter.php) [function.include]: failed to open stream: No such file or directory in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 8

Warning: include() [function.include]: Failed opening './Sorter.php' for inclusion (include_path='.;C:\php5\pear') in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 8

Warning: include(./Navigator.php) [function.include]: failed to open stream: No such file or directory in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 9

Warning: include() [function.include]: Failed opening './Navigator.php' for inclusion (include_path='.;C:\php5\pear') in c:\Inetpub\wwwroot\dompdf\include\dompdf.cls.php(277) : eval()'d code on line 9

Warning: require_once(c:\Inetpub\wwwroot\dompdf/include/clsdbconnection1.cls.php) [function.require-once]: failed to open stream: No such file or directory in c:\Inetpub\wwwroot\dompdf\dompdf_config.inc.php on line 194

Fatal error: require_once() [function.require]: Failed opening required 'c:\Inetpub\wwwroot\dompdf/include/clsdbconnection1.cls.php' (include_path='.;C:\php5\pear') in c:\Inetpub\wwwroot\dompdf\dompdf_config.inc.php on line 194

============================================================
Where I being wrong ?
thank for any help

_________________
Italy - CodeCargeStudio (5.1.1.18992) - Dephi RIO - Lazarus (Free Pascal) - www.egsoft.it - www.egauto.it - www.egcourier.it - www.egestetica.it - Windows, Linux, Raspberry Apps.
View profile  Send private message
joseph2k

Posts: 72
Posted: 05/22/2007, 7:01 PM

What version of php are you using?
View profile  Send private message
enko


Posts: 74
Posted: 05/23/2007, 1:28 AM

In my develope PC I have installed PHP Version 5.1.2 ...
joseph2k can you send me a simple project in CCS with dompdf integration ?
Otherwise can I send to you my not working example ?
I Hope in your help and patience ... :-)

_________________
Italy - CodeCargeStudio (5.1.1.18992) - Dephi RIO - Lazarus (Free Pascal) - www.egsoft.it - www.egauto.it - www.egcourier.it - www.egestetica.it - Windows, Linux, Raspberry Apps.
View profile  Send private message
joseph2k

Posts: 72
Posted: 05/23/2007, 11:26 AM

I don't have luxury of php5 on my hoster so I don't use, just wanted to make sure that you are using php 5 with dompdf
View profile  Send private message
enko


Posts: 74
Posted: 06/09/2007, 7:59 AM

I'm in a nightmare ...
can anyone help me posting to me a simple example that explain how to print a pdf page in php language ?
thanks to all :-)
enkoATpanserviceDOTit
_________________
Italy - CodeCargeStudio (5.1.1.18992) - Dephi RIO - Lazarus (Free Pascal) - www.egsoft.it - www.egauto.it - www.egcourier.it - www.egestetica.it - Windows, Linux, Raspberry Apps.
View profile  Send private message
datadoit.com
Posted: 06/10/2007, 7:14 PM

www.fpdf.org
Damian Hupfeld
Posted: 06/11/2007, 3:20 AM

chuckle...
go directly to jail, do not pass go and do not collect $200....

"datadoit.com" <datadoit@forum.codecharge> wrote in message
news:f4ib5l$tjo$1@news.codecharge.com...
> www.fpdf.org

datadoit.com
Posted: 06/12/2007, 10:11 AM

:)
enko


Posts: 74
Posted: 06/12/2007, 10:21 AM

I'm thinking that nobody has necessity to export to pdf file in CCS - PHP project :-(
_________________
Italy - CodeCargeStudio (5.1.1.18992) - Dephi RIO - Lazarus (Free Pascal) - www.egsoft.it - www.egauto.it - www.egcourier.it - www.egestetica.it - Windows, Linux, Raspberry Apps.
View profile  Send private message
Damian Hupfeld
Posted: 06/13/2007, 6:39 AM

Im thinking that plenty of people have this requirement but the answer is
not as simple as you want.
I have reviewed the links posted here and they all seem straight forward -
however they will still take some time to test and implement.
No one has given you the answer you want, but they have given you the
answer.

"enko" <enko@forum.codecharge> wrote in message
news:5466ed625000ae@news.codecharge.com...
> I'm thinking that nobody has necessity to export to pdf file in CCS - PHP
> project :-(
> _________________
> Simple an italian programmer ...
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

enko


Posts: 74
Posted: 06/13/2007, 7:35 AM

My question was intended for some feedback on quality of a lot opensource PDF library on the web, hoping of some examples for CCS integration by some expert on this interesting forum.
I can by my self typing "php library freeware" on google or sourceforge.net.
And now lets go to work :-)

_________________
Italy - CodeCargeStudio (5.1.1.18992) - Dephi RIO - Lazarus (Free Pascal) - www.egsoft.it - www.egauto.it - www.egcourier.it - www.egestetica.it - Windows, Linux, Raspberry Apps.
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 06/14/2007, 10:47 PM

enko
Here is an example that I have created using the fpdf class: http://forums.yessoftware.com/posts.php?post_id=74329

Maybe this will be helpful to you.
View profile  Send private message
Damian Hupfeld
Posted: 06/15/2007, 5:01 AM

Are you willing to post the code for the reports PDF page?


"mamboBROWN" <mamboBROWN@forum.codecharge> wrote in message
news:5467227f1ef296@news.codecharge.com...
> enko
> Here is an example that I have created using the fpdf class:
> http://forums.yessoftware.com/posts.php?post_id=74329
>
> Maybe this will be helpful to you.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

mamboBROWN


Posts: 1713
Posted: 06/15/2007, 3:59 PM

If you think that it will be helpful I guest I could. Would anyone else like me to post the code for the page??
View profile  Send private message
wkempees
Posted: 06/17/2007, 5:01 AM

Yep, please do.

"mamboBROWN" <mamboBROWN@forum.codecharge> schreef in bericht
news:5467319eea93a5@news.codecharge.com...
> If you think that it will be helpful I guest I could. Would anyone else
> like me
> to post the code for the page??
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

mamboBROWN


Posts: 1713
Posted: 06/18/2007, 5:42 PM

Here is the code as promised. NOTE: I have made changes to the code so it is not exactly like the example but it is very close. Enjoy!!!


  
// -------------------------  
    global $DBConnection1;  
  
	  
    // Create PDF Report File  
	class PDF extends FPDF  
	{  
		//Page header  
		function Header()  
		{  
		    //Logo  
		    $this->Image('LetterHeader.png',100,10,50,25);  
		    //Arial bold 10  
		    $this->SetFont('Arial','BI',10);  
		    //Move to the right  
		    $this->Cell(80,100);  
		    //Line break  
		    $this->Ln(1);  
		    //Title  
			$this->Cell(160,0,'A Church Name',0,1,'R');  
		    //Line break  
		    $this->Ln(3);  
//			$this->SetFont('Arial','B',10);  
		    $this->Cell(189,0,'Allegheny East Test',0,1,'R');  
		    //Line break  
		    $this->Ln(6);  
		    //Arial bold 15  
		    $this->SetFont('Arial','',8);  
		    $this->Cell(172.5,0,'6541 Munster Bill Rd',0,1,'R');  
		    //Line break  
		    $this->Ln(3);  
		    $this->Cell(165,0,'CityName, State',0,1,'R');  
		    //Line break  
		    $this->Ln(3);  
		    $this->Cell(158,0,'28880-8765',0,1,'R');  
		    //Line break  
		    $this->Ln(6);  
		    $this->Cell(175,0,'Telephone: 278-664-2269',0,1,'R');  
		    //Line break  
		    $this->Ln(3);  
		    $this->Cell(174,0,'Facsimile: 204-555-2067',0,1,'R');  
		    //Line break  
		    $this->Ln(3);  
		    $this->Cell(189.5,0,'Website: www.churchwebsite.com',0,1,'R');  
		    //Line break  
		    $this->Ln(5);  
  
		}  
  
		//Page footer  
		function Footer()  
		{  
		    //Position at 3.0 cm from bottom  
		    $this->SetY(-20);  
		    //Arial italic 8  
		    $this->SetFont('Arial','I',8);  
		    //Line break  
		    $this->Ln(5);  
		    //Page Footer   
		    $this->Cell(0,10,'**NOTE:  This is a receipt for a tax-deductible contribution for which the organization has',0,0,'L');  
		    //Line break  
		    $this->Ln(5);  
		    //Page Footer   
		    $this->Cell(0,10,'         provided no goods or services other than intangible religious benefits to the donor.',0,0,'L');  
		}  
	}  
  
	$pdf=new PDF();  
	$theyear = CCGetParam("Yr","2001");  
	$theperson = CCGetParam("ID",0);  
  
	$qry1 ="SELECT YEAR(to_date) AS Yr, person.pid, person.p_fullname, if((person.ptid=3),person.p_fullname,concat(person.p_lname,', ',person.p_fname)) as fullname, ".  
	       "person.p_address1, concat(person.p_city,',  ',person.p_state,'  ',person.p_zip_code) as address2, ".  
	       "UCASE(department.dep_name) as depname, SUM(titheandoffering.to_amount) AS Total ".  
		   "FROM person INNER JOIN titheandoffering ON (person.pid = titheandoffering.pid) ".  
		   "INNER JOIN department ON (titheandoffering.depid = department.depid) ";  
	$qryEnd = "GROUP BY YEAR(to_date), person.pid, fullname, depname ORDER BY fullname";   
	  
	if ($theperson == 0)   
	{  
	$WhereStatement ="WHERE YEAR(to_date) = ".$theyear." and (person.p_md = 0) AND (department.dep_tax_deduct = 1) ";  
	}  
	else  
	{  
	$WhereStatement ="WHERE person.pid= ".$theperson." and YEAR(to_date) = ".$theyear." and (person.p_md = 0) AND (department.dep_tax_deduct = 1) ";  
	}  
  
	// get Person Tithe and Offering  
	$db = new clsDBConnection1();  
	$qry= $qry1."".$WhereStatement."".$qryEnd;  
	$db->query($qry);  
    $prevnameid = 0;  
	$ttlsum = 0.00;   
  
	while ($db->next_record())  
	{  
		$nameid = $db->f("pid");  
		$name = $db->f("fullname");  
		$addr = $db->f("p_address1");  
		$addr2 = $db->f("address2");  
		if ($nameid <> $prevnameid)  
		{  
		    if ($prevnameid <> 0)  
			{  
				$pdf->Cell(30);  
				$pdf->Cell(40,0, "------------------------------------------",0,1,"L");  
				$pdf->Cell(120);  
				$pdf->Cell(10,0, "--------------------",0,1,"R");  
				$pdf->Ln(5);  
				$pdf->Cell(30);  
				$pdf->Cell(40,0, "GRAND TOTAL",0,1,"L");  
				$pdf->Cell(120);  
				$flt_ttlsum = sprintf("%01.2f",$ttlsum);   
				$pdf->Cell(10,0, "".$flt_ttlsum."",0,1,"R");  
			    $pdf->SetFont('Arial','I',8);  
			    $pdf->SetY(-40);  
				$pdf->Image('latouche.jpg',10,252,58);  
				$pdf->Ln(2);  
			    $pdf->Cell(0,10,'_______________________________________',0,0,'L');  
				$pdf->Ln(5);   
			    $pdf->Cell(0,10,'Olson LaTouche, Treasurer',0,0,'L');  
  
			}  
			  
			$pdf->AddPage();			  
			$pdf->SetFont('Arial','B',12);  
			$pdf->Cell(0,0, "Year ".$theyear, 0,1,'L');  
			$pdf->SetFont('Arial','',10);  
			$pdf->Ln(10);  
			$pdf->Cell(0,0, "".$name."", 0.1);  
			$pdf->Ln(5);  
			$pdf->Cell(0,0, "".$addr."", 0.1);  
			$pdf->Ln(5);  
			$pdf->Cell(0,0, "".$addr2."", 0.1);  
			$pdf->Ln(5);  
			$pdf->Ln(20);  
			$prevnameid = $nameid;  
			$ttlsum = 0;  
		}  
		  
		  
		$dep = $db->f("depname");  
		$ttl = $db->f("Total");  
		$ttlsum = $ttlsum + $ttl;  
		$pdf->Cell(30);  
		$pdf->Cell(40,0, "".$dep."",0,1,"L");  
		$pdf->Cell(120);  
		$pdf->Cell(10,0, "            ".$ttl."",0,1,"R");  
		$pdf->Ln(5);  
		  
	}  
	$pdf->Cell(30);  
	$pdf->Cell(40,0, "------------------------------------------",0,1,"L");  
	$pdf->Cell(120);  
	$pdf->Cell(10,0, "--------------------",0,1,"R");  
	$pdf->Ln(5);  
	$pdf->Cell(30);  
	$pdf->Cell(40,0, "GRAND TOTAL",0,1,"L");  
	$pdf->Cell(120);  
	$flt_ttlsum = sprintf("%01.2f",$ttlsum);   
	$pdf->Cell(10,0, "".$flt_ttlsum."",0,1,"R");  
    $pdf->SetFont('Arial','I',8);  
    $pdf->SetY(-40);  
	$pdf->Image('latouche.jpg',10,252,58);  
	$pdf->Ln(2);  
    $pdf->Cell(0,10,'_______________________________________',0,0,'L');  
	$pdf->Ln(5);   
    $pdf->Cell(0,10,'Olson LaTouche, Treasurer',0,0,'L');  
	$db->close();  
  
	$file = "hello.pdf" ;  
	$pdf->Output($file, "I");  
  
// -------------------------  
//End Custom Code  
View profile  Send private message
Damian Hupfeld
Posted: 06/19/2007, 6:15 AM

Hi mamboBROWN,

Thanks for posting - very useful and it goes a long way to answering the
ealier questions in this thread... It certainly is possible, it certainly
does work, it can produce great results, but it will require just a *little*
bit of learning and hand coding! I will enjoy working thru this one.

Damian



"mamboBROWN" <mamboBROWN@forum.codecharge> wrote in message
news:546772676b8233@news.codecharge.com...
> Here is the code as promised. NOTE: I have made changes to the code so it
> is
> not exactly like the example but it is very close. Enjoy!!!
>
>
>
  
> // -------------------------  
>    global $DBConnection1;  
>  
>  
>    // Create PDF Report File  
> class PDF extends FPDF  
> {  
> //Page header  
> function Header()  
> {  
>     //Logo  
>     $this->Image('LetterHeader.png',100,10,50,25);  
>     //Arial bold 10  
>     $this->SetFont('Arial','BI',10);  
>     //Move to the right  
>     $this->Cell(80,100);  
>     //Line break  
>     $this->Ln(1);  
>     //Title  
> $this->Cell(160,0,'A Church Name',0,1,'R');  
>     //Line break  
>     $this->Ln(3);  
> // $this->SetFont('Arial','B',10);  
>     $this->Cell(189,0,'Allegheny East Test',0,1,'R');  
>     //Line break  
>     $this->Ln(6);  
>     //Arial bold 15  
>     $this->SetFont('Arial','',8);  
>     $this->Cell(172.5,0,'6541 Munster Bill Rd',0,1,'R');  
>     //Line break  
>     $this->Ln(3);  
>     $this->Cell(165,0,'CityName, State',0,1,'R');  
>     //Line break  
>     $this->Ln(3);  
>     $this->Cell(158,0,'28880-8765',0,1,'R');  
>     //Line break  
>     $this->Ln(6);  
>     $this->Cell(175,0,'Telephone: 278-664-2269',0,1,'R');  
>     //Line break  
>     $this->Ln(3);  
>     $this->Cell(174,0,'Facsimile: 204-555-2067',0,1,'R');  
>     //Line break  
>     $this->Ln(3);  
>     $this->Cell(189.5,0,'Website: www.churchwebsite.com',0,1,'R');  
>     //Line break  
>     $this->Ln(5);  
>  
> }  
>  
> //Page footer  
> function Footer()  
> {  
>     //Position at 3.0 cm from bottom  
>     $this->SetY(-20);  
>     //Arial italic 8  
>     $this->SetFont('Arial','I',8);  
>     //Line break  
>     $this->Ln(5);  
>     //Page Footer  
>     $this->Cell(0,10,'**NOTE:  This is a receipt for a tax-deductible  
> contribution for which the organization has',0,0,'L');  
>     //Line break  
>     $this->Ln(5);  
>     //Page Footer  
>     $this->Cell(0,10,'         provided no goods or services other than  
> intangible religious benefits to the donor.',0,0,'L');  
> }  
> }  
>  
> $pdf=new PDF();  
> $theyear = CCGetParam("Yr","2001");  
> $theperson = CCGetParam("ID",0);  
>  
> $qry1 ="SELECT YEAR(to_date) AS Yr, person.pid, person.p_fullname,  
> if((person.ptid=3),person.p_fullname,concat(person.p_lname,',   
> ',person.p_fname))  
> as fullname, ".  
>        "person.p_address1, concat(person.p_city,',  ',person.p_state,'  
> ',person.p_zip_code) as address2, ".  
>        "UCASE(department.dep_name) as depname,   
> SUM(titheandoffering.to_amount)  
> AS Total ".  
>    "FROM person INNER JOIN titheandoffering ON (person.pid =  
> titheandoffering.pid) ".  
>    "INNER JOIN department ON (titheandoffering.depid = department.depid)   
> ";  
> $qryEnd = "GROUP BY YEAR(to_date), person.pid, fullname, depname ORDER BY  
> fullname";  
>  
> if ($theperson == 0)  
> {  
> $WhereStatement ="WHERE YEAR(to_date) = ".$theyear." and (person.p_md = 0)   
> AND  
> (department.dep_tax_deduct = 1) ";  
> }  
> else  
> {  
> $WhereStatement ="WHERE person.pid= ".$theperson." and YEAR(to_date) =  
> ".$theyear." and (person.p_md = 0) AND (department.dep_tax_deduct = 1) ";  
> }  
>  
> // get Person Tithe and Offering  
> $db = new clsDBConnection1();  
> $qry= $qry1."".$WhereStatement."".$qryEnd;  
> $db->query($qry);  
>    $prevnameid = 0;  
> $ttlsum = 0.00;  
>  
> while ($db->next_record())  
> {  
> $nameid = $db->f("pid");  
> $name = $db->f("fullname");  
> $addr = $db->f("p_address1");  
> $addr2 = $db->f("address2");  
> if ($nameid <> $prevnameid)  
> {  
>     if ($prevnameid <> 0)  
> {  
> $pdf->Cell(30);  
> $pdf->Cell(40,0, "------------------------------------------",0,1,"L");  
> $pdf->Cell(120);  
> $pdf->Cell(10,0, "--------------------",0,1,"R");  
> $pdf->Ln(5);  
> $pdf->Cell(30);  
> $pdf->Cell(40,0, "GRAND TOTAL",0,1,"L");  
> $pdf->Cell(120);  
> $flt_ttlsum = sprintf("%01.2f",$ttlsum);  
> $pdf->Cell(10,0, "".$flt_ttlsum."",0,1,"R");  
>     $pdf->SetFont('Arial','I',8);  
>     $pdf->SetY(-40);  
> $pdf->Image('latouche.jpg',10,252,58);  
> $pdf->Ln(2);  
>     $pdf->Cell(0,10,'_______________________________________',0,0,'L');  
> $pdf->Ln(5);  
>     $pdf->Cell(0,10,'Olson LaTouche, Treasurer',0,0,'L');  
>  
> }  
>  
> $pdf->AddPage();  
> $pdf->SetFont('Arial','B',12);  
> $pdf->Cell(0,0, "Year ".$theyear, 0,1,'L');  
> $pdf->SetFont('Arial','',10);  
> $pdf->Ln(10);  
> $pdf->Cell(0,0, "".$name."", 0.1);  
> $pdf->Ln(5);  
> $pdf->Cell(0,0, "".$addr."", 0.1);  
> $pdf->Ln(5);  
> $pdf->Cell(0,0, "".$addr2."", 0.1);  
> $pdf->Ln(5);  
> $pdf->Ln(20);  
> $prevnameid = $nameid;  
> $ttlsum = 0;  
> }  
>  
>  
> $dep = $db->f("depname");  
> $ttl = $db->f("Total");  
> $ttlsum = $ttlsum + $ttl;  
> $pdf->Cell(30);  
> $pdf->Cell(40,0, "".$dep."",0,1,"L");  
> $pdf->Cell(120);  
> $pdf->Cell(10,0, "            ".$ttl."",0,1,"R");  
> $pdf->Ln(5);  
>  
> }  
> $pdf->Cell(30);  
> $pdf->Cell(40,0, "------------------------------------------",0,1,"L");  
> $pdf->Cell(120);  
> $pdf->Cell(10,0, "--------------------",0,1,"R");  
> $pdf->Ln(5);  
> $pdf->Cell(30);  
> $pdf->Cell(40,0, "GRAND TOTAL",0,1,"L");  
> $pdf->Cell(120);  
> $flt_ttlsum = sprintf("%01.2f",$ttlsum);  
> $pdf->Cell(10,0, "".$flt_ttlsum."",0,1,"R");  
>    $pdf->SetFont('Arial','I',8);  
>    $pdf->SetY(-40);  
> $pdf->Image('latouche.jpg',10,252,58);  
> $pdf->Ln(2);  
>    $pdf->Cell(0,10,'_______________________________________',0,0,'L');  
> $pdf->Ln(5);  
>    $pdf->Cell(0,10,'Olson LaTouche, Treasurer',0,0,'L');  
> $db->close();  
>  
> $file = "hello.pdf" ;  
> $pdf->Output($file, "I");  
>  
> // -------------------------  
> //End Custom Code  
> 
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

ckroon

Posts: 869
Posted: 12/15/2007, 10:57 PM

Wow. Thanks for this code Mambo. I just got FPDF working and went through the tutorials. This code is coming in handy. Before I delve into it, is there a way to include a php component page that is already created?

_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
Gena

Posts: 591
Posted: 12/16/2007, 3:25 AM

I have worked with FPDF and found it not really useful. I prefer to use R&OS class from http://www.ros.co.nz/pdf
_________________
Gena
View profile  Send private message
ckroon

Posts: 869
Posted: 12/19/2007, 1:53 PM

Hi Gena, you wouldn't have a sample code you code post for us newbs would you?
I am having trouble with the sql formatting.

_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
Gena

Posts: 591
Posted: 12/19/2007, 1:59 PM

Quote ckroon:
Hi Gena, you wouldn't have a sample code you code post for us newbs would you?
I am having trouble with the sql formatting.


There absolutely no problem with pdf export. Your problem related to CCS formatting. Let me know what kind of problem you have?
_________________
Gena
View profile  Send private message
ckroon

Posts: 869
Posted: 12/19/2007, 2:06 PM

I am trying to the pdf to display a table with three database fields: lastname, firstname, and grade.
I suck at writing SQL so I was trying to pull it out of a grid I had made on a previous CCS page.
But the formatting is all wrong.
If I had a sample one to look at I think it would help.

_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
Gena

Posts: 591
Posted: 12/19/2007, 2:28 PM

Quote ckroon:
I am trying to the pdf to display a table with three database fields: lastname, firstname, and grade.
I suck at writing SQL so I was trying to pull it out of a grid I had made on a previous CCS page.
But the formatting is all wrong.
If I had a sample one to look at I think it would help.

Not sure I understand your problem.

Below example of code that output 2 columns table...
  
  
//-----------------PDF output here--------------------------------------------------------------------------          
        // make a new pdf object  
$pdf = & new Cezpdf();  
$pdf->ezSetCmMargins(1,1,2,1); //ezSetCmMargins(top,bottom,left,right)  
// select the font  
$pdf->selectFont('./fonts/Helvetica');  
  
$pdf->ezStartPageNumbers(28.35 * 20 ,28.35,10,'left','',1); //ezStartPageNumbers(x,y,size,[pos],[pattern],[num])  
  
$X = 28.35 * 2 ; // cm 57;  
$pdf->addJpegFromFile("Images/logo_pdf.jpg",$X,700+39,142); // addJpegFromFile(imgFileName,x,y,w,[h])   
  
$pdf->addInfo("Title","Invoice " . $order_invoice); //Title, Author, Subject, Keywords, Creator  
$pdf->addInfo("Author","MSoft");  
$pdf->addInfo("Subject","Order " . $order_number);  
$pdf->addInfo("Keywords","");  
$pdf->addInfo("Creator","MSoft");  
  
  
$title = "INVOICE " . $order_invoice . " of " . GetInvoiceDate();  
$titleOrd = "Order " . $order_number . " of " . GetOrderDate();  
$title = $title . "\n" . " (" . $titleOrd .")";  
//customer and bill info  
$pdf->ezSetY(730);  
  $a = GetUserData();  
  $ivacase = $a['IVAcase'];  
  $i =0;  
  $data1[$i]['CustomerInfo']  = $a['CustomerInfo'];  
  $data1[$i]['BillingInfo']   = $a['BillingInfo'];  
    
  $cols1 = array('CustomerInfo'=>'Customer Information',  
                'BillingInfo'=>'Billing Information')   ;  
                
  $OrderY = $pdf->ezTable($data1,$cols1,'Customer',  
          array('xPos'=>$X,  
                'showHeadings'=>1,  
                'shaded'=>0,  
                'xOrientation'=>'right',  
                'width'=>18 * 28.35,  
                'cols'=>array(  
                     'CustomerInfo'=>array('justification'=>'right', 'width'=>9 * 28.35),  
                     'BillingInfo'=>array('justification'=>'right', 'width'=>9 * 28.35)  
                          )  
             ));    
//customer and bill info - finish  
  
$pdf->ezstream(array("Content-Disposition"=> "MsoftInvoice" . $order_invoice)); //filename here  
  
  
//-----------------PDF output here--------------------------------------------------------------------------  

_________________
Gena
View profile  Send private message
ckroon

Posts: 869
Posted: 12/19/2007, 8:24 PM

Hi Gena, Thanks for posting that. I am confused as to where the Sql database information is. Where does it connect to a Mysql db and where is the query.
I see where the tables are being created but where is it gettign the data to fill in the tables..?

_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
 Page 1 of 2  Next Last


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.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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