PHP Classes

How to Implement a PHP PDF Generator from Template with a PDF Form Filled with Input Values Using the Package PDF Data Injection: Generate document from PDF form with input values

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-06-26 (9 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 14 This week: 1All time: 11,441 This week: 42Up
Version License PHP version Categories
pdfdatainjection 1.0Freeware5PHP 5, Documents
Description 

Author

This package can generate documents in PDF form with input values.

It can take a PDF form file and pass it to the pdftk program to fill the form inputs with given values.

The resulting PDF document is saved to a new file.

Picture of José Quijado
  Performance   Level  

 

Example

<?php
   
include ('includes/pdf_data_injection.class.php');
   
$objPDF = new PDFDataInjection();
   
$objPDF->setSourcePath('./origen/');
   
$objPDF->setTempPath('./temp/');
   
$objPDF->setDestinationPath('./dest/');
   
$objPDF->setPDF('formulario.pdf');
   
$datos = [
       
'campo_edad' => '2',
       
'campo_comunitario' => 'comunitario',
       
'campo_ciudad' => 'Madrid',
    ];
   
$objPDF->setFormData($datos);

   
$objPDF->createFDF();

   
$objPDF->insertData();

   
$objPDF->injectDataInPDF();

   
$FinalPDFName = $objPDF->getFinalPDFName();



Details

PDFDataInjection

La clase PDFDataInjection

Esta es una clase que te permite partir de un formulario en PDF y precumplimentar todos o algunos de sus campos con valores específicos por programación.

Puedes leer sobre ella en los siguientes artículos:

https://eldesvandejose.com/2019/06/19/editar-formularios-pdf-con-php-i/

https://eldesvandejose.com/2019/06/22/editar-formularios-pdf-con-php-ii/

https://eldesvandejose.com/2019/06/22/editar-formularios-pdf-con-php-y-iii/

En ellos se describen los requisitos previos que debe cumplir tu instalación, así como la forma adecuada de usarla.


  Files folder image Files (6)  
File Role Description
Files folder imagedest (1 file)
Files folder imageincludes (1 file)
Files folder imageorigen (1 file)
Files folder imagetemp (1 file)
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:14
This week:1
All time:11,441
This week:42Up