<?php
/**
 * Magetop Store
 *
 * @category  Magetop Extensions
 * @package   Magetop_Quotesystem
 * @author    Magetop Developer
 * @copyright Copyright (c) Magetop (https://www.magetop.com)
 * @license   https://www.magetop.com/license.html
 */

namespace Magetop\Quotesystem\Controller\BuyerQuote;

use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\App\Action\Context;
use Magento\Framework\Stdlib\DateTime\DateTime;
use Magento\Framework\App\Response\Http\FileFactory;

class Printpdf extends \Magento\Framework\App\Action\Action
{

    /**
     * Construct
     *
     * @param \Magento\Framework\App\Action\Context $context
     * @param \Magetop\Quotesystem\Model\QuotePdf $quotePdf
     * @param \Psr\Log\LoggerInterface $logger
     */
    public function __construct(
        Context $context,
        \Magetop\Quotesystem\Model\QuotePdf $quotePdf,
        \Psr\Log\LoggerInterface $logger
    ) {
        $this->quotePdf = $quotePdf;
        $this->logger = $logger;
        parent::__construct($context);
    }
    
    /**
     * Print pdf execution
     */
    public function execute()
    {
        $quoteId = $this->getRequest()->getParam('quote_id');
        try {
            $this->quotePdf->generatePdf($quoteId);
        } catch (\Exception $e) {
            $this->logger->info($e->getMessage());
        }
    }
}
