-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logos in Invoice PDF stopped showing/working with 2.4.6-p2 #37897
Comments
Hi @C4rter. Thank you for your report.
Join Magento Community Engineering Slack and ask your questions in #github channel. |
@magento give me 2.4-develop instance |
Hi @C4rter. Thank you for your request. I'm working on Magento instance for you. |
Hi @engcom-Bravo. Thank you for working on this issue.
|
Hi @C4rter, here is your Magento Instance: https://b7c3986e611fdc9794e56d663f269212.instances-prod.magento-community.engineering |
@magento give me 2.46-p2 instance |
Hi @C4rter. Thank you for your request. I'm working on Magento instance for you. |
Hi @C4rter, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later. |
@magento give me 2.4.6-p2 instance |
Hi @C4rter. Thank you for your request. I'm working on Magento instance for you. |
Hi @C4rter, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later. |
Cannot reproduce on 2.4-develop. |
A major change seem to be that now in 2.4.6 "magento/zend-pdf": "^1.16" is used. |
When I copy/paste the old folder |
Found the reason why it stopped working now. The issue is here: Compared to the original file you've added this:
And that causes serious issue in the stream handling here:
Accessing ->value there just returns "null" all the time with your change instead of actually loading/streaming the file. |
Here's a patch for that:
|
@magento give me 2.4.6-p2 instance |
Hi @C4rter. Thank you for your request. I'm working on Magento instance for you. |
Hi @C4rter, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later. |
@magento give me 2.4-develop instance |
Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you. |
Hi @engcom-Bravo, here is your Magento Instance: https://b7c3986e611fdc9794e56d663f269212.instances-prod.magento-community.engineering |
Hi @C4rter, Thank you for reporting and collaboration. Verified the issue on Magento 2.4-develop instance and the issue is not reproducible.Kindly refer the screenshots. Steps to reproduce
We are able to get the Logo for a given png image in PDF invoice. It seems to be issue got fixed in Magento 2.4-develop branch. it is recommended to verify the issue on Magento 2.4-develop instance as it is an upcoming 2.4.x release and have latest code base. Thanks. |
@C4rter: thanks for reporting this Can you confirm that your issue is caused by the changes in magento/magento-zend-pdf#1? (your comments mention code that was introduced there) Also can you tell me what version of |
@hostep Thank you for your reply.
Yeah, the change that causes the issue for me is in that PR. It's that one: Because $value is pre-initialized in that class the image file streaming doesn't work anymore.
Yes, it would be great if you are able to test the use case that I mentioned here. Feel free to use my images.
The composer.lock bit for magento/zend-pdf points to "dev-main" and commit 243d76feb68ef85aa594ebb1c3e44b78497e54c9 for magento/zend-pdf.
Aside from the one now that I needed to fix the issue there are no other custom patches applied to it.
That's correct it seems. It's merged into main but it's not tagged in a new version yet. magento/framework and magento/page-builder both have a requirement "magento/zend-pdf": "^1.16" in my composer.lock. Here's the version part for magento/zend-pdf in my current composer.lock
But when I do a
So that's the current issue for me, that version. When I manually add it to the require section like this, it pulls the old version: But still, once your change is tagged and relased, I would assume it would cause more issues. |
Thanks again for report @C4rter, I'm able to reproduce the issue. Will investigate later today or later this week (depending on my time, I'm not an Adobe employee, so I'm not being paid for this) to see what we can do to fix this. |
That's good to hear.
Sure, that's good enough for me. With the change to the minimum-stability from dev to stable I'm running the working version now again and don't need my patch anymore. That's fine for now. Thank you @hostep |
@C4rter: this works for me: magento/magento-zend-pdf#2, can you maybe also test to be sure? |
Thank you, I think I can try it tomorrow or Friday. Will give you feedback here. |
@hostep Just tested it and it works. Stream is being pulled again when accessing the $value property. |
Version 1.16.3 got released yesterday with these fixes included. I think we can close this issue here now? 🙂 |
Preconditions and environment
Attached an png image to reproduce
Attached an jpg image to reproduce
Steps to reproduce
Configure the "Logo for PDF Print-outs" in Sales->Sales->Invoice and Packing Slip Design with the given PNG.
Try to print a PDF invoice
You receive the following error:
{"0":"Warning: Trying to access array offset on value of type null in \/vendor\/magento\/zend-pdf\/library\/Zend\/Pdf\/Resource\/Image\/Png.php on line 291","1":"#1 Zend_Pdf_Resource_Image_Png->__construct() called at [vendor\/magento\/zend-pdf\/library\/Zend\/Pdf\/Resource\/ImageFactory.php:54]\n#2 Zend_Pdf_Resource_ImageFactory::factory() called at [vendor\/magento\/zend-pdf\/library\/Zend\/Pdf\/Image.php:124]\n#3 Zend_Pdf_Image::imageWithPath() called at [vendor\/magento\/module-sales\/Model\/Order\/Pdf\/AbstractPdf.php:282]\n#4 Magento\\Sales\\Model\\Order\\Pdf\\AbstractPdf->insertLogo() called at [vendor\/magento\/module-sales\/Model\/Order\/Pdf\/Invoice.php:140]\n#5 Magento\\Sales\\Model\\Order\\Pdf\\Invoice->getPdf() called at [vendor\/magento\/module-sales\/Controller\/Adminhtml\/Invoice\/AbstractInvoice\/PrintAction.php:58]\n#6 Magento\\Sales\\Controller\\Adminhtml\\Invoice\\AbstractInvoice\\PrintAction->execute() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:58]\n#7 Magento\\Sales\\Controller\\Adminhtml\\Order\\Invoice\\PrintAction\\Interceptor->___callParent() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:138]\n#8 Magento\\Sales\\Controller\\Adminhtml\\Order\\Invoice\\PrintAction\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:153]\n#9 Magento\\Sales\\Controller\\Adminhtml\\Order\\Invoice\\PrintAction\\Interceptor->___callPlugins() called at [generated\/code\/Magento\/Sales\/Controller\/Adminhtml\/Order\/Invoice\/PrintAction\/Interceptor.php:23]\n#10 Magento\\Sales\\Controller\\Adminhtml\\Order\\Invoice\\PrintAction\\Interceptor->execute() called at [vendor\/magento\/framework\/App\/Action\/Action.php:111]\n#11 Magento\\Framework\\App\\Action\\Action->dispatch() called at [vendor\/magento\/module-backend\/App\/AbstractAction.php:151]\n#12 Magento\\Backend\\App\\AbstractAction->dispatch() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:58]\n#13 Magento\\Sales\\Controller\\Adminhtml\\Order\\Invoice\\PrintAction\\Interceptor->___callParent() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:138]\n#14 Magento\\Sales\\Controller\\Adminhtml\\Order\\Invoice\\PrintAction\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [vendor\/magento\/module-backend\/App\/Action\/Plugin\/Authentication.php:145]\n#15 Magento\\Backend\\App\\Action\\Plugin\\Authentication->aroundDispatch() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:135]\n#16 Magento\\Sales\\Controller\\Adminhtml\\Order\\Invoice\\PrintAction\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:153]\n#17 Magento\\Sales\\Controller\\Adminhtml\\Order\\Invoice\\PrintAction\\Interceptor->___callPlugins() called at [generated\/code\/Magento\/Sales\/Controller\/Adminhtml\/Order\/Invoice\/PrintAction\/Interceptor.php:32]\n#18 Magento\\Sales\\Controller\\Adminhtml\\Order\\Invoice\\PrintAction\\Interceptor->dispatch() called at [vendor\/magento\/framework\/App\/FrontController.php:245]\n#19 Magento\\Framework\\App\\FrontController->getActionResponse() called at [vendor\/magento\/framework\/App\/FrontController.php:212]\n#20 Magento\\Framework\\App\\FrontController->processRequest() called at [vendor\/magento\/framework\/App\/FrontController.php:147]\n#21 Magento\\Framework\\App\\FrontController->dispatch() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:58]\n#22 Magento\\Framework\\App\\FrontController\\Interceptor->___callParent() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:138]\n#23 Magento\\Framework\\App\\FrontController\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:153]\n#24 Magento\\Framework\\App\\FrontController\\Interceptor->___callPlugins() called at [generated\/code\/Magento\/Framework\/App\/FrontController\/Interceptor.php:23]\n#25 Magento\\Framework\\App\\FrontController\\Interceptor->dispatch() called at [vendor\/magento\/framework\/App\/Http.php:116]\n#26 Magento\\Framework\\App\\Http->launch() called at [vendor\/magento\/framework\/App\/Bootstrap.php:264]\n#27 Magento\\Framework\\App\\Bootstrap->run() called at [pub\/index.php:30]\n","url":"\/admin\/sales\/order_invoice\/print\/invoice_id\/13083\/key\/74ba62670c05c57820e0765f8efd774afffaa898a5ea2f97ccdb9bf53da94241\/","script_name":"\/index.php","report_id":"2e0b1428c1bd6c499aed5f0128ab15cf066dc2b14bfded767f92cb6f13da231e"}
When you switch the logo to a JPG or another PNG you won't receive that error but no image is printed to the PDF, it's just blank where the logo is supposed to be.
Expected result
It's expected that the logo can still be printed on the PDF invoice.
Actual result
Either an error is thrown or no logo is printed.
Additional information
No response
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: