I’m familiar with creating wordpress plugins. I tried hard to make fpdf plugin to create pdf file from php contents, but IT didn’t work
I now that :
require_once("fpdf.php");
should comes at the top of my file, and I think that is my main problem
below is how to create a simple pdf file from php script using fpdf:
require('fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
What I should do to make it work?
The question is, how do you convert your html to pdf output? To get your PDF to look like your webpage, that is, with all the html+css, I don’t believe this library will do it.
If you just want to get the post_content from a post, and put it into a pdf, you could do this:
To create a plugin:
You’ll need to add a folder to /wp-content/plugins/ and create your plugin file in that folder:
/wp-content/plugins/fpdf/fpdf.php
This would output a pdf on every page load, after you activate the plugin, which is not likely what you’re looking for…
If you are sure the problem in
require('fpdf.php');
then use full file path as follows