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   View files Example   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-06-26 (Yesterday) RSS 2.0 feedNot yet rated by the usersTotal: 3 This week: 3All time: 11,364 This week: 15Up
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  
Name: José Quijado <contact>
Classes: 5 packages by
Country: Spain Spain

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  
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

  Files folder image Files  /  dest  
File Role Description
  Accessible without login Plain text file destino.txt Doc. Documentation

  Files folder image Files  /  includes  
File Role Description
  Plain text file pdf_data_injection.class.php Class Class source

  Files folder image Files  /  origen  
File Role Description
  Accessible without login Plain text file formulario.pdf Data Auxiliary data

  Files folder image Files  /  temp  
File Role Description
  Accessible without login Plain text file temporal.txt Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%
Total:3
This week:3
All time:11,364
This week:15Up