fPDF / HTML to PDF - wth Dynamic Data
Posted: Wed Oct 06, 2010 3:39 pm
Hi Everyone,
New programmer here having some problems printing my dynamic data to PDF.
Although I can get a .php page to print in PDF, it does not include any of the dynamic data and it does include some of the php code that shouldn't be printed to PDF.
This is the code in 1.php I'm using to call the contact_pdf.php page I want to convert to PDF:
The sample.pdf does get placed on the desktop, but with no dynamic data. The contact_pdf.php page has my QUERY & RESULTS with the HTML below it. When this page is called directly, the dynamic data is there.
Has anyone used this fPDF and made if work? Any examples or explanations you could share.
I also tried putting the code above into the contact_pdf.php page at the top, at the bottom, but nothing worked.
New programmer here having some problems printing my dynamic data to PDF.
Although I can get a .php page to print in PDF, it does not include any of the dynamic data and it does include some of the php code that shouldn't be printed to PDF.
This is the code in 1.php I'm using to call the contact_pdf.php page I want to convert to PDF:
Code: Select all
require('../scripts/html2pdf/html2fpdf.php');
$pdf=new HTML2FPDF();
$pdf->AddPage();
$fp = fopen("../modules/contact_pdf.php","r");
$strContent = fread($fp, filesize("../modules/contact_pdf.php"));
fclose($fp);
$pdf->WriteHTML($strContent);
$pdf->Output("C:\Users\Me\Desktop\sample.pdf");
echo "PDF file is generated successfully!";Has anyone used this fPDF and made if work? Any examples or explanations you could share.
I also tried putting the code above into the contact_pdf.php page at the top, at the bottom, but nothing worked.