I'm struggling with something that I thought would be more straightforward. Hopefully it is and I'm just being a bit slow today.
I want to use HTML2PDF to generate a PDF on the fly with the stock details based on a specific ID.
I have a page that generates the required HTML so that if I open the URL html_generator.php?stockID=1 I get the HTML code that would be required to generate the PDF.
Problem I'm having is getting that stockID into play with a second page pdf_generator.php which passes the html to the html2pdf class and outputs the PDF.
If I use $html=file_get_content(html_generator.php?stockID=1) it looks for that exact URL rather than seeing the get part separately. Same problem if I include that URL.
If call pdf_generator.php?stockID=1 and try to assign $id=$_GET['stockID'], I get an error message relating to headers already being set.
If anyone has any ideas for finding a solution to this, it would be very much appreciated.
Thanks in advance.
The error that headers have been sent means that something was sent to the browser before the PDF header was sent.
This could be a space or line feed before the PHP tags.
Don't echo out anything and let the PDF header be the first thing sent to the browser.
This topic is now closed. New replies are no longer allowed.