I’m new to the forum and I have a problem that is probably super easy to resolve for someone with a little skills in WP developing :-).
I want to create a plugin that creates PDFs. I’m using FPDF since I have been using it before and I think it works great.
My problem is when I try to require the fpdf class I get the error: Fatal error: Cannot declare class FPDF, because the name is already in use in /wp-content/plugins/tage-test/fpdf181/fpdf.php on line 12
Below is a simplified version where I just try to create a PDF file. If anyone could please help me or point me in the right direction I would really appreciate it!
add_shortcode(‘create_invoice’, ‘marathon_form’);
require_once(‘fpdf181/fpdf.php’);
function marathon_form(){
$pdf = new FPDF();
$pdf->SetDisplayMode(‘fullpage’);
$pdf->SetMargins(0, 15);
$pdf->AddFont(‘VerlagBook’,”,’HBGMv-Book.php’);
$pdf->AddFont(‘VerlagBold’,’B’,’HBGMv-Bold.php’);
$pdf->AddPage(‘P’, ‘A4’);
$pdf->SetFont(‘VerlagBold’,’B’,15);
$pdf->Cell(185,5,’Invoice’,0,1,’R’);
$outputName = ‘invoice.pdf’;
$pdf->Output($outputName, ‘F’);
}