jkuchar / PdfResponse

Project that generates PDF from HTML template. Project can be integrated into Nette-based project as PresenterResponse.
http://addons.nette.org/cs/pdfresponse
GNU Lesser General Public License v3.0
10 stars 24 forks source link

Simpler configuration and extension #33

Open janfejtek opened 3 years ago

janfejtek commented 3 years ago

Currently, there is no global way to set default mpdf configuration or temp directory. Configuration is constant in createMPDF() factory method. You have to create a factory for PDFResponse (and set createMPDF callback) or inherit PDFResponse class and override it or set it for each PDFResponse object

I propose following changes:

  1. Add static variables defaultConfig, defaultTempDir and defaultCreateMPDF which will be used if set. Config will be merged with current default config
  2. Add DI extension to have possibility to set these variables (maybe others like documentAutor) and automatically assign Nette temp dir. This will create dependency on nette/di

I think this can can be implemented without BC and I can create PR.

jkuchar commented 3 years ago

I would prefer to have config/factory object (which can be registered into DI), which can then create PdfResponse objects

jkuchar commented 3 years ago

Please go ahead and send PR! :-)