wkhtmltopdf amazon linux won't encode emoji












2















I'm trying to generate a PDF via wkhtmltopdf in an Amazon Linux os, everything works fine, but when i try to use emoji on the HTML, the fonts break and the emoji is displayed as a black box.
Before deploying, i tried locally and it works, locally i have Ubuntu, so my guess is that i'm missing something (fonts?) in the production (the amazon linux instance) server. I tried to install Google Noto font but nothing happened. I'll attach 2 screens of the same HTML page, generated by the same command via wkhtmltopdf:



Local (Ubuntu):
Local Image



Production (Amazon Linux):
Production Image



As you can see, even the font below the broken emoji is not rendered as aspected, i'll add the command i use in both servers:



/my/path/to/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality 'file:///my/path/to/page-test-pdf.html' '/home/user/test.pdf'



Thanks for your time.










share|improve this question



























    2















    I'm trying to generate a PDF via wkhtmltopdf in an Amazon Linux os, everything works fine, but when i try to use emoji on the HTML, the fonts break and the emoji is displayed as a black box.
    Before deploying, i tried locally and it works, locally i have Ubuntu, so my guess is that i'm missing something (fonts?) in the production (the amazon linux instance) server. I tried to install Google Noto font but nothing happened. I'll attach 2 screens of the same HTML page, generated by the same command via wkhtmltopdf:



    Local (Ubuntu):
    Local Image



    Production (Amazon Linux):
    Production Image



    As you can see, even the font below the broken emoji is not rendered as aspected, i'll add the command i use in both servers:



    /my/path/to/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality 'file:///my/path/to/page-test-pdf.html' '/home/user/test.pdf'



    Thanks for your time.










    share|improve this question

























      2












      2








      2








      I'm trying to generate a PDF via wkhtmltopdf in an Amazon Linux os, everything works fine, but when i try to use emoji on the HTML, the fonts break and the emoji is displayed as a black box.
      Before deploying, i tried locally and it works, locally i have Ubuntu, so my guess is that i'm missing something (fonts?) in the production (the amazon linux instance) server. I tried to install Google Noto font but nothing happened. I'll attach 2 screens of the same HTML page, generated by the same command via wkhtmltopdf:



      Local (Ubuntu):
      Local Image



      Production (Amazon Linux):
      Production Image



      As you can see, even the font below the broken emoji is not rendered as aspected, i'll add the command i use in both servers:



      /my/path/to/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality 'file:///my/path/to/page-test-pdf.html' '/home/user/test.pdf'



      Thanks for your time.










      share|improve this question














      I'm trying to generate a PDF via wkhtmltopdf in an Amazon Linux os, everything works fine, but when i try to use emoji on the HTML, the fonts break and the emoji is displayed as a black box.
      Before deploying, i tried locally and it works, locally i have Ubuntu, so my guess is that i'm missing something (fonts?) in the production (the amazon linux instance) server. I tried to install Google Noto font but nothing happened. I'll attach 2 screens of the same HTML page, generated by the same command via wkhtmltopdf:



      Local (Ubuntu):
      Local Image



      Production (Amazon Linux):
      Production Image



      As you can see, even the font below the broken emoji is not rendered as aspected, i'll add the command i use in both servers:



      /my/path/to/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality 'file:///my/path/to/page-test-pdf.html' '/home/user/test.pdf'



      Thanks for your time.







      encoding wkhtmltopdf emoji amazon-linux






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '18 at 9:27









      Gumma MocciaroGumma Mocciaro

      932720




      932720
























          2 Answers
          2






          active

          oldest

          votes


















          1














          You can find a solution to a similar issue here basically twemoji.min.js replace the emoji with the corresponding image. Regarding the weird font spacing issue, you can use a monospaced font like roboto mono or something you like.






          share|improve this answer
























          • Thank you, it's not actually a solution but a workaround, but it works

            – Gumma Mocciaro
            Dec 4 '18 at 16:36



















          1














          If you are running PHP 7.x, I have been having problems with the wkhtmltopdf extension within a dockerized image. We were trying to use font awesome and the text just did not render correctly. There were some compilation issues that caused this.



          The problem was resolved when using the following binary https://github.com/madnight/docker-alpine-wkhtmltopdf



          Hope this helps you forward.



          EDIT: You will also have to have all fonts used installed as system fonts iirc otherwise wkhtmltopdf will refuse to work as it cannot find the font






          share|improve this answer
























          • unfortunately i need to use emoji because i need to generate a report for some push notifications (containing emoji), i actually refuse to map every emoji and replace it with something else, i think i need to install the right fonts in the server, moreover, i'll try the binary you linked instead the one i got from composer (i don't use docker in this project, but i guess this will not be a problem), thanks!

            – Gumma Mocciaro
            Nov 23 '18 at 9:41











          • I tried to use that binary but unfortunately is for 32bit OS, while i have 64Bit. I also tried to install the fonts in the server but it didn't help either. I wrote in the project's github so i'll just wait and hope

            – Gumma Mocciaro
            Nov 23 '18 at 10:51











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          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: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408891%2fwkhtmltopdf-amazon-linux-wont-encode-emoji%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









          1














          You can find a solution to a similar issue here basically twemoji.min.js replace the emoji with the corresponding image. Regarding the weird font spacing issue, you can use a monospaced font like roboto mono or something you like.






          share|improve this answer
























          • Thank you, it's not actually a solution but a workaround, but it works

            – Gumma Mocciaro
            Dec 4 '18 at 16:36
















          1














          You can find a solution to a similar issue here basically twemoji.min.js replace the emoji with the corresponding image. Regarding the weird font spacing issue, you can use a monospaced font like roboto mono or something you like.






          share|improve this answer
























          • Thank you, it's not actually a solution but a workaround, but it works

            – Gumma Mocciaro
            Dec 4 '18 at 16:36














          1












          1








          1







          You can find a solution to a similar issue here basically twemoji.min.js replace the emoji with the corresponding image. Regarding the weird font spacing issue, you can use a monospaced font like roboto mono or something you like.






          share|improve this answer













          You can find a solution to a similar issue here basically twemoji.min.js replace the emoji with the corresponding image. Regarding the weird font spacing issue, you can use a monospaced font like roboto mono or something you like.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 4 '18 at 16:35









          panzapanza

          263




          263













          • Thank you, it's not actually a solution but a workaround, but it works

            – Gumma Mocciaro
            Dec 4 '18 at 16:36



















          • Thank you, it's not actually a solution but a workaround, but it works

            – Gumma Mocciaro
            Dec 4 '18 at 16:36

















          Thank you, it's not actually a solution but a workaround, but it works

          – Gumma Mocciaro
          Dec 4 '18 at 16:36





          Thank you, it's not actually a solution but a workaround, but it works

          – Gumma Mocciaro
          Dec 4 '18 at 16:36













          1














          If you are running PHP 7.x, I have been having problems with the wkhtmltopdf extension within a dockerized image. We were trying to use font awesome and the text just did not render correctly. There were some compilation issues that caused this.



          The problem was resolved when using the following binary https://github.com/madnight/docker-alpine-wkhtmltopdf



          Hope this helps you forward.



          EDIT: You will also have to have all fonts used installed as system fonts iirc otherwise wkhtmltopdf will refuse to work as it cannot find the font






          share|improve this answer
























          • unfortunately i need to use emoji because i need to generate a report for some push notifications (containing emoji), i actually refuse to map every emoji and replace it with something else, i think i need to install the right fonts in the server, moreover, i'll try the binary you linked instead the one i got from composer (i don't use docker in this project, but i guess this will not be a problem), thanks!

            – Gumma Mocciaro
            Nov 23 '18 at 9:41











          • I tried to use that binary but unfortunately is for 32bit OS, while i have 64Bit. I also tried to install the fonts in the server but it didn't help either. I wrote in the project's github so i'll just wait and hope

            – Gumma Mocciaro
            Nov 23 '18 at 10:51
















          1














          If you are running PHP 7.x, I have been having problems with the wkhtmltopdf extension within a dockerized image. We were trying to use font awesome and the text just did not render correctly. There were some compilation issues that caused this.



          The problem was resolved when using the following binary https://github.com/madnight/docker-alpine-wkhtmltopdf



          Hope this helps you forward.



          EDIT: You will also have to have all fonts used installed as system fonts iirc otherwise wkhtmltopdf will refuse to work as it cannot find the font






          share|improve this answer
























          • unfortunately i need to use emoji because i need to generate a report for some push notifications (containing emoji), i actually refuse to map every emoji and replace it with something else, i think i need to install the right fonts in the server, moreover, i'll try the binary you linked instead the one i got from composer (i don't use docker in this project, but i guess this will not be a problem), thanks!

            – Gumma Mocciaro
            Nov 23 '18 at 9:41











          • I tried to use that binary but unfortunately is for 32bit OS, while i have 64Bit. I also tried to install the fonts in the server but it didn't help either. I wrote in the project's github so i'll just wait and hope

            – Gumma Mocciaro
            Nov 23 '18 at 10:51














          1












          1








          1







          If you are running PHP 7.x, I have been having problems with the wkhtmltopdf extension within a dockerized image. We were trying to use font awesome and the text just did not render correctly. There were some compilation issues that caused this.



          The problem was resolved when using the following binary https://github.com/madnight/docker-alpine-wkhtmltopdf



          Hope this helps you forward.



          EDIT: You will also have to have all fonts used installed as system fonts iirc otherwise wkhtmltopdf will refuse to work as it cannot find the font






          share|improve this answer













          If you are running PHP 7.x, I have been having problems with the wkhtmltopdf extension within a dockerized image. We were trying to use font awesome and the text just did not render correctly. There were some compilation issues that caused this.



          The problem was resolved when using the following binary https://github.com/madnight/docker-alpine-wkhtmltopdf



          Hope this helps you forward.



          EDIT: You will also have to have all fonts used installed as system fonts iirc otherwise wkhtmltopdf will refuse to work as it cannot find the font







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 22 '18 at 19:05









          Matt SmeetsMatt Smeets

          310213




          310213













          • unfortunately i need to use emoji because i need to generate a report for some push notifications (containing emoji), i actually refuse to map every emoji and replace it with something else, i think i need to install the right fonts in the server, moreover, i'll try the binary you linked instead the one i got from composer (i don't use docker in this project, but i guess this will not be a problem), thanks!

            – Gumma Mocciaro
            Nov 23 '18 at 9:41











          • I tried to use that binary but unfortunately is for 32bit OS, while i have 64Bit. I also tried to install the fonts in the server but it didn't help either. I wrote in the project's github so i'll just wait and hope

            – Gumma Mocciaro
            Nov 23 '18 at 10:51



















          • unfortunately i need to use emoji because i need to generate a report for some push notifications (containing emoji), i actually refuse to map every emoji and replace it with something else, i think i need to install the right fonts in the server, moreover, i'll try the binary you linked instead the one i got from composer (i don't use docker in this project, but i guess this will not be a problem), thanks!

            – Gumma Mocciaro
            Nov 23 '18 at 9:41











          • I tried to use that binary but unfortunately is for 32bit OS, while i have 64Bit. I also tried to install the fonts in the server but it didn't help either. I wrote in the project's github so i'll just wait and hope

            – Gumma Mocciaro
            Nov 23 '18 at 10:51

















          unfortunately i need to use emoji because i need to generate a report for some push notifications (containing emoji), i actually refuse to map every emoji and replace it with something else, i think i need to install the right fonts in the server, moreover, i'll try the binary you linked instead the one i got from composer (i don't use docker in this project, but i guess this will not be a problem), thanks!

          – Gumma Mocciaro
          Nov 23 '18 at 9:41





          unfortunately i need to use emoji because i need to generate a report for some push notifications (containing emoji), i actually refuse to map every emoji and replace it with something else, i think i need to install the right fonts in the server, moreover, i'll try the binary you linked instead the one i got from composer (i don't use docker in this project, but i guess this will not be a problem), thanks!

          – Gumma Mocciaro
          Nov 23 '18 at 9:41













          I tried to use that binary but unfortunately is for 32bit OS, while i have 64Bit. I also tried to install the fonts in the server but it didn't help either. I wrote in the project's github so i'll just wait and hope

          – Gumma Mocciaro
          Nov 23 '18 at 10:51





          I tried to use that binary but unfortunately is for 32bit OS, while i have 64Bit. I also tried to install the fonts in the server but it didn't help either. I wrote in the project's github so i'll just wait and hope

          – Gumma Mocciaro
          Nov 23 '18 at 10:51


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • 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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408891%2fwkhtmltopdf-amazon-linux-wont-encode-emoji%23new-answer', 'question_page');
          }
          );

          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







          這個網誌中的熱門文章

          Tangent Lines Diagram Along Smooth Curve

          Yusuf al-Mu'taman ibn Hud

          Zucchini