How to overwrite a file with php/jquery database information

Asked

Viewed 54 times

0

I have a program that creates a record on it and I need a function that takes the information registered by the user and fill in a pdf file that is already formatted and stylized as it needs to be. I need a library or function that allows me to record information over the file in order to create a client file on paper

1 answer

0

Using PHP and the FPDF library, you can open a template file and fill in information. Here is an example of how the code looks:

<?php

/***************************
  Sample using a PHP array
****************************/

require('fpdm.php');

$fields = array(
    'name'    => 'My name',
    'address' => 'My address',
    'city'    => 'My city',
    'phone'   => 'My phone number'
);

$pdf = new FPDM('template.pdf');
$pdf->Load($fields, false); // second parameter: false if field values are in ISO-8859-1, true if UTF-8
$pdf->Merge();
$pdf->Output();
?>

You can download the sample code in this link

http://www.fpdf.org/en/script/script93.php

Browser other questions tagged

You are not signed in. Login or sign up in order to post.