how to generate dynamic pdf file where (Name, email, and Address are dynamically generated from database). i used tinymce editor for content and save this content in XML file. I want name,email,address are dynamically change and generate pdf file for these content. i used tcpdf to generate pdf. please help
Asked
Active
Viewed 520 times
1 Answers
0
I think you should go with "MPDF", which supports html for generating pdf from database.
<?php
$html = '
<h1><a name="top"></a>mPDF</h1>
<h2>Basic HTML Example</h2>
This file demonstrates most of the HTML elements.
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
<p>P: Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
<hr />
<div><img src="tiger.wmf" style="float:right;">DIV: Proin aliquet lorem id felis. Curabitur vel libero at mauris nonummy tincidunt. Donec imperdiet. Vestibulum sem sem, lacinia vel, molestie et, laoreet eget, urna. Curabitur viverra faucibus pede. Morbi lobortis. Donec dapibus. Donec tempus. Ut arcu enim, rhoncus ac, venenatis eu, porttitor mollis, dui. Sed vitae risus. In elementum sem placerat dui. Nam tristique eros in nisl. Nulla cursus sapien non quam porta porttitor. Quisque dictum ipsum ornare tortor. Fusce ornare tempus enim. </div>
';
include("../mpdf.php");
$mpdf=new mPDF();
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
?>

Khushboo
- 1,819
- 1
- 11
- 17
-
i declared variable name ($name,$email,$address) in xml file. i just want to php eval() function change these variable into value which i fetch from database. is there any way – user3404850 Aug 01 '14 at 07:17
-
@user3404850: Stop with wanting such specific things. Start with wanting the basics. You don't need eval to set variables from the database. You do something horrible wrong there. You are making it far too complicated for yourself. Just grab a book and spend an hour or two on PHP basics and you will save yourself many questions. – hakre Aug 02 '14 at 09:11