Is it possible to output a pdf on the fly using:
Response.ContentType="Application/pdf"
I have a table full of php variables that I want to output in the pdf using the method above. How would I create the pdf when the user clicks a button on the website and display the content from the table?
UPDATE:
Using html2pdf I’m getting the following error:
Warning: Cannot modify header information - headers already sent by (output started at /home/medilogi/public_html/v1/wp-content/themes/default/header.php:8) in /home/medilogi/public_html/v1/wp-content/themes/default/html2pdf/_tcpdf_5.0.002/tcpdf.php on line 6122
TCPDF ERROR: Some data has already been output to browser, can't send PDF file
<?php
$content = "test";
require_once(dirname(__FILE__).'/html2pdf/html2pdf.class.php');
$html2pdf = new HTML2PDF('P', 'A4', 'en');
$html2pdf->WriteHTML($content);
$html2pdf->Output('example.pdf');
?>
You need to create the pdf before. This response is used only from browser to parse the content type (open directly the PDF using your PDF reader instead of download it).
You can use html2pdf or FPDF. Last year I used xslt and apache fop.