Closed juriansluiman closed 12 years ago
If I understand you correctly, you'd like to use your own instance of DOMPDF in DOMPDFModule?
Would it make more sense to change the DOMPDF package (https://github.com/raykolbe/dompdf) to incorporate a DOMPDF service here? This would allow consumers the ability to use just the DOMPDF package without relying on Zend\View and everything that comes with that.
I have added support for specifying paper size, paper orientation, and base path on an individual PdfModel instance basis.
This is as of commit b77aa55d1c.
You can accomplish this by returning PdfModel such as:
return new PdfModel(
array('model' => $model),
array(
'paperSize' => 'a4',
'paperOrientation' => 'landscape',
'basePath' => '/'
)
);
or you can manually call setPaperSize, setPaperOrientation, setBasePath on PdfModel before returning it.
Can you elaborate a little more as to why you use utf8_decode($html)?
@raykolbe thanks for the modifications, great! Whether this would suit best in the DomPdf module or this module, I don't know but I think this fix is good enough.
Re utf-8: we had many problems with Unicode support in previous versions of DomPdf. The code was a simple copy/paste, but in the latest DomPdf versions there is a proper fix for this. So don't bother that ;)
Now the DomPdf class is instantiated directly (see https://github.com/raykolbe/DOMPDFModule/blob/master/src/DOMPDFModule/View/Renderer/PdfRenderer.php#L38). But for example we always use DomPdf with these configuration options:
If you configure the DomPdf as a service, I can overwrite the service with these properties and then be more flexible in my pdf rendering.