1

Hi
I am using Html2pdf with CodeIgniter in my project and i have to genrate pdf with Some pictures and charts.
I am using version 1.7.2 and CI Html2pdf version 3 .*.
I Am Not Able to insert / put images in pdf file.
bellow Is The Code I Have Written
then this is plugin named to_pdf_pi
<? Php if (! Defined ('basePath')) exit ('No direct script access Allowed');
pdf_create function ($ html, $ filename, $ stream = TRUE)
(
require_once ('html2pdf/html2pdf.class.php');
$ Html2pdf Html2pdf = new ('P', 'A4', 'en', false, 'ISO-8859-15', 2);
$ Html2pdf-> WriteHTML ($ html, isset ($ _GET ['vuehtml']));
$ Html2pdf-> Output ($ filename);
)
?>


and in my controller

$ This-> load-> plugin ('to_pdf');
$ Data = "";
$ Content = $ this-> load-> view (rpt.php '1 ', $ data, true);
pdf_create ($ content, "test.pdf");

and this is my view (view/1rpt.php) file

<! DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML 1.0 Transitional / / EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title> Untitled Document </ title>
</ Head>
<body>
<img src="images/loginpage_12.jpg" alt="logo" style="width: 50mm" />
</ Body>
</ Html>



please anyone can help
thanks in advance
Vaibhav Malushte
Vaibhav Malushte

2

vaibhavmalushte (./1) :
$ Html2pdf Html2pdf = new ('P', 'A4', 'en', false, 'ISO-8859-15', 2);


what is this ? the right syntax is :
$Html2pdf = new HTML2PDF('P', 'A4', 'en', false, 'ISO-8859-15', 2);
but only for the v4.x

if you use the v3.x read the examples
and you hav not to use html, head, body tags. see the wiki about the page tag.
Ancien pseudo : lolo

3

Hi Lien
Thanks for your replly,
I had changed the line but same error.

Thanks once again for your reply
Vaibhav Malushte

4

vaibhavmalushte (./3) :
I had changed the line but same error.


what is exactly the error ?
Ancien pseudo : lolo

5

Hi,
I am able to see the html page in browser if i change this to
$html2pdf->writeHTML($html, true);

I am able to genrate the pdf with "A drawing error occoured" error and if i scrowel up and down pdf is getting cleared.
I am attaching resultant file please take a look at it.
tromb Fichier joint : http___localhost_cihtml2pdf_.pdf
Vaibhav Malushte

6

have you test the examples ? are they working directly with CodeIgniter ?
Ancien pseudo : lolo

7

examples are not working even if i tried them without CodeIgniter
Vaibhav Malushte

8

are you under PHP4 ? or PHP5 ? what is the exact version oF html2pdf ? what do you mean by "not working"
Ancien pseudo : lolo

9

i am using php 5 and u am using HTML2PDF version 4
/**
* Logiciel : HTML2PDF
*
* Convertisseur HTML => PDF, utilise TCPDF
* Distribué sous la licence LGPL.
*
* @author Laurent MINGUET <webmaster@html2pdf.fr>
* @version 4.00
*/

i have attached ewsultant pdf file, have u seen that?
"not woking" meaning examples are also giving the same result if i tried to insert image.
if I remove images it is wokring fine

Vaibhav
Vaibhav Malushte

10

the examples also are not working with images ???? and if you try to open directly the pdf files in exemple/pdf/ directory ?
Ancien pseudo : lolo

11

attaching the error screen shot,tromb Fichier joint : NNuw (error_pdf.jpg)

please take a look at it

thanks
Vaibhav Malushte

12

ok, ben when you open directly the pdf generate files in example/pdf/ ?
Ancien pseudo : lolo

13

i got a msg that file is damage
Vaibhav Malushte

14

Ancien pseudo : lolo

15

same error
Vaibhav Malushte

16

Hi,
I have tried the same on another computer and belive it or not it was working ....
I am using widows vista and i think there must be some problem on my computer.
any ways thanks for your help and thanks for such a wonderfull lib.
thanks a lots once again
--Vaibhav Malushte
vaibhav.malushte@gmail.com
Vaibhav Malushte

17

if you find where it come from, could you tell us ? thx smile
Ancien pseudo : lolo