...

View Full Version : File does not begin with '%PDF-



Anishgiri
09-15-2011, 10:27 AM
I am not familiar of generating pdf from php. I tried the code below, and acrobat display that error?


<?php

$fileName = 'filetest.pdf';
header("Content-type: application/pdf");
header("Content-Disposition: inline; filename=$fileName");

echo "test";

?>

Inigoesdr
09-15-2011, 02:23 PM
You can't just output text and call it a PDF. PDF is a special format that you need to generate. Look in to DOMPDF, FPDF, TCPDF, or the native PDF library if you have it compiled in to PHP.

Anishgiri
09-18-2011, 02:17 AM
You can't just output text and call it a PDF. PDF is a special format that you need to generate. Look in to DOMPDF, FPDF, TCPDF, or the native PDF library if you have it compiled in to PHP.

Thanks for the reply, I have heard of them and is googling to see which one is better to use.

Between DOMPDF, FPDF, TCPDF, MPDF based on your experience which is better in terms of ease of use and capabilities? Which do you prefer?

Inigoesdr
09-18-2011, 05:39 PM
I prefer TCPDF personally because it seems to be the most consistent when writing HTML to the PDF and has some nice features I use frequently like the ability to add a header, background to each page, and auto page break.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum