Yii Framework Forum: PDF GENERATION - Yii Framework Forum

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

PDF GENERATION PDF

#1 User is offline   Karthik12 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 15-March 11

Posted 23 June 2011 - 12:53 AM

Hi ,
Am working on the PDF generation,am using the following http://www.yiiframew...ension/tcpdf,so i can put the tCPDF in extensions folder and i add the following code
D:\Dev\Apache\htdocs\first\protected\views\layouts\main.php,[code]<?php
$pdf = Yii::createComponent('application.extensions.tcpdf.ETcPdf',
'P', 'cm', 'A4', true, 'UTF-8');
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor("Nicola Asuni");
$pdf->SetTitle("TCPDF Example 002");
$pdf->SetSubject("TCPDF Tutorial");
$pdf->SetKeywords("TCPDF, PDF, example, test, guide");
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont("times", "BI", 20);
$pdf->Cell(0,10,"Example 002",1,1,'C');
$pdf->Output("example_002.pdf", "I"); ?>

/code]

i got the following error
require_once(D:\Dev\Apache\htdocs\first\protected\extensions\tcpdf/tcpdf/tcpdf.php): failed to open stream: No such file or directory.
please help me
0

#2 User is offline   PeRoChAk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 578
  • Joined: 26-November 10
  • Location:Lahore, Pakistan

Posted 23 June 2011 - 01:40 AM

You should check the files that you have put in the ext folder

I think you have tcpdf folder and then in it there is again tcpdf folder
which is making problems

put the files as
ext /tcpdf/ETcPdf.php
Cheers
Perochak
Web Design - Logo Design - Application Development

My Blog | Forums Comparison
0

#3 User is offline   Karthik12 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 15-March 11

Posted 23 June 2011 - 02:21 AM

View PostPeRoChAk, on 23 June 2011 - 01:40 AM, said:

You should check the files that you have put in the ext folder

I think you have tcpdf folder and then in it there is again tcpdf folder
which is making problems

put the files as
ext /tcpdf/ETcPdf.php

i can remove the all tcpdf ,and also i got the same error
0

#4 User is offline   PeRoChAk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 578
  • Joined: 26-November 10
  • Location:Lahore, Pakistan

Posted 23 June 2011 - 06:17 AM

What I mean is that

You should place all the files of tcpdf ext in ext folder as

ext/tcpdf

