I’m trying to get a page title to show up when outputting a pdf with fpdf.
Currently I only get the path to the .php file I’m using to create the pdf. e.g.
If I output anything other than the fpdf code e.g.
<title>This is my title</title>
or
<title><? echo $title ?></title>
I get an error like this…
Some data has already been output, can’t send PDF
This is because you can only output fpdf data on the page apparently. So is it possible to add a title tag somehow with fpdf or rather in conjunction with fpdf?
It would just be much nicer to see a page title rather than the path to my pdf.php file.
Cheers
A pdf file is not an HTML file. The web browser shows a title because reads HTML code and parses it.
Sometimes the web browser renders PDF files because of an external plugin, so, if you want to render HTML code and a PDF file, you have to learn a bit of HTML and use frames or iframes.
Fast snippet:
As you can see, there’s an iframe tag, the iframe is like a box that loads another webpage inside of it, so the web browser will render the HTML code (title included), and then render a box with another different webpage inside (the PDF file), using css you can configure the iframe tag to adjust to web browser size.