I've tried using the following code to write a variable to a PDF file, but it only returns a blank PDF. How do you write a php variable to a library using the FPDF library?
-
<?php
-
session_start();
-
require('../fpdf.php');
-
if (isset ($_POST['sig'])) {
-
$_POST['sig'] = $SESSION['sig'];
-
$pdf = new FPDF();
-
$pdf->AddPage();
-
$pdf->SetFont('Arial','B',16);
-
$_SESSION['sig'] = $sig;
-
$pdf->Cell(40,10, $sig);
-
$filename = '/var/www/html/foo/foo.pdf';
-
$pdf-> Output($filename, 'F');
-
}
-
session_destroy();
-
exit;
-
?>
-
<!DOCTYPE html>
-
<body>
-
<br> <br>
-
<form action="" method="post'>
-
<label for "sig">Signature: </label>
-
<input type="text" name="sig" placeholder="your signature here" id="sig" required>
-
<br> <br>
-
<input type="submit" value="Sign Document">
-
</form>
-
</body>
-
</html>
-