Skip to main content
11 events
when toggle format what by license comment
Apr 19, 2017 at 9:06 comment added Vixent Thanks. I did it. I solved overriding the method getPdf of the class Magento\Sales\Model\Order\Pdf\Invoice. In the implemented method I loaded my pdf using: $pdf = new \Zend_Pdf ($pdfPath, null, true); (other stuff) return $pdf;
Apr 14, 2017 at 12:56 comment added Aman Srivastava You can override the class in 2.1 as well using di.xml. The coding pattern is different but logic will remain same here.
Apr 13, 2017 at 15:44 comment added Vixent In Magento 1.9 I can do it overriding method getPdf of \Magento\Sales\Model\Order\Pdf\Invoice.php. But in Magento 2.1 I can't do it in the same way...
Apr 13, 2017 at 15:02 comment added Aman Srivastava Then simply add a line before file is served to browser and save that object in a folder as well.
Apr 13, 2017 at 14:28 vote accept Vixent
Apr 13, 2017 at 14:28 comment added Vixent @Arman It's a good solution. But I simply want to open a pdf file (that I generate before) saved in a folder. I was trying to override the method getPdf of \Magento\Sales\Model\Order\Pdf\Invoice.php but it doesn't work (at least in magento 2.1).
Apr 13, 2017 at 14:10 comment added Mrunmay Deswandikar ++1 from me for answer
Apr 13, 2017 at 14:09 comment added Mrunmay Deswandikar Thanks for updating knowledge. I also came to know about it by your answer.
Apr 13, 2017 at 13:58 comment added Aman Srivastava You'll find pdf directory in model of sales module. There is a PHP file which renders the pdf, you can extend that renderer and customize the pdf as you want.
Apr 13, 2017 at 13:36 comment added Vixent Thanks! Do you know the name of the events (admin panel and user panel) called when the pdf is shown? I want to create an observer and show another pdf.
Apr 13, 2017 at 13:15 history answered Aman Srivastava CC BY-SA 3.0