Comments (5)
You could use DOMPDF directly by grabbing an instance of it from ServiceLocator.
$dompdf = $serviceManager->get('DOMPDF');
$dompdf->load_html($html);
file_put_contents('someFileOfMine.pdf', $dompdf->render());
This is untested but I believe it should work.
Please note that when you call for DOMPDF from the service locator, you are getting a new instance each time.
Also, using DOMPDF directly like this, you lose rendering support. Perhaps another service should be included in the module that is responsible for template rendering. I have to think about this some more. If you have suggestions let me know ;-)
Leaving this issue open right now for discussion.
from dompdfmodule.
I managed to stream it as email attachment by doing so:
// generate PDF
$pdf = new PdfModel();
$pdf->setOption('filename', 'user_details-' . date("Y_m_d"));
$pdf->setOption('paperSize', 'a4');
$pdf->setVariables(array(
'User' => $User,
));
// Render PDF
$pdfView = new ViewModel($pdf);
$pdfView->setTerminal(true)
->setTemplate('Application/index/pdf')
->setVariables(array(
'User' => $User,
));
$html = $this->getServiceLocator()->get('viewpdfrenderer')->getHtmlRenderer()->render($pdfView);
$eng = $this->getServiceLocator()->get('viewpdfrenderer')->getEngine();
$eng->load_html($html);
$eng->render();
$pdfCode = $eng->output();
from dompdfmodule.
I am new to DOMPDF and confused about its use. please guide me how to use this in ZF2. where I should place this folder in my project and how to install it
from dompdfmodule.
Hi,
I was trying to use bellow code
$sm = $this->getServiceLocator();
$dompdf = $sm->get('DOMPDF');
$homepage = file_get_contents('http://www.gmail.com/');
$dompdf->load_html($homepage);
file_put_contents('someFileOfMine.pdf', $dompdf->render());
and got this error :(
Call to a member function get_current_line_box() on a non-object in E:\websites\sticky_notes\vendor\dompdf\dompdf\include\absolute_positioner.cls.php on line 92
Please advice.
Thank you,
Vaibhav
from dompdfmodule.
Hi all,
As you've noticed DOMPDFModule hasn't received the time and attention it deserves. I understand how frustrating this is and I'm sorry you've had to deal with this frustration 😢
I'm currently taking steps to stabilize DOMPDFModule which includes code updates as well as creating a backlog that will ensure its continued success.
You can follow project Phoneix to see what immediate work is being prioritized.
Thank you for your understanding and patience.
from dompdfmodule.
Related Issues (20)
- cant install via composer HOT 2
- Options for setOptions? HOT 1
- Manual setup guide HOT 2
- 0.3.1 Has dependency problem HOT 2
- How to generate pdf files on server side HOT 4
- enable_remote HOT 1
- Example code HOT 1
- DOMPdf wouldn't work on my Linux box HOT 4
- Need a new tag HOT 3
- Output is not aligned properly HOT 5
- Call to undefined method Zend\Mvc\View\Http\ViewManager::getResolver() HOT 12
- Fatal error HOT 2
- PHP7 compatibility (update composer to dompdf 0.7.0)? HOT 3
- Does this work with ZF3? HOT 3
- zend-console dependency breaks existing code HOT 8
- Can't include project images or css
- how to add custom fonts for verson 0.7.0??
- How To: Get DOMPDFModule working with ZF3 HOT 3
- Create a tag @ #a2e2e15 HOT 1
- Setting ZF Name in Readme.md
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dompdfmodule.