Download the PHP package 2lenet/pdf-generator-bundle without Composer
On this page you can find all versions of the php package 2lenet/pdf-generator-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package pdf-generator-bundle
PdfGeneratorBundle
Installation
composer require 2lenet/pdf-generator-bundle
Require: unoserver (for word_to_pdf)
Configuration
config (with default value):
add routing (for show the ressource use )
if you create an model without type and with ressource is mydoc.doc the generator will create an pdf based on data/pdfmodel/mydoc.doc with word_to_pdf generator.
Configure your tags
You can easily list the tags used in your models.
To do this, simply declare the route to the page where the tags will be listed. The name of the route is " lle_pdf_generator_admin_balise".
Example in Crudit:
If you use several document templates linked to different modules, you can declare your annotations in the pdf_generator.yaml of your project:
To complete the list of tags, use Symfony annotations declared in your pdf_generator.yaml file. For example:
If you only have on template or one module using several templates, you do not have to declare "data_models" in the pdf_generator.yaml file. By default, the Symfony annotation will be "pdfgenerator". In your entity, you will then have:
Use it
You can use the PDFgenerator with bdd or directly in code
You can create an instance of TcpdfFpdi (Tcpdf and Fpdi) with the PdfMerger
Use with your entity:
change config "class" of pdf generator "App/Entity/MyModelPdf"
Use with bdd
The model is a PdfModel with
a code, a ressource, a libelle, a type and a description
you can create a model with
!! Warning if you use your own class and this class has other field with constraint the command not work. !!
Create your own type
you can create several type of pdf (already exist tcpdf and word_to_pdf)
- word_to_pdf (the ressource is an path of .docx format Microsoft Word XML)
- tcpdf (the ressource is an class which extend Lle\PdfGeneratorBundle\Lib\Pdf (Tcpdf and Fpdi))
You can create your own type with an class which extend Lle\PdfGeneratorBundle\Generator\AbstractPdfGenerator
AbstractPdfGenerator implements Lle\PdfGeneratorBundle\Generator\PdfGeneratorInterface (autotagged lle.pdf.generator)
an exemple is:
Use the type tcpdf
An exemple for tcpdf:
You can create an pdf model in bdd with ressource "App\Service\Pdf\MyTcpdfClass" and code MYTCPDF type "tcpdf"
use the word_to_pdf (format Microsoft Word XML)
Create a .docx file /data/pdfmodel/test.docx with Hello ${name}
You can create an pdf model in bdd with ressource "test.docx" and code MYDOC type "word_to_pdf"
you can use variables ${@img[logo]:100x200} or ${@img[logo]} for create images. (regex is #^@img[(\w+)](:(\d+)x( \d+))?$#)
search to {{lle_pdf_generator.path}}/logo.png so default is data/pdfmodel/logo.png
search to /logo.png
https://phpword.readthedocs.io/en/latest/templates-processing.html
Sign pdf
Use the Lle\PdfGeneratorBundle\Lib\Signature class you can sign an pdf response or an PdfMerge
Cretae the signature
You can add an draw with signature
You can also add segment or points for create the signature picture
Pdf response
Pdf Merger
The pdfMerge is the class of instance return by generator
You can't signed a pdfMerger you have to pass by TcpdfFpdi. An PdfMerger instance can never be signed
You can continue to sign an TcpdfFpdi with $generator->signeTcpdfFpdi($pdf, $signature)
You can also use directly the signature instance for sign a Pdfmerger or TcpdfFpdi
or
You can't use several sign with PdfMerger
ieterable data
create a .docx file and create 2 table (1 line , 3 cells)
- first table cells 1 write ${eleves.nom} , cells 2 write ${eleves.etablissement.nom}, cells 3 write ${@img[eleves.logo]}
- second table cells 1 write ${users.[nom]}, cells 2 write ${users.[adresse][rue]}, cells 3 write ${@img[users.[logo]]}
save it with myiterable.docx use the Lle\PdfGeneratorBundle\Lib\PdfIterable class
show it
Warning only the first level of data can to be an PdfIterable, you can't use ${etablissement.eleves}:
Understand the property (word to pdf)
The property is read with propertyAccesor (Symfony) but the first is beetween two "[]": [first].rest
!!! warning use the same systeme if you create your own type !!!
Merge several model
in bdd:
The default type is always the first (here "word_to_pdf")
if none type is defined the type is lle_pdf_generator.default_generator config
Migrate to pdf generator v3
There is few breaks in backward compatibility in v3. Here is the steps to migrate :
@LlePdfGeneratorBundle/Resources/routing/routes.yaml
is now in@LlePdfGeneratorBundle/Resources/config/routes.yaml
- The class
Lle\PdfGeneratorBundle\Entity\PdfModelCustomFileTrait
is replaced byLle\PdfGeneratorBundle\Entity\PdfModelTrait
and now the trait include the$file
property - The route
lle_pdf_generator_show_ressource
change tolle_pdf_generator_show_model
- The route
lle_pdf_generator_show_pdf
change tolle_pdf_generator_download_model
All versions of pdf-generator-bundle with dependencies
laminas/laminas-escaper Version ^2.11
symfony/property-access Version ^6.0 || ^7.0
phpoffice/phpword Version ^0.18
tecnickcom/tcpdf Version ^6.3
vich/uploader-bundle Version ^1.19 || ^2.0
symfony/yaml Version ^6.0 || ^7.0
laminas/laminas-stdlib Version ^3.15
symfony/http-foundation Version ^6.0 || ^7.0
symfony/http-client-contracts Version ^v3.4.0
doctrine/orm Version ^2.6 || ^3.0
symfony/routing Version ^6.0 || ^7.0
symfony/framework-bundle Version ^6.0 || ^7.0
doctrine/annotations Version ^1.13
symfony/serializer Version ^6.0 || ^7.0
twig/twig Version ^3.4.3
setasign/fpdi Version ^2.3.6
symfony/process Version ^6.0 || ^7.0
setasign/fpdf Version 1.8.4
alexanderpavlov/pdfmerger Version ^1.0
symfony/dotenv Version ^6.0 || ^7.0