0

My checkout success page print order displays in html. When i print it using a webkit browser the table view is distorted. I think the best way to overcome this issue is to display the print order as PDF instead of html. How can i achieve this in magento?

The issue images available below

Normal view : http://postimg.org/image/xg4drghpz/

Print view : http://postimg.org/image/izh4cvs8n/

  • You could use sth like fpdf and build your own .pdf invoice – Klettseb Apr 26 '16 at 5:46
  • Thanks for the suggestion, I'm trying it using the pdfjs plugin. I'll post an answer once i succeed with it – Lakshin Karunaratne Apr 27 '16 at 9:56
1

Magento uses different template for print view. You may check differences. It is very easy. Go to /app/design/frontend/your_package/your_theme/layout and look in sales.xml

Try to compare sales_order_view and sales_order_print sections. For invoices, shipments, creditmemos it will be similar.

  • Sorry i don't see how this will help me to display print order view in pdf instead of html. – Lakshin Karunaratne Apr 27 '16 at 9:58
  • In this case you can create your own mini extension you should to create block and template which will output order data (or you can use current block "sales/order_print" which uses template "sales/order/print.phtml") In your controller you should to create public function exportPdfAction(){ $fileName = 'order.pdf'; $content = $this->getLayout()->createBlock('your_custom_block')->getPdfFile(); $this->_prepareDownloadResponse($fileName, $content); } – Neklo.com Apr 27 '16 at 10:30
  • 1
    Thanks for the clear explanation. I actually went ahead and created a pdf using the jspdf plugin. Hope this answer will help someone else. – Lakshin Karunaratne Apr 27 '16 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.