Skip to content
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

AbstractPdf - ZendException font is not set #11743

Closed
jchenevey opened this issue Oct 25, 2017 · 2 comments
Closed

AbstractPdf - ZendException font is not set #11743

jchenevey opened this issue Oct 25, 2017 · 2 comments
Assignees
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@jchenevey
Copy link

Preconditions

  1. Magento v2.2.0
  2. PHP 7.0.22

Steps to reproduce

  1. Try to write a large multi-line block of text using drawLineBlocks() (my apologies for not providing a better example here - this came up during development of a custom module, which I am unable to include here)

Expected result

  1. PDF should render

Actual result

  1. A new Zend_Pdf_Exception is thrown, stating "Font has not been set"

The issue is caused by lines 1034-1036 in /vendor/magento/module-sales/Model/Order/Pdf/AbstractPdf.php.

foreach ($column['text'] as $part) {
    if ($this->y - $lineSpacing < 15) {
        $page = $this->newPage($pageSettings);
    }
...

This new page is created after the font has been determined (lines 1008-1025) and set for the line to be written. Therefore, at the time line 1057 is reached (below), the font for the new page has not been set.

$page->drawText($part, $feed, $this->y - $top, 'UTF-8');

The solution would be to re-set the page's font after creating the new page.

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Oct 25, 2017
@magento-engcom-team magento-engcom-team added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Nov 17, 2017
@magento-engcom-team
Copy link
Contributor

@jchenevey, thank you for your report.
We've created internal ticket(s) MAGETWO-84054 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.2.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Nov 17, 2017
@serhii-balko serhii-balko self-assigned this Dec 12, 2017
@okorshenko
Copy link
Contributor

Hi @jchenevey. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1016 by @serhii-balko in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming patch release.

@okorshenko okorshenko added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Dec 22, 2017
magento-team pushed a commit that referenced this issue Dec 22, 2017
…ot set #1016

 - Merge Pull Request magento-engcom/magento2ce#1016 from serhii-balko/magento2:github-11743
 - Merged commits:
   1. 2629726
   2. b326714
   3. 5f4363b
   4. 9ce4730
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

4 participants