1

Hi all,

Does anyone know what could be wrong when I get this message after creating a PDF file?

"The file is damaged and could not be repaired."

I suspect something is wrong in the PHP environment. I use the html2pdf lib successfully on another server, works like a dream there!
Could it be that I'm missing some PHP extension?

Any help is much appreciated!

Best regards,
Giordano

2

maybe it will help you : topics/120010-v319-blank-document#3
Ancien pseudo : lolo

3


Not sure this is what causes my problem. Minimal code that does not work:

ob_start();
$content = ob_get_clean();
require_once( dirname( __FILE__ ) . "/../phplibs/html2pdf_v3.19/html2pdf.class.php" );
define( "FPDF_FONTPATH", dirname( __FILE__ ) . "/../phplibs/html2pdf_v3.19/_fpdf/font/" );
$html2pdf = new HTML2PDF( 'P','A4','nl' );
$html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
$html2pdf->Output('contract.pdf');

Message: "The file is damaged and could not be repaired."


Looking inside the PDF it starts with:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title></title>
</head>
<body>
%PDF-1.6 3
.....

That's not right, is it?!

Cheers
Giordano

4

no...

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title></title>
</head>
<body> 


where does it come from ?!
Ancien pseudo : lolo

5


No idea whatsoever. I've been doing some debugging this morning but cannot get a handle on it.
Could it be that PHP 5.2.4 poses a problem???

6


For now I've decided to use a workaround: post form to script on the server where things do work.
Not very elegant of course, but it works for now...

7

no, it is not PHP. It must be your program. It is adding automatically this html code.

try to see where the text "doctype" appears, with a global search on all your files....
Ancien pseudo : lolo