As
pdf = Yii::createComponent('application.extensions.tcpdf.ETcPdf
this line of code suggests that
the ETcPdf file is located in application/extensions/tcpdf folder
Cheers
Perochak
Web Design - Logo Design - Application Development

My Blog | Forums Comparison
0

#5 User is offline   Karthik12 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 15-March 11

Posted 23 June 2011 - 08:00 AM

View PostPeRoChAk, on 23 June 2011 - 06:17 AM, said:

What I mean is that

You should place all the files of tcpdf ext in ext folder as

ext/tcpdf

As
pdf = Yii::createComponent('application.extensions.tcpdf.ETcPdf
this line of code suggests that
the ETcPdf file is located in application/extensions/tcpdf folder

ya ,i will do that way ,but i cant get any progress,i will remove all the errors,how to see pdf file in the application
0

#6 User is offline   PeRoChAk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 578
  • Joined: 26-November 10
  • Location:Lahore, Pakistan

Posted 23 June 2011 - 09:33 PM

tHE PDF will be displayed in the webpage accessing the current controller

If you need sample code, then let me know
Cheers
Perochak
Web Design - Logo Design - Application Development

My Blog | Forums Comparison
0

#7 User is offline   Karthik12 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 15-March 11

Posted 23 June 2011 - 11:33 PM

View PostPeRoChAk, on 23 June 2011 - 09:33 PM, said:

tHE PDF will be displayed in the webpage accessing the current controller

If you need sample code, then let me know

thankk you for giving reply.please send me sample code,
0

#8 User is offline   Karthik12 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 15-March 11

Posted 24 June 2011 - 02:05 AM

public function actionTest(){

//require_once('../config/lang/eng.php');
//require_once('../tcpdf.php');
$pdf = Yii::createComponent('application.extensions.tcpdf.TcPdf',
                            'P', 'cm', 'A4', true, 'UTF-8');
//$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF NAGRAJ');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
$pdf->setPrintHeader(true);
$pdf->setPrintFooter(true);
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING);

// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

// ---------------------------------------------------------

// set default font subsetting mode
$pdf->setFontSubsetting(true);

// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->SetFont('dejavusans', '', 14, '', true);

// add a page
$pdf->AddPage();

// This method has several options, check the source code documentation for more information.
// Set some content to print
//Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M')

// test Cell stretching
$pdf->Cell(0, 0, 'TEST CELL STRETCH: no stretch', 1, 1, 'C', 0, '', 0);
$pdf->Cell(0, 0, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1);
$pdf->Cell(0, 0, 'TEST CELL STRETCH: force scaling', 1, 1, 'C', 0, '', 2);
$pdf->Cell(0, 0, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3);
$pdf->Cell(0, 0, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4);

$pdf->Ln(5);

$pdf->Cell(45, 0, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1);
$pdf->Cell(45, 0, 'TEST CELL STRETCH: force scaling', 1, 1, 'C', 0, '', 2);
$pdf->Cell(45, 0, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3);
$pdf->Cell(45, 0, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4);

$pdf->AddPage();

// example using general stretching and spacing

for ($stretching = 90; $stretching <= 110; $stretching += 10) {
	for ($spacing = -0.254; $spacing <= 0.254; $spacing += 0.254) {

		// set general stretching (scaling) value
		$pdf->setFontStretching($stretching);

		// set general spacing value
		$pdf->setFontSpacing($spacing);

		$pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, no stretch', 1, 1, 'C', 0, '', 0);
		$pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, scaling', 1, 1, 'C', 0, '', 1);
		$pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, force scaling', 1, 1, 'C', 0, '', 2);
		$pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, spacing', 1, 1, 'C', 0, '', 3);
		$pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, force spacing', 1, 1, 'C', 0, '', 4);

		$pdf->Ln(2);
	}
}
// ---------------------------------------------------------

// Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output('NAGRAJ.pdf', 'I');


with this code i may get empty pdf,but i want to get details pdf,

i have table with
1.username,
2.password,
3.email
i may display the all the above values in that pdf,please help me
0

#9 User is offline   Karthik12 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 15-March 11

Posted 24 June 2011 - 02:05 AM

public function actionTest(){

//require_once('../config/lang/eng.php');
//require_once('../tcpdf.php');
$pdf = Yii::createComponent('application.extensions.tcpdf.TcPdf',
                            'P', 'cm', 'A4', true, 'UTF-8');
//$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF NAGRAJ');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
$pdf->setPrintHeader(true);
$pdf->setPrintFooter(true);
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING);

// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

// ---------------------------------------------------------

// set default font subsetting mode
$pdf->setFontSubsetting(true);

// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->SetFont('dejavusans', '', 14, '', true);

// add a page
$pdf->AddPage();

// This method has several options, check the source code documentation for more information.
// Set some content to print
//Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M')

// test Cell stretching
$pdf->Cell(0, 0, 'TEST CELL STRETCH: no stretch', 1, 1, 'C', 0, '', 0);
$pdf->Cell(0, 0, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1);
$pdf->Cell(0, 0, 'TEST CELL STRETCH: force scaling', 1, 1, 'C', 0, '', 2);
$pdf->Cell(0, 0, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3);
$pdf->Cell(0, 0, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4);

$pdf->Ln(5);

$pdf->Cell(45, 0, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1);
$pdf->Cell(45, 0, 'TEST CELL STRETCH: force scaling', 1, 1, 'C', 0, '', 2);
$pdf->Cell(45, 0, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3);
$pdf->Cell(45, 0, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4);

$pdf->AddPage();

// example using general stretching and spacing

for ($stretching = 90; $stretching <= 110; $stretching += 10) {
	for ($spacing = -0.254; $spacing <= 0.254; $spacing += 0.254) {

		// set general stretching (scaling) value
		$pdf->setFontStretching($stretching);

		// set general spacing value
		$pdf->setFontSpacing($spacing);

		$pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, no stretch', 1, 1, 'C', 0, '', 0);
		$pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, scaling', 1, 1, 'C', 0, '', 1);
		$pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, force scaling', 1, 1, 'C', 0, '', 2);
		$pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, spacing', 1, 1, 'C', 0, '', 3);
		$pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, force spacing', 1, 1, 'C', 0, '', 4);

		$pdf->Ln(2);
	}
}
// ---------------------------------------------------------

// Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output('NAGRAJ.pdf', 'I');


with this code i may get empty pdf,but i want to get details pdf,

i have table with
1.username,
2.password,
3.email
i may display the all the above values in that pdf,please help me
0

#10 User is offline   PeRoChAk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 578
  • Joined: 26-November 10
  • Location:Lahore, Pakistan

Posted 24 June 2011 - 12:42 PM

How I Generate PDF

1 - I created a a controller action that have no View

I set all the data to PDF and use the output function to make it as PDF
Yii::createComponent('application.extensions.tcpdf.ETcPdf', 
															'P', 'cm', 'A4', true, 'UTF-8');
								$pdf->SetCreator(PDF_CREATOR);
								$pdf->SetAuthor("");
								$pdf->SetTitle("Jurney Info");
								$pdf->SetSubject("Journey");
								$pdf->SetKeywords("TCPDF, PDF, example, test, guide");
								$pdf->setPrintHeader(false);
								$pdf->setPrintFooter(false);
								$pdf->AliasNbPages();
								$pdf->AddPage();

								
$html='';							
// Add Your data to make it in PDF 


// After having PDF data, use this to make PDF output
	$pdf->writeHTML($html, true, false, false, false, '');
								$pdf->LastPage();

								$pdf->Output('pdf file name.pdf', 'F');
								Yii::app()->end();


Cheers
Perochak
Web Design - Logo Design - Application Development

My Blog | Forums Comparison
0

#11 User is offline   Karthik12 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 15-March 11

Posted 25 June 2011 - 12:35 AM

public function actionTest(){

//require_once('../config/lang/eng.php');
//require_once('../tcpdf.php');
$pdf = Yii::createComponent('application.extensions.tcpdf.TcPdf',
                            'P', 'cm', 'A4', true, 'UTF-8');
//$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF NAGRAJ');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
$pdf->setPrintHeader(true);
$pdf->setPrintFooter(true);
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING);

// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

// ---------------------------------------------------------

// set default font subsetting mode
$pdf->setFontSubsetting(true);

// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->SetFont('dejavusans', '', 14, '', true);

// add a page
$pdf->AddPage();

// This method has several options, check the source code documentation for more information.
// Set some content to print
//Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M')

// test Cell stretching
$pdf->Cell(0, 0, 'TEST CELL STRETCH: no stretch', 1, 1, 'C', 0, '', 0);
$pdf->Cell(0, 0, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1);
$pdf->Cell(0, 0, 'TEST CELL STRETCH: force scaling', 1, 1, 'C', 0, '', 2);
$pdf->Cell(0, 0, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3);
$pdf->Cell(0, 0, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4);

$pdf->Ln(5);

$pdf->Cell(45, 0, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1);
$pdf->Cell(45, 0, 'TEST CELL STRETCH: force scaling', 1, 1, 'C', 0, '', 2);
$pdf->Cell(45, 0, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3);
$pdf->Cell(45, 0, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4);

$pdf->AddPage();

// example using general stretching and spacing

for ($stretching = 90; $stretching <= 110; $stretching += 10) {
        for ($spacing = -0.254; $spacing <= 0.254; $spacing += 0.254) {

                // set general stretching (scaling) value
                $pdf->setFontStretching($stretching);

                // set general spacing value
                $pdf->setFontSpacing($spacing);

                $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, no stretch', 1, 1, 'C', 0, '', 0);
                $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, scaling', 1, 1, 'C', 0, '', 1);
                $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, force scaling', 1, 1, 'C', 0, '', 2);
                $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, spacing', 1, 1, 'C', 0, '', 3);
                $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, force spacing', 1, 1, 'C', 0, '', 4);

                $pdf->Ln(2);
        }
}
// ---------------------------------------------------------

// Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output('NAGRAJ.pdf', 'I');

the following code shoud be placed in cntroller and go to browser
http://localhost/app.../index.php/(the code placed controller table name/test
0

#12 User is offline   Karthik12 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 15-March 11

Posted 25 June 2011 - 12:40 AM

hi all,
Am struck with problem am generating pdf files but i cant enter data into that file .please any one help me for that problem.
0

#13 User is offline   PeRoChAk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 578
  • Joined: 26-November 10
  • Location:Lahore, Pakistan

Posted 25 June 2011 - 01:18 AM

Use my code

and use $html variable to store data to be printed.

How to get the data

Use Models to get the data form database

Example

1 - Table : Products
2 - Model : Products
3 - $product_data=Products::model()->findByPk(1);
4 - $html.='<b>Product Name</b>:'.$product_data->name;

5 - Place data to pdf object as $pdf->writeHTML($html, true, false, false, false, '');

now print the page.

What I can Understand by your last post is that, you does not know How to get the data that you want to print, so for that, you need to work with your database/text file and take the data from your either source and use HTML to store and print it.

Thanks

Don't forget to +Vote if your issue get Solved.
Cheers
Perochak
Web Design - Logo Design - Application Development

My Blog | Forums Comparison
0

#14 User is offline   Karthik12 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 15-March 11

Posted 28 June 2011 - 01:27 AM

View PostPeRoChAk, on 25 June 2011 - 01:18 AM, said:

Use my code

and use $html variable to store data to be printed.

How to get the data

Use Models to get the data form database

Example

1 - Table : Products
2 - Model : Products
3 - $product_data=Products::model()->findByPk(1);
4 - $html.='<b>Product Name</b>:'.$product_data->name;

5 - Place data to pdf object as $pdf->writeHTML($html, true, false, false, false, '');

now print the page.

What I can Understand by your last post is that, you does not know How to get the data that you want to print, so for that, you need to work with your database/text file and take the data from your either source and use HTML to store and print it.

Thanks

Don't forget to +Vote if your issue get Solved.

Thank you for giving reply,
but i cant get it please send me any sample code
0

#15 User is offline   PeRoChAk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 578
  • Joined: 26-November 10
  • Location:Lahore, Pakistan

Posted 28 June 2011 - 08:42 AM

Oh buddy,

let me give a short example

$html.='Hello World';
$pdf->writeHTML($html, true, false, false, false, '');

So, what happened?

what we set for $html, will be written on PDF.

If you have no understanding of How to assign values to a variable or do not know how to fetch and process data from database, then you should study first about these.

Thanks
Cheers
Perochak
Web Design - Logo Design - Application Development

My Blog | Forums Comparison
0

#16 User is offline   Karthik12 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 15-March 11

Posted 29 June 2011 - 12:34 AM

View PostPeRoChAk, on 28 June 2011 - 08:42 AM, said:

Oh buddy,

let me give a short example

$html.='Hello World';
$pdf->writeHTML($html, true, false, false, false, '');

So, what happened?

what we set for $html, will be written on PDF.

If you have no understanding of How to assign values to a variable or do not know how to fetch and process data from database, then you should study first about these.
thanks for giving reply ...any sample code send me .
i have table name tbl_enter
1.uniqueid
2.name.
3.passworld,

am new to this yii frame work

Thanks

0

#17 User is offline   Karthik12 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 15-March 11

Posted 29 June 2011 - 12:34 AM

thanks for giving reply ...any sample code send me .
i have table name tbl_enter
1.uniqueid
2.name.
3.passworld,

am new to this yii frame work
0

#18 User is offline   Karthik12 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 15-March 11

Posted 29 June 2011 - 12:35 AM

thanks for giving reply ...any sample code send me .
i have table name tbl_enter
1.uniqueid
2.name.
3.passworld,

am new to this yii frame work
0

#19 User is offline   PeRoChAk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 578
  • Joined: 26-November 10
  • Location:Lahore, Pakistan

Posted 29 June 2011 - 04:12 AM

Ok

Following Code will fetch data from Enter model which is for table tbl_enter

$html='<table><tr><td>ID</td><td>Name </td><td>Pass World</td></tr>';
$model=Enter::model()->findAll();
if(!empty($model)){
  foreach($model[0] as $data){
  $html.='<tr><td>'.$data['uniqueid'].'</td><td>'.$data['name'].'</td><td>'.$data['passworld'].'</td></tr>';
  }
}
$html.='</table>';


the following code is the object of PDF ext which will print the $html data to the pdf file

$pdf->writeHTML($html, true, false, false, false, '');

Cheers
Perochak
Web Design - Logo Design - Application Development

My Blog | Forums Comparison
0

#20 User is offline   Karthik12 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 15-March 11

Posted 30 June 2011 - 04:03 AM

thank you
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users