cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution
New

Using PHP with FPDF (PDF Creation) on GoDaddy

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.

4 REPLIES 4
Helper V
Helper V

Re: Using PHP with FPDF (PDF Creation) on GoDaddy

@rapid,

 

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

GoDaddy 24/7 Support www.x.co/247support
----->NEXIA
New
Solution

Re: Using PHP with FPDF (PDF Creation) on GoDaddy

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.

Helper V
Helper V

Re: Using PHP with FPDF (PDF Creation) on GoDaddy

@rapid,

 

Happy to know that you got it working!, Rock on...

Smiley Happy

 

Regards,

 

Praveen Thomas

GoDaddy 24/7 Support www.x.co/247support
----->NEXIA

Re: Using PHP with FPDF (PDF Creation) on GoDaddy

Thank you sooo sooo soooooooooooooo much Mate..u have no clue how much you have helped me with.