Is there a way to call custom admin controller (which prints a pdf file from sales order view page) from frontend download anchor link?

<a href="http://m7.local/index.php/admin/magemechanic_workorder/order/print/order_id/<?php echo $orderId ?>" download>Download</a>

1 Answer 1


As per the updated question, no, you cannot configure Magento to invoke an adminhtml controller from the frontend for security reasons. Put the code in a class, and invoke that class from both the adminthml and frontend controllers separately.

Original answer to the original question regarding invoking one controller from another:

You can invoke a controller just like any other code. Use Dependency Injection to get an instance on your constructor, then invoke a method on that object.

namespace Vendor\Mod\Foo\Bar;

use Vendor\Mod\Controller\Adminhtml\Custom;

class Foobar {

    /** @var Custom */
    protected $_custom;

    public function __construct(Custom $custom)
        $this->_custom = $custom;

    public function foo()


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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