cancel
Showing results for 
Search instead for 
Did you mean: 

cant make pdf invoice when in production mode

cant make pdf invoice when in production mode

When in development mode I can create pdf invoices just fine but when in production mode I get an error.

 

Under sales > Invoices I'm clicking the "Print" button to get a pdf of a invoice (see image)

It now says:
There has been an error processing your request

Warning: strspn() expects parameter 1 to be string, object given in /home/dragoni5/public_html/vendor/magento/zendframework1/library/Zend/Pdf/StringParser.php on line 162

 

I'd really appreciate any feedback on this.

Cheers.

Mike.

3 REPLIES

Re: cant make pdf invoice when in production mode

Object Manager instead of string passed as parameter there, 

one of case it may happen when we inject \Zend classes via constructor, 

take in mind that class with fault injection may be injected somewhere in other class, 

and that class somewhere else, domino principle.

so actual fault may trigger much earlier than place, where we see the invalid injection 

Re: cant make pdf invoice when in production mode

cheers for the reply.

I've looked at the error log but my php is poor. Perhaps you can see something I can't.

 

 

a:4:{i:0;s:170:"Warning: strspn() expects parameter 1 to be string, object given in /home/dragoni5/public_html/vendor/magento/zendframework1/library/Zend/Pdf/StringParser.php on line 162";i:1;s:6477:"#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'strspn() expect...', '/home/dragoni5/...', 162, Array)
#1 /home/dragoni5/public_html/vendor/magento/zendframework1/library/Zend/Pdf/StringParser.php(162): strspn(Object(Magento\Framework\ObjectManager\ObjectManager), '\x00\t\n\f\r ', 0)
#2 /home/dragoni5/public_html/vendor/magento/zendframework1/library/Zend/Pdf/StringParser.php(204): Zend_Pdf_StringParser->skipWhiteSpace(false)
#3 /home/dragoni5/public_html/vendor/magento/zendframework1/library/Zend/Pdf/Parser.php(393): Zend_Pdf_StringParser->readComment()
#4 /home/dragoni5/public_html/vendor/magento/zendframework1/library/Zend/Pdf.php(329): Zend_Pdf_Parser->__construct(Object(Magento\Framework\ObjectManager\ObjectManager), Object(Zend_Pdf_ElementFactory_Proxy), false)
#5 /home/dragoni5/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(93): Zend_Pdf->__construct(Object(Magento\Framework\ObjectManager\ObjectManager))
#6 /home/dragoni5/public_html/vendor/magento/framework/ObjectManager/Factory/Compiled.php(88): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Zend_Pdf', Array)
#7 /home/dragoni5/public_html/vendor/magento/framework/ObjectManager/Factory/Compiled.php(130): Magento\Framework\ObjectManager\Factory\Compiled->create('Zend_Pdf')
#8 /home/dragoni5/public_html/vendor/magento/framework/ObjectManager/Factory/Compiled.php(67): Magento\Framework\ObjectManager\Factory\Compiled->get('Zend_Pdf')
#9 /home/dragoni5/public_html/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Compiled->create('Bss\\CheckoutCus...', Array)
#10 /home/dragoni5/public_html/vendor/magento/module-sales/Controller/Adminhtml/Invoice/AbstractInvoice/PrintAction.php(55): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Sales\\M...')
#11 /home/dragoni5/public_html/vendor/magento/framework/App/Action/Action.php(102): Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoice\PrintAction->execute()
#12 /home/dragoni5/public_html/vendor/magento/module-backend/App/AbstractAction.php(226): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#13 /home/dragoni5/public_html/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#14 /home/dragoni5/public_html/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Sales\Controller\Adminhtml\Order\Invoice\PrintAction\Interceptor->___callParent('dispatch', Array)
#15 /home/dragoni5/public_html/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Sales\\C...', 'dispatch', Object(Magento\Sales\Controller\Adminhtml\Order\Invoice\PrintAction\Interceptor), Array, 'adminAuthentica...')
#16 /home/dragoni5/public_html/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#17 /home/dragoni5/public_html/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Sales\Controller\Adminhtml\Order\Invoice\PrintAction\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#18 /home/dragoni5/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Sales\\C...', 'dispatch', Object(Magento\Sales\Controller\Adminhtml\Order\Invoice\PrintAction\Interceptor), Array, 'adminMassaction...')
#19 /home/dragoni5/public_html/vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): Magento\Sales\Controller\Adminhtml\Order\Invoice\PrintAction\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#20 /home/dragoni5/public_html/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Backend\App\Action\Plugin\MassactionKey->aroundDispatch(Object(Magento\Sales\Controller\Adminhtml\Order\Invoice\PrintAction\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#21 /home/dragoni5/public_html/var/generation/Magento/Sales/Controller/Adminhtml/Order/Invoice/PrintAction/Interceptor.php(26): Magento\Sales\Controller\Adminhtml\Order\Invoice\PrintAction\Interceptor->___callPlugins('dispatch', Array, Array)
#22 /home/dragoni5/public_html/vendor/magento/framework/App/FrontController.php(55): Magento\Sales\Controller\Adminhtml\Order\Invoice\PrintAction\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#23 /home/dragoni5/public_html/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#24 /home/dragoni5/public_html/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#25 /home/dragoni5/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install')
#26 /home/dragoni5/public_html/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#27 /home/dragoni5/public_html/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#28 /home/dragoni5/public_html/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#29 /home/dragoni5/public_html/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#30 /home/dragoni5/public_html/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#31 /home/dragoni5/public_html/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#32 {main}";s:3:"url";s:118:"/admin123/sales/order_invoice/print/invoice_id/1/key/611d3c7e62cbc8b33dcdc835871d8110c331a05855d074fac1d0acf5b6a843c4/";s:11:"script_name";s:10:"/index.php";}

Re: cant make pdf invoice when in production mode

By the way, do you have some logic which changes the original pdf generating? For example a custom module to customize pdf invoices..