FPDF library "Output" doesn't work?
My problem with [FPDF]
library is the next:
$pdf->Output("doc1.pdf","D");
In the above example I replaced the D
with I
or S
or F
the result is always the same: a popup appears to save or open the file.
I want to save it without a开发者_开发百科 popup into a specific directory.
Have you added an header which tells the browser the output is an pdf file? Try:
header('Content-type: application/pdf');
Just before the output.
maybe use this
$pdf->Output('D:/example2.pdf','F');
F = save to a local file with the name given by name D:/example2.pdf = dest folder and name of file ,,,,
thats it, save it without a windows popup appears
if you read the documentation at http://www.fpdf.org/es/doc/output.htm says that dest should be first and the name second, although all of them are optional.
$pdf->Output("D","example2");
you shouldnt name your file .pdf because it will add it when you download it
Make sure you didn't output absolutely nothing before calling the Output (neither a whitespace, tab or anything) or the browser will just go nuts. Pay special attention at your includes, if any.
精彩评论