magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.56k stars 9.32k forks source link

Magento 2.1.15 - Invoice PDF & shipment PDF does not support Chinese Language. #18260

Open SathishDreamorbit opened 6 years ago

SathishDreamorbit commented 6 years ago

Preconditions

  1. Updated(09/19/2019): Still actual on 2.3-develop
  2. Magento version 2.1.9
  3. Magento version 2.1.15

Steps to reproduce

  1. Login to admin panel and go to Sales -> Order
  2. Search the completed order and click "view"
  3. Select "Invoice" or "Shipments" tab and then click respective "Print" option.

Expected result

  1. In Invoice and Shipment the billing address should be readable.

    Actual result

  2. Chinese characters are replaced by some other symbols invoice_pdf
magento-engcom-team commented 6 years ago

Hi @SathishDreamorbit. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me $VERSION instance

where $VERSION is version tags (starting from 2.2.0+) or develop branches (for example: 2.3-develop). For more details, please, review the Magento Contributor Assistant documentation.

@SathishDreamorbit do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

magento-engcom-team commented 6 years ago

Hi @engcom-backlog-nazar. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

magento-engcom-team commented 6 years ago

@engcom-backlog-nazar Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-95260, MAGETWO-95261 were created

dklapan commented 6 years ago

This is a problem with fonts. The stock font is FreeSerif and it doesn't have chinese characters, you can simply edit this piece of code:

    protected function _setFontRegular($object, $size = 7)
    {
        $font = \Zend_Pdf_Font::fontWithPath(
            $this->_rootDirectory->getAbsolutePath('lib/internal/GnuFreeFont/custom_font.ttf')
        );
        $object->setFont($font, $size);
        return $font;
    }

in app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php line 856

and in lib/internal/GnuFreeFont/ you add your font with chinese characters.

rishabhchd19 commented 6 years ago

It doesn't support Hindi either. The symbol of Rupees is displayed as []?

SathishDreamorbit commented 6 years ago

@Magento team,

Let me know the status of the issue.

@dklapan I have tried the steps. However, I didn't get the respective font files for Chinese language. Could you please share the font files if you have.

ghost commented 6 years ago

Hi @SathishDreamorbit You don't need this files just copy paste this -> 蔣介石蔣介石蔣介石蔣介石蔣介石蔣介石蔣介石蔣介石蔣介石蔣介石

SathishDreamorbit commented 6 years ago

@engcom-backlog-nazar Could you please explain the steps in detail?

ghost commented 6 years ago

@SathishDreamorbit oh.. sorry i'm confusing a little bit, I thought you need steps to reproduce :)

1 - get font with chinese characters.
2 - put in to lib/internal/GnuFreeFont/
3 - in app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php line 856
 change $this->_rootDirectory->getAbsolutePath('lib/internal/GnuFreeFont/FreeSerif.ttf')to -> 
$this->_rootDirectory->getAbsolutePath('lib/internal/GnuFreeFont/add your font with chinese characters..ttf')
SathishDreamorbit commented 6 years ago

@engcom-backlog-nazar

Yes, I have tried the solution. But we are unable to get the supported Chinese Characters font files. In Google, we did not receive any Chinese Font file with .ttf format. If we convert and upload it, then its not readable one and throwing an error in ZendFramework.

For Existing Magento 2 website, we cannot override framework.

m2-assistant[bot] commented 5 years ago

Hi @engcom-Bravo. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:


Pavel-Fekete commented 4 years ago

Still facing this issue on 2.4-develop

github-jira-sync-bot commented 3 years ago

:x: Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.magento.com/browse/AC-833

engcom-Delta commented 1 month ago

Hi @SathishDreamorbit ,

Thanks for your reporting and collaboration. We have re-verified the issue in latest 2.4-develop instance and the issue is reproducible. Kindly refer the screenshots.

Steps to reproduce -

  1. Install Chinese Language Pack
  2. Change Admin Interface to Chinese
  3. Place an order successfully with Chinese address.
  4. Create invoice and shipment.
  5. Print the invoice and observe , Chinese characters are replaced by some other symbols image

Thanks.