I have a textarea on my site that users can insert and edit text and thus has formatting and spacing. I would like for the user to push a button and generate a pdf of this textarea with the same format. I have tried allot to resolve this . Are there any good ways to do this in PHP? .
here is my code.
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<form action="new_pdf_test.php" method="post" name="frm1">
<textarea cols="80" id="editor1" name="editor1" rows="10" ></textarea>
<script type="text/javascript">
CKEDITOR.replace( 'editor1' );
</script>
<input type="submit" name="pdf_btn" id="pdf_btn" value="Generate PDF" />
</form>
when user click on "Generate PDF" button page redirect other page to generate PDF. next page code is following.
<?php
require('fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',12);
$pdf->Cell(40,10,$_POST['editor1']);
$pdf->Output();
?>
It creating PDF but not in right way and format. Plz suggest any good way to do this.