Magento 2 Fatal error: Uncaught Error: Class not foundI created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?Reset Password Problem : Magento 2Not able to add/update magento2 category post upgrade from 1.9 to 2.1.0Trying to uninstall module“Class mixed does not exist” with only one array param in the body in Magento 2Add configure product in Cart using Magento 2 API facing an issuePHP fatal error: Uncaught TypeError: Argument 2 passed to MagentoCatalogPluginBlockTopmenuMagento error when going to forgotten password link
How do anti-virus programs start at Windows boot?
Can hydraulic brake levers get hot when brakes overheat?
Font with correct density?
Good allowance savings plan?
Life insurance that covers only simultaneous/dual deaths
Professor being mistaken for a grad student
RegionDifference for Cylinder and Cuboid
Old race car problem/puzzle
Did CPM support custom hardware using device drivers?
My story is written in English, but is set in my home country. What language should I use for the dialogue?
Humanity loses the vast majority of its technology, information, and population in the year 2122. How long does it take to rebuild itself?
How is the Swiss post e-voting system supposed to work, and how was it wrong?
How could a female member of a species produce eggs unto death?
Instead of Universal Basic Income, why not Universal Basic NEEDS?
How do I hide Chekhov's Gun?
How could a scammer know the apps on my phone / iTunes account?
Meaning of "SEVERA INDEOVI VAS" from 3rd Century slab
Is it normal that my co-workers at a fitness company criticize my food choices?
Why are there 40 737 Max planes in flight when they have been grounded as not airworthy?
Do I need life insurance if I can cover my own funeral costs?
Why did it take so long to abandon sail after steamships were demonstrated?
Co-worker team leader wants to inject his friend's awful software into our development. What should I say to our common boss?
Does the statement `int val = (++i > ++j) ? ++i : ++j;` invoke undefined behavior?
Where is the 1/8 CR apprentice in Volo's Guide to Monsters?
Magento 2 Fatal error: Uncaught Error: Class not found
I created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?Reset Password Problem : Magento 2Not able to add/update magento2 category post upgrade from 1.9 to 2.1.0Trying to uninstall module“Class mixed does not exist” with only one array param in the body in Magento 2Add configure product in Cart using Magento 2 API facing an issuePHP fatal error: Uncaught TypeError: Argument 2 passed to MagentoCatalogPluginBlockTopmenuMagento error when going to forgotten password link
I am using one custom php library in magento 2 to convert html to pdf. Here is the code that i am using.
<?php
namespace CompanyModuleControllerAdminhtmlQuote;
use MagentoFrameworkAppActionAction;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkAppFilesystemDirectoryList as DirectoryList;
use CompanyModuleHelperPdfCrowd;
class QuotePdf extends Action
/**
* @var MagentoFrameworkAppResponseHttpFileFactory
*/
protected $fileFactory;
protected $_mediaDirectory;
protected $directory_list;
protected $dompdfFactory;
protected $layoutFactory;
protected $authSession;
//protected $quote_info;
protected $userFactory;
public function __construct(
Context $context,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkFilesystem $filesystem,
MagentoBackendModelAuthSession $authSession,
DirectoryList $directory_list,
MagentoUserModelUserFactory $userFactory
)
parent::__construct($context);
$this->fileFactory = $fileFactory;
$this->authSession = $authSession;
$this->_mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
$this->directory_list = $directory_list;
$this->userFactory = $userFactory;
public function execute()
if($this->authSession->isLoggedIn())
$id = $this->getRequest()->getParam('id');
$client = new Pdfcrowd("MYUSERNAME", "xxxxxxx-KEY");
// set HTTP response headers
$pdf = $client->convertHtml($this->getHtmlForPdf($id));
header("Content-Type: application/pdf");
header("Cache-Control: no-cache");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=commercialsale-".$id.".pdf");
echo $pdf;
Here is my Helpler file
<?php
namespace CompanyModuleHelper;
class PdfCrowd
//
// Pdfcrowd constructor.
//
// $username - your username at Pdfcrowd
// $apikey - your API key
// $hostname - API hostname, defaults to pdfcrowd.com
//
function __construct($username, $apikey, $hostname=null)
if ($hostname)
$this->hostname = $hostname;
else
$this->hostname = self::$api_host;
$this->useSSL(false);
$this->fields = array(
'username' => $username,
'key' => $apikey,
'pdf_scaling_factor' => 1,
'html_zoom' => 200);
$this->proxy_name = null;
$this->proxy_port = null;
$this->proxy_username = "";
$this->proxy_password = "";
$this->user_agent = "pdfcrowd_php_client_".self::$client_version."_(http://pdfcrowd.com)";
?>
And here is the error that i am getting...
Fatal error: Uncaught Error: Class 'CompanyModuleHelperPdfCrowd'
not found in
/home/patios/public_html/app/code/Company/Module/Controller/Adminhtml/Quote/QuotePdf.php:49
Stack trace: #0
/home/patios/public_html/vendor/magento/framework/App/Action/Action.php(107):
CompanyModuleControllerAdminhtmlQuoteQuotePdf->execute() #1
/home/patios/public_html/vendor/magento/framework/Interception/Interceptor.php(58):
MagentoFrameworkAppActionAction->dispatch(Object(MagentoFrameworkAppRequestHttp))
2 /home/patios/public_html/vendor/magento/framework/Interception/Interceptor.php(138):
CompanyModuleControllerAdminhtmlQuoteQuotePdfInterceptor->___callParent('dispatch',
Array) 3
/home/patios/public_html/vendor/magento/framework/Interception/Interceptor.php(153):
CompanyModuleControllerAdminhtmlQuoteQuotePdfInterceptor->MagentoFrameworkInterceptionclosure(Object(MagentoFrameworkAppRequestHttp))
4 /home/patios/public_html/generated/code/Company/Module/Controller/Adminhtml
in
/home/patios/public_html/app/code/Company/Module/Controller/Adminhtml/Quote/QuotePdf.php
on line 49
Note:
Same code is working on my local and not on live server.
magento2
bumped to the homepage by Community♦ 1 hour ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am using one custom php library in magento 2 to convert html to pdf. Here is the code that i am using.
<?php
namespace CompanyModuleControllerAdminhtmlQuote;
use MagentoFrameworkAppActionAction;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkAppFilesystemDirectoryList as DirectoryList;
use CompanyModuleHelperPdfCrowd;
class QuotePdf extends Action
/**
* @var MagentoFrameworkAppResponseHttpFileFactory
*/
protected $fileFactory;
protected $_mediaDirectory;
protected $directory_list;
protected $dompdfFactory;
protected $layoutFactory;
protected $authSession;
//protected $quote_info;
protected $userFactory;
public function __construct(
Context $context,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkFilesystem $filesystem,
MagentoBackendModelAuthSession $authSession,
DirectoryList $directory_list,
MagentoUserModelUserFactory $userFactory
)
parent::__construct($context);
$this->fileFactory = $fileFactory;
$this->authSession = $authSession;
$this->_mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
$this->directory_list = $directory_list;
$this->userFactory = $userFactory;
public function execute()
if($this->authSession->isLoggedIn())
$id = $this->getRequest()->getParam('id');
$client = new Pdfcrowd("MYUSERNAME", "xxxxxxx-KEY");
// set HTTP response headers
$pdf = $client->convertHtml($this->getHtmlForPdf($id));
header("Content-Type: application/pdf");
header("Cache-Control: no-cache");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=commercialsale-".$id.".pdf");
echo $pdf;
Here is my Helpler file
<?php
namespace CompanyModuleHelper;
class PdfCrowd
//
// Pdfcrowd constructor.
//
// $username - your username at Pdfcrowd
// $apikey - your API key
// $hostname - API hostname, defaults to pdfcrowd.com
//
function __construct($username, $apikey, $hostname=null)
if ($hostname)
$this->hostname = $hostname;
else
$this->hostname = self::$api_host;
$this->useSSL(false);
$this->fields = array(
'username' => $username,
'key' => $apikey,
'pdf_scaling_factor' => 1,
'html_zoom' => 200);
$this->proxy_name = null;
$this->proxy_port = null;
$this->proxy_username = "";
$this->proxy_password = "";
$this->user_agent = "pdfcrowd_php_client_".self::$client_version."_(http://pdfcrowd.com)";
?>
And here is the error that i am getting...
Fatal error: Uncaught Error: Class 'CompanyModuleHelperPdfCrowd'
not found in
/home/patios/public_html/app/code/Company/Module/Controller/Adminhtml/Quote/QuotePdf.php:49
Stack trace: #0
/home/patios/public_html/vendor/magento/framework/App/Action/Action.php(107):
CompanyModuleControllerAdminhtmlQuoteQuotePdf->execute() #1
/home/patios/public_html/vendor/magento/framework/Interception/Interceptor.php(58):
MagentoFrameworkAppActionAction->dispatch(Object(MagentoFrameworkAppRequestHttp))
2 /home/patios/public_html/vendor/magento/framework/Interception/Interceptor.php(138):
CompanyModuleControllerAdminhtmlQuoteQuotePdfInterceptor->___callParent('dispatch',
Array) 3
/home/patios/public_html/vendor/magento/framework/Interception/Interceptor.php(153):
CompanyModuleControllerAdminhtmlQuoteQuotePdfInterceptor->MagentoFrameworkInterceptionclosure(Object(MagentoFrameworkAppRequestHttp))
4 /home/patios/public_html/generated/code/Company/Module/Controller/Adminhtml
in
/home/patios/public_html/app/code/Company/Module/Controller/Adminhtml/Quote/QuotePdf.php
on line 49
Note:
Same code is working on my local and not on live server.
magento2
bumped to the homepage by Community♦ 1 hour ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
2
Check exact folder and class name for CompanyModuleHelperPdfCrowd
– Sohel Rana
Jun 8 '18 at 13:41
Thanks to pointing me. Sorry actually there is capital word issue in my file name. Strange that this is working in my local.
– Hardik
Jun 8 '18 at 13:53
yes, Linux is naming strict type. But other system like windows, mac not.
– Sohel Rana
Jun 8 '18 at 13:55
add a comment |
I am using one custom php library in magento 2 to convert html to pdf. Here is the code that i am using.
<?php
namespace CompanyModuleControllerAdminhtmlQuote;
use MagentoFrameworkAppActionAction;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkAppFilesystemDirectoryList as DirectoryList;
use CompanyModuleHelperPdfCrowd;
class QuotePdf extends Action
/**
* @var MagentoFrameworkAppResponseHttpFileFactory
*/
protected $fileFactory;
protected $_mediaDirectory;
protected $directory_list;
protected $dompdfFactory;
protected $layoutFactory;
protected $authSession;
//protected $quote_info;
protected $userFactory;
public function __construct(
Context $context,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkFilesystem $filesystem,
MagentoBackendModelAuthSession $authSession,
DirectoryList $directory_list,
MagentoUserModelUserFactory $userFactory
)
parent::__construct($context);
$this->fileFactory = $fileFactory;
$this->authSession = $authSession;
$this->_mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
$this->directory_list = $directory_list;
$this->userFactory = $userFactory;
public function execute()
if($this->authSession->isLoggedIn())
$id = $this->getRequest()->getParam('id');
$client = new Pdfcrowd("MYUSERNAME", "xxxxxxx-KEY");
// set HTTP response headers
$pdf = $client->convertHtml($this->getHtmlForPdf($id));
header("Content-Type: application/pdf");
header("Cache-Control: no-cache");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=commercialsale-".$id.".pdf");
echo $pdf;
Here is my Helpler file
<?php
namespace CompanyModuleHelper;
class PdfCrowd
//
// Pdfcrowd constructor.
//
// $username - your username at Pdfcrowd
// $apikey - your API key
// $hostname - API hostname, defaults to pdfcrowd.com
//
function __construct($username, $apikey, $hostname=null)
if ($hostname)
$this->hostname = $hostname;
else
$this->hostname = self::$api_host;
$this->useSSL(false);
$this->fields = array(
'username' => $username,
'key' => $apikey,
'pdf_scaling_factor' => 1,
'html_zoom' => 200);
$this->proxy_name = null;
$this->proxy_port = null;
$this->proxy_username = "";
$this->proxy_password = "";
$this->user_agent = "pdfcrowd_php_client_".self::$client_version."_(http://pdfcrowd.com)";
?>
And here is the error that i am getting...
Fatal error: Uncaught Error: Class 'CompanyModuleHelperPdfCrowd'
not found in
/home/patios/public_html/app/code/Company/Module/Controller/Adminhtml/Quote/QuotePdf.php:49
Stack trace: #0
/home/patios/public_html/vendor/magento/framework/App/Action/Action.php(107):
CompanyModuleControllerAdminhtmlQuoteQuotePdf->execute() #1
/home/patios/public_html/vendor/magento/framework/Interception/Interceptor.php(58):
MagentoFrameworkAppActionAction->dispatch(Object(MagentoFrameworkAppRequestHttp))
2 /home/patios/public_html/vendor/magento/framework/Interception/Interceptor.php(138):
CompanyModuleControllerAdminhtmlQuoteQuotePdfInterceptor->___callParent('dispatch',
Array) 3
/home/patios/public_html/vendor/magento/framework/Interception/Interceptor.php(153):
CompanyModuleControllerAdminhtmlQuoteQuotePdfInterceptor->MagentoFrameworkInterceptionclosure(Object(MagentoFrameworkAppRequestHttp))
4 /home/patios/public_html/generated/code/Company/Module/Controller/Adminhtml
in
/home/patios/public_html/app/code/Company/Module/Controller/Adminhtml/Quote/QuotePdf.php
on line 49
Note:
Same code is working on my local and not on live server.
magento2
I am using one custom php library in magento 2 to convert html to pdf. Here is the code that i am using.
<?php
namespace CompanyModuleControllerAdminhtmlQuote;
use MagentoFrameworkAppActionAction;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkAppFilesystemDirectoryList as DirectoryList;
use CompanyModuleHelperPdfCrowd;
class QuotePdf extends Action
/**
* @var MagentoFrameworkAppResponseHttpFileFactory
*/
protected $fileFactory;
protected $_mediaDirectory;
protected $directory_list;
protected $dompdfFactory;
protected $layoutFactory;
protected $authSession;
//protected $quote_info;
protected $userFactory;
public function __construct(
Context $context,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkFilesystem $filesystem,
MagentoBackendModelAuthSession $authSession,
DirectoryList $directory_list,
MagentoUserModelUserFactory $userFactory
)
parent::__construct($context);
$this->fileFactory = $fileFactory;
$this->authSession = $authSession;
$this->_mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
$this->directory_list = $directory_list;
$this->userFactory = $userFactory;
public function execute()
if($this->authSession->isLoggedIn())
$id = $this->getRequest()->getParam('id');
$client = new Pdfcrowd("MYUSERNAME", "xxxxxxx-KEY");
// set HTTP response headers
$pdf = $client->convertHtml($this->getHtmlForPdf($id));
header("Content-Type: application/pdf");
header("Cache-Control: no-cache");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=commercialsale-".$id.".pdf");
echo $pdf;
Here is my Helpler file
<?php
namespace CompanyModuleHelper;
class PdfCrowd
//
// Pdfcrowd constructor.
//
// $username - your username at Pdfcrowd
// $apikey - your API key
// $hostname - API hostname, defaults to pdfcrowd.com
//
function __construct($username, $apikey, $hostname=null)
if ($hostname)
$this->hostname = $hostname;
else
$this->hostname = self::$api_host;
$this->useSSL(false);
$this->fields = array(
'username' => $username,
'key' => $apikey,
'pdf_scaling_factor' => 1,
'html_zoom' => 200);
$this->proxy_name = null;
$this->proxy_port = null;
$this->proxy_username = "";
$this->proxy_password = "";
$this->user_agent = "pdfcrowd_php_client_".self::$client_version."_(http://pdfcrowd.com)";
?>
And here is the error that i am getting...
Fatal error: Uncaught Error: Class 'CompanyModuleHelperPdfCrowd'
not found in
/home/patios/public_html/app/code/Company/Module/Controller/Adminhtml/Quote/QuotePdf.php:49
Stack trace: #0
/home/patios/public_html/vendor/magento/framework/App/Action/Action.php(107):
CompanyModuleControllerAdminhtmlQuoteQuotePdf->execute() #1
/home/patios/public_html/vendor/magento/framework/Interception/Interceptor.php(58):
MagentoFrameworkAppActionAction->dispatch(Object(MagentoFrameworkAppRequestHttp))
2 /home/patios/public_html/vendor/magento/framework/Interception/Interceptor.php(138):
CompanyModuleControllerAdminhtmlQuoteQuotePdfInterceptor->___callParent('dispatch',
Array) 3
/home/patios/public_html/vendor/magento/framework/Interception/Interceptor.php(153):
CompanyModuleControllerAdminhtmlQuoteQuotePdfInterceptor->MagentoFrameworkInterceptionclosure(Object(MagentoFrameworkAppRequestHttp))
4 /home/patios/public_html/generated/code/Company/Module/Controller/Adminhtml
in
/home/patios/public_html/app/code/Company/Module/Controller/Adminhtml/Quote/QuotePdf.php
on line 49
Note:
Same code is working on my local and not on live server.
magento2
magento2
edited Jul 31 '18 at 5:16
Teja Bhagavan Kollepara
2,98141947
2,98141947
asked Jun 8 '18 at 13:09
HardikHardik
12013
12013
bumped to the homepage by Community♦ 1 hour ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 1 hour ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
2
Check exact folder and class name for CompanyModuleHelperPdfCrowd
– Sohel Rana
Jun 8 '18 at 13:41
Thanks to pointing me. Sorry actually there is capital word issue in my file name. Strange that this is working in my local.
– Hardik
Jun 8 '18 at 13:53
yes, Linux is naming strict type. But other system like windows, mac not.
– Sohel Rana
Jun 8 '18 at 13:55
add a comment |
2
Check exact folder and class name for CompanyModuleHelperPdfCrowd
– Sohel Rana
Jun 8 '18 at 13:41
Thanks to pointing me. Sorry actually there is capital word issue in my file name. Strange that this is working in my local.
– Hardik
Jun 8 '18 at 13:53
yes, Linux is naming strict type. But other system like windows, mac not.
– Sohel Rana
Jun 8 '18 at 13:55
2
2
Check exact folder and class name for CompanyModuleHelperPdfCrowd
– Sohel Rana
Jun 8 '18 at 13:41
Check exact folder and class name for CompanyModuleHelperPdfCrowd
– Sohel Rana
Jun 8 '18 at 13:41
Thanks to pointing me. Sorry actually there is capital word issue in my file name. Strange that this is working in my local.
– Hardik
Jun 8 '18 at 13:53
Thanks to pointing me. Sorry actually there is capital word issue in my file name. Strange that this is working in my local.
– Hardik
Jun 8 '18 at 13:53
yes, Linux is naming strict type. But other system like windows, mac not.
– Sohel Rana
Jun 8 '18 at 13:55
yes, Linux is naming strict type. But other system like windows, mac not.
– Sohel Rana
Jun 8 '18 at 13:55
add a comment |
2 Answers
2
active
oldest
votes
Try this:
<?php
namespace CompanyModuleControllerAdminhtmlQuote;
use MagentoFrameworkAppActionAction;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkAppFilesystemDirectoryList as DirectoryList;
use CompanyModuleHelperPdfCrowd;
class QuotePdf extends Action
/**
* @var MagentoFrameworkAppResponseHttpFileFactory
*/
protected $fileFactory;
protected $_mediaDirectory;
protected $directory_list;
protected $dompdfFactory;
protected $layoutFactory;
protected $authSession;
//protected $quote_info;
protected $userFactory;
protected $_pdfCrowd;
public function __construct(
Context $context,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkFilesystem $filesystem,
MagentoBackendModelAuthSession $authSession,
PdfCrowd $pdfCrowd,
DirectoryList $directory_list,
MagentoUserModelUserFactory $userFactory
)
parent::__construct($context);
$this->_pdfCrowd = $pdfCrowd;
$this->fileFactory = $fileFactory;
$this->authSession = $authSession;
$this->_mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
$this->directory_list = $directory_list;
$this->userFactory = $userFactory;
public function execute()
if($this->authSession->isLoggedIn())
$id = $this->getRequest()->getParam('id');
$client = $this->_pdfCrowd->createPdf("MYUSERNAME", "xxxxxxx-KEY");
// set HTTP response headers
$pdf = $client->convertHtml($this->getHtmlForPdf($id));
header("Content-Type: application/pdf");
header("Cache-Control: no-cache");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=commercialsale-".$id.".pdf");
echo $pdf;
I have replaced method name and called with dependency injection.
<?php
namespace CompanyModuleHelper;
class PdfCrowd
//
// Pdfcrowd constructor.
//
// $username - your username at Pdfcrowd
// $apikey - your API key
// $hostname - API hostname, defaults to pdfcrowd.com
//
function createPdf($username, $apikey, $hostname=null)
if ($hostname)
$this->hostname = $hostname;
else
$this->hostname = self::$api_host;
$this->useSSL(false);
$this->fields = array(
'username' => $username,
'key' => $apikey,
'pdf_scaling_factor' => 1,
'html_zoom' => 200);
$this->proxy_name = null;
$this->proxy_port = null;
$this->proxy_username = "";
$this->proxy_password = "";
$this->user_agent = "pdfcrowd_php_client_".self::$client_version."_(http://pdfcrowd.com)";
?>
This error. Class CompanyModuleHelperPdfCrowd does not exist in [CompanyModuleControllerAdminhtmlQuoteQuotePdfInterceptor]
– Hardik
Jun 8 '18 at 13:38
please run thisphp bin/magento setup:di:compile
thenphp bin/magento cache:flush
– kunj
Jun 8 '18 at 14:22
add a comment |
Use below on your helper file:
class PdfCrowd extends MagentoFrameworkAppHelperAbstractHelper
instead of
class PdfCrowd
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f229214%2fmagento-2-fatal-error-uncaught-error-class-not-found%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this:
<?php
namespace CompanyModuleControllerAdminhtmlQuote;
use MagentoFrameworkAppActionAction;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkAppFilesystemDirectoryList as DirectoryList;
use CompanyModuleHelperPdfCrowd;
class QuotePdf extends Action
/**
* @var MagentoFrameworkAppResponseHttpFileFactory
*/
protected $fileFactory;
protected $_mediaDirectory;
protected $directory_list;
protected $dompdfFactory;
protected $layoutFactory;
protected $authSession;
//protected $quote_info;
protected $userFactory;
protected $_pdfCrowd;
public function __construct(
Context $context,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkFilesystem $filesystem,
MagentoBackendModelAuthSession $authSession,
PdfCrowd $pdfCrowd,
DirectoryList $directory_list,
MagentoUserModelUserFactory $userFactory
)
parent::__construct($context);
$this->_pdfCrowd = $pdfCrowd;
$this->fileFactory = $fileFactory;
$this->authSession = $authSession;
$this->_mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
$this->directory_list = $directory_list;
$this->userFactory = $userFactory;
public function execute()
if($this->authSession->isLoggedIn())
$id = $this->getRequest()->getParam('id');
$client = $this->_pdfCrowd->createPdf("MYUSERNAME", "xxxxxxx-KEY");
// set HTTP response headers
$pdf = $client->convertHtml($this->getHtmlForPdf($id));
header("Content-Type: application/pdf");
header("Cache-Control: no-cache");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=commercialsale-".$id.".pdf");
echo $pdf;
I have replaced method name and called with dependency injection.
<?php
namespace CompanyModuleHelper;
class PdfCrowd
//
// Pdfcrowd constructor.
//
// $username - your username at Pdfcrowd
// $apikey - your API key
// $hostname - API hostname, defaults to pdfcrowd.com
//
function createPdf($username, $apikey, $hostname=null)
if ($hostname)
$this->hostname = $hostname;
else
$this->hostname = self::$api_host;
$this->useSSL(false);
$this->fields = array(
'username' => $username,
'key' => $apikey,
'pdf_scaling_factor' => 1,
'html_zoom' => 200);
$this->proxy_name = null;
$this->proxy_port = null;
$this->proxy_username = "";
$this->proxy_password = "";
$this->user_agent = "pdfcrowd_php_client_".self::$client_version."_(http://pdfcrowd.com)";
?>
This error. Class CompanyModuleHelperPdfCrowd does not exist in [CompanyModuleControllerAdminhtmlQuoteQuotePdfInterceptor]
– Hardik
Jun 8 '18 at 13:38
please run thisphp bin/magento setup:di:compile
thenphp bin/magento cache:flush
– kunj
Jun 8 '18 at 14:22
add a comment |
Try this:
<?php
namespace CompanyModuleControllerAdminhtmlQuote;
use MagentoFrameworkAppActionAction;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkAppFilesystemDirectoryList as DirectoryList;
use CompanyModuleHelperPdfCrowd;
class QuotePdf extends Action
/**
* @var MagentoFrameworkAppResponseHttpFileFactory
*/
protected $fileFactory;
protected $_mediaDirectory;
protected $directory_list;
protected $dompdfFactory;
protected $layoutFactory;
protected $authSession;
//protected $quote_info;
protected $userFactory;
protected $_pdfCrowd;
public function __construct(
Context $context,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkFilesystem $filesystem,
MagentoBackendModelAuthSession $authSession,
PdfCrowd $pdfCrowd,
DirectoryList $directory_list,
MagentoUserModelUserFactory $userFactory
)
parent::__construct($context);
$this->_pdfCrowd = $pdfCrowd;
$this->fileFactory = $fileFactory;
$this->authSession = $authSession;
$this->_mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
$this->directory_list = $directory_list;
$this->userFactory = $userFactory;
public function execute()
if($this->authSession->isLoggedIn())
$id = $this->getRequest()->getParam('id');
$client = $this->_pdfCrowd->createPdf("MYUSERNAME", "xxxxxxx-KEY");
// set HTTP response headers
$pdf = $client->convertHtml($this->getHtmlForPdf($id));
header("Content-Type: application/pdf");
header("Cache-Control: no-cache");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=commercialsale-".$id.".pdf");
echo $pdf;
I have replaced method name and called with dependency injection.
<?php
namespace CompanyModuleHelper;
class PdfCrowd
//
// Pdfcrowd constructor.
//
// $username - your username at Pdfcrowd
// $apikey - your API key
// $hostname - API hostname, defaults to pdfcrowd.com
//
function createPdf($username, $apikey, $hostname=null)
if ($hostname)
$this->hostname = $hostname;
else
$this->hostname = self::$api_host;
$this->useSSL(false);
$this->fields = array(
'username' => $username,
'key' => $apikey,
'pdf_scaling_factor' => 1,
'html_zoom' => 200);
$this->proxy_name = null;
$this->proxy_port = null;
$this->proxy_username = "";
$this->proxy_password = "";
$this->user_agent = "pdfcrowd_php_client_".self::$client_version."_(http://pdfcrowd.com)";
?>
This error. Class CompanyModuleHelperPdfCrowd does not exist in [CompanyModuleControllerAdminhtmlQuoteQuotePdfInterceptor]
– Hardik
Jun 8 '18 at 13:38
please run thisphp bin/magento setup:di:compile
thenphp bin/magento cache:flush
– kunj
Jun 8 '18 at 14:22
add a comment |
Try this:
<?php
namespace CompanyModuleControllerAdminhtmlQuote;
use MagentoFrameworkAppActionAction;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkAppFilesystemDirectoryList as DirectoryList;
use CompanyModuleHelperPdfCrowd;
class QuotePdf extends Action
/**
* @var MagentoFrameworkAppResponseHttpFileFactory
*/
protected $fileFactory;
protected $_mediaDirectory;
protected $directory_list;
protected $dompdfFactory;
protected $layoutFactory;
protected $authSession;
//protected $quote_info;
protected $userFactory;
protected $_pdfCrowd;
public function __construct(
Context $context,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkFilesystem $filesystem,
MagentoBackendModelAuthSession $authSession,
PdfCrowd $pdfCrowd,
DirectoryList $directory_list,
MagentoUserModelUserFactory $userFactory
)
parent::__construct($context);
$this->_pdfCrowd = $pdfCrowd;
$this->fileFactory = $fileFactory;
$this->authSession = $authSession;
$this->_mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
$this->directory_list = $directory_list;
$this->userFactory = $userFactory;
public function execute()
if($this->authSession->isLoggedIn())
$id = $this->getRequest()->getParam('id');
$client = $this->_pdfCrowd->createPdf("MYUSERNAME", "xxxxxxx-KEY");
// set HTTP response headers
$pdf = $client->convertHtml($this->getHtmlForPdf($id));
header("Content-Type: application/pdf");
header("Cache-Control: no-cache");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=commercialsale-".$id.".pdf");
echo $pdf;
I have replaced method name and called with dependency injection.
<?php
namespace CompanyModuleHelper;
class PdfCrowd
//
// Pdfcrowd constructor.
//
// $username - your username at Pdfcrowd
// $apikey - your API key
// $hostname - API hostname, defaults to pdfcrowd.com
//
function createPdf($username, $apikey, $hostname=null)
if ($hostname)
$this->hostname = $hostname;
else
$this->hostname = self::$api_host;
$this->useSSL(false);
$this->fields = array(
'username' => $username,
'key' => $apikey,
'pdf_scaling_factor' => 1,
'html_zoom' => 200);
$this->proxy_name = null;
$this->proxy_port = null;
$this->proxy_username = "";
$this->proxy_password = "";
$this->user_agent = "pdfcrowd_php_client_".self::$client_version."_(http://pdfcrowd.com)";
?>
Try this:
<?php
namespace CompanyModuleControllerAdminhtmlQuote;
use MagentoFrameworkAppActionAction;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkAppFilesystemDirectoryList as DirectoryList;
use CompanyModuleHelperPdfCrowd;
class QuotePdf extends Action
/**
* @var MagentoFrameworkAppResponseHttpFileFactory
*/
protected $fileFactory;
protected $_mediaDirectory;
protected $directory_list;
protected $dompdfFactory;
protected $layoutFactory;
protected $authSession;
//protected $quote_info;
protected $userFactory;
protected $_pdfCrowd;
public function __construct(
Context $context,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkFilesystem $filesystem,
MagentoBackendModelAuthSession $authSession,
PdfCrowd $pdfCrowd,
DirectoryList $directory_list,
MagentoUserModelUserFactory $userFactory
)
parent::__construct($context);
$this->_pdfCrowd = $pdfCrowd;
$this->fileFactory = $fileFactory;
$this->authSession = $authSession;
$this->_mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
$this->directory_list = $directory_list;
$this->userFactory = $userFactory;
public function execute()
if($this->authSession->isLoggedIn())
$id = $this->getRequest()->getParam('id');
$client = $this->_pdfCrowd->createPdf("MYUSERNAME", "xxxxxxx-KEY");
// set HTTP response headers
$pdf = $client->convertHtml($this->getHtmlForPdf($id));
header("Content-Type: application/pdf");
header("Cache-Control: no-cache");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=commercialsale-".$id.".pdf");
echo $pdf;
I have replaced method name and called with dependency injection.
<?php
namespace CompanyModuleHelper;
class PdfCrowd
//
// Pdfcrowd constructor.
//
// $username - your username at Pdfcrowd
// $apikey - your API key
// $hostname - API hostname, defaults to pdfcrowd.com
//
function createPdf($username, $apikey, $hostname=null)
if ($hostname)
$this->hostname = $hostname;
else
$this->hostname = self::$api_host;
$this->useSSL(false);
$this->fields = array(
'username' => $username,
'key' => $apikey,
'pdf_scaling_factor' => 1,
'html_zoom' => 200);
$this->proxy_name = null;
$this->proxy_port = null;
$this->proxy_username = "";
$this->proxy_password = "";
$this->user_agent = "pdfcrowd_php_client_".self::$client_version."_(http://pdfcrowd.com)";
?>
answered Jun 8 '18 at 13:18
kunjkunj
2,6502423
2,6502423
This error. Class CompanyModuleHelperPdfCrowd does not exist in [CompanyModuleControllerAdminhtmlQuoteQuotePdfInterceptor]
– Hardik
Jun 8 '18 at 13:38
please run thisphp bin/magento setup:di:compile
thenphp bin/magento cache:flush
– kunj
Jun 8 '18 at 14:22
add a comment |
This error. Class CompanyModuleHelperPdfCrowd does not exist in [CompanyModuleControllerAdminhtmlQuoteQuotePdfInterceptor]
– Hardik
Jun 8 '18 at 13:38
please run thisphp bin/magento setup:di:compile
thenphp bin/magento cache:flush
– kunj
Jun 8 '18 at 14:22
This error. Class CompanyModuleHelperPdfCrowd does not exist in [CompanyModuleControllerAdminhtmlQuoteQuotePdfInterceptor]
– Hardik
Jun 8 '18 at 13:38
This error. Class CompanyModuleHelperPdfCrowd does not exist in [CompanyModuleControllerAdminhtmlQuoteQuotePdfInterceptor]
– Hardik
Jun 8 '18 at 13:38
please run this
php bin/magento setup:di:compile
then php bin/magento cache:flush
– kunj
Jun 8 '18 at 14:22
please run this
php bin/magento setup:di:compile
then php bin/magento cache:flush
– kunj
Jun 8 '18 at 14:22
add a comment |
Use below on your helper file:
class PdfCrowd extends MagentoFrameworkAppHelperAbstractHelper
instead of
class PdfCrowd
add a comment |
Use below on your helper file:
class PdfCrowd extends MagentoFrameworkAppHelperAbstractHelper
instead of
class PdfCrowd
add a comment |
Use below on your helper file:
class PdfCrowd extends MagentoFrameworkAppHelperAbstractHelper
instead of
class PdfCrowd
Use below on your helper file:
class PdfCrowd extends MagentoFrameworkAppHelperAbstractHelper
instead of
class PdfCrowd
answered Jun 8 '18 at 14:24
Sukumar GoraiSukumar Gorai
6,8753729
6,8753729
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f229214%2fmagento-2-fatal-error-uncaught-error-class-not-found%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Check exact folder and class name for CompanyModuleHelperPdfCrowd
– Sohel Rana
Jun 8 '18 at 13:41
Thanks to pointing me. Sorry actually there is capital word issue in my file name. Strange that this is working in my local.
– Hardik
Jun 8 '18 at 13:53
yes, Linux is naming strict type. But other system like windows, mac not.
– Sohel Rana
Jun 8 '18 at 13:55