FDPF creates PDFs flawlessy on my local webserver, but I can't get it working on my GoDaddy hosted website. I've installed the FPDF folder and files as required. The Error Log shows no errors. See FDPF test code below:
<html>
<head>
</head>
<body>
<?php
$cwd = getcwd(); // remember the current path
chdir('fpdf');
require('fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output(I,'Test Page');
chdir($cwd); // go back to the inital working directory
?>
</body>
</html>
Any help would be appreciated.
Solved! Go to Solution.
Are you working on Website Builder or cPanel?...
I think you may not be able to insert PHP code in custom HTML section...
The website builder will not render PHP code...
Thank you
Regards,
Praveen Thomas
Thanks.
I finally got it working. To summarise the steps needed:
1. zip the fpdf folder and upload using GoDaddy's FileManager. On upload check all the mode boxes (Read, Write, Execute).
2. Right click on the zip file in your server folder and select extract.
3. Use the corrected code below to test if it works (saved as a php file):
<?php
$cwd = getcwd(); // remember the current path
chdir('fpdf');
require('fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output('I','TestPage.pdf');
chdir($cwd); // go back to the inital working directory
?>
4. Use another php with html code (or html page with JS) to call the above php file, which will generate the pdf file as requested.
Happy to know that you got it working!, Rock on...
Regards,
Praveen Thomas
Thank you sooo sooo soooooooooooooo much Mate..u have no clue how much you have helped me with.