Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hallo, I have one problem when I make a report with PHP. I want to convert the report to PDF with fpdf.
when I running it, my report had been display with the correct data from database, but above the report appears this error :

%PDF-1.3 3 0 obj <> endobj 4 0 obj <> stream xœ3Rðâ2Ð35W(çr QÐw3T04Ô30PISp á1 Ò¹ €¤P‘…ž±©‚…±ž¡©BHŠ‚Fbv©Brf^I¢Bvbn©¦BHPŸB Ä0#K„Y`cd ©ó!&›êYX€l71›l¨oˆfªÛA-) endstream endobj 1 0 obj <> endobj 5 0 obj <> endobj 6 0 obj <> endobj 7 0 obj <> endobj 2 0 obj <> >> endobj 8 0 obj << /Producer (FPDF 1.52) /Creator (HTML2FPDF >> http://html2fpdf.sf.net) /CreationDate (D:20130321095643) >> endobj 9 0 obj << /Type /Catalog /Pages 1 0 R /OpenAction [3 0 R /FitH null] /PageLayout /OneColumn >> endobj xref 0 10 0000000000 65535 f 0000000282 00000 n 0000000670 00000 n 0000000009 00000 n 0000000087 00000 n 0000000369 00000 n 0000000465 00000 n 0000000566 00000 n 0000000778 00000 n 0000000902 00000 n trailer << /Size 10 /Root 9 0 R /Info 8 0 R >> startxref 1005 %%EOF

is anyone that can help me?
anyone who knows the answer, please help me..:(
Posted
Comments
enhzflep 21-Mar-13 7:57am    
Might I ask how you propose we would fix unseen code?
Why not provide the code that generates the above? Surely readers will be in a better position to give you an answer than is currently the case.
I suspect it may be a result of character/character sets used. I also note that your pdf doesn't appear to contain the 'contains binary content' flag, though I can't remember if that was a part of the spec for PDF v1.3, nor can I remember what fPdf's approach is 0 whether it's staticm or adapts to the content - IIRC, a pdf that uses flate compression should signify that it contains binary data (i.e, the file isn't comprised only of the first 128 chars - it uses the full 8bits of each char)

I ended up hating fpdf so much that I rewrote a workable before ported it to C++. (I couldn't work out how to, or indeed if you could add (a) bookmarks (b) file attachments.

In any case, it's a pretty weird output - objects out of order, streams found without attributes. Oi Vey!

Here's a 'binary content included' header:
25 50 44 46 2D 31 2E 34 0A 00 78 30 31 00 78 30 32 00 78 30 34 00 78 30 33 0A

Or in human form (. stands in for non-printable 00 character, ◙ stands in for 0A)
%PDF-1.4◙.x01.x02.x04.x03◙

And an example of a correct stream:
38 20 30 20 6F 62 6A 0A 3C 3C 2F 4C 65 6E 67 74 68 20 34 37 2F 46 69 6C 74 65 72 5B 2F 46 6C 61 74 65 44 65 63 6F 64 65 5D 3E 3E 0A 73 74 72 65 61 6D 0A 48 89 33 34 D0 33 50 30 04 11 B9 5C A6 16 A6 30 4E 0E 57 30 32 17 26 67 61 6C 04 54 81 90 84 F0 73 B9 C0 06 20 24 91 B8 50 39 B0 08 48 1F 00 0A 65 6E 64 73 74 72 65 61 6D 0A 65 6E 64 6F 62 6A 0A

Again, in a form we're more familiar with:
8 0 obj
<</Length 47/Filter[/FlateDecode]>>
stream
H‰34Ð3P0¹\¦¦0NW02&galT„ðs¹À $‘¸P9°H
endstream
endobj
Witrotus 23-Mar-13 0:25am    
ok. sorry that i didn't show the code before.
this is the simple code that i had tried:

";
$html .= "<tr valign='top'>";
$html .= "<td>example</td>";
$html .= "<td>Name</td>";
$html .= "<td>Score</td>";
$html .= "</tr>";
$html .= "</table>";

$pdf=new HTML2FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','I',34);
$strContent = $html;
$pdf->WriteHTML($strContent);
$pdf->Output("sample1.pdf","I");
echo $html;
?>

i hope you can help me.
enhzflep 23-Mar-13 20:03pm    
I'll sure sse what I can do.
It turns out that I used to use CezPdf, not fpdf as I had earlier thought. When I tried your example, I realized I needed to get HTML2FPDF. I can't seem to find it. Got a link?
enhzflep 23-Mar-13 23:14pm    
Actually, I just found the html2fpdf site (http://html2fpdf.sourceforge.net/) it looks like it's worth giving a miss - the site itself doesn't even work properly. I'd be inclined to try out html2pdf (note the missing f).
Witrotus 24-Mar-13 21:24pm    
dear ehnzflep, finally i got the answer of my question above hehehe :D
thanks for your will to help :')

but another problems are coming :(
i wanna ask you. hmm do you have a reference how to change font size in pdf ?
i had tried many ways. but it doesn't work :(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900