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

Hindi text not display same as html in pdf #1984

Closed
Shoury17 opened this issue Sep 2, 2019 · 4 comments
Closed

Hindi text not display same as html in pdf #1984

Shoury17 opened this issue Sep 2, 2019 · 4 comments
Labels

Comments

@Shoury17
Copy link

Shoury17 commented Sep 2, 2019

<?php 
require_once $_SERVER['DOCUMENT_ROOT'].'/pdfgen/dompdf/autoload.inc.php';
use Dompdf\Dompdf;

define("DOMPDF_UNICODE_ENABLED", true);

$html = '<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style>
@font-face {
  font-family: "chilanka";
  font-style: normal;
  font-weight: normal;
  src: url(fonts/chilanka.ttf) format("truetype");
}
@font-face {
  font-family: "NotoSansRegular";
  font-style: normal;
  font-weight: normal;
  src: url(fonts/NotoSansRegular.ttf) format("truetype");
}
        *{outline: none;box-sizing: border-box;}
        
</style>
</head>
<body>
    <p style="font-family: chilanka, DejaVu Sans, sans-serif;">It was going to be a lonely trip back.</p>
    <p style="font-family: NotoSansRegular;">अंतरिक्ष यान से दूर नीचे पृथ्वी शानदार ढंग से जगमगा रही थी । लेकिन चोंकाने वाली बात ये है कि हर Best</p>
</body>
</html>';

//echo $html;
$dompdf= new Dompdf(array('enable_remote' => true));
$dompdf->loadHtml($html);
$dompdf->setPaper('A4','Portrait');

$dompdf->render(); 

$font = $dompdf->getFontMetrics()->get_font("serif", "bold");
$dompdf->getCanvas()->page_text(72, 18, "                                        Testing", $font, 16, array(0.21,0.11,0.46));
$dompdf->stream('testing',array('Attachment'=>0));

Screenshot (32)

@bsweeney
Copy link
Member

bsweeney commented Sep 9, 2019

What produced the screen shot? I don't read Hindi so you're going to have to help me understand where the problem is.

However, I'll note that there are already many issues related to problems displaying certain scripts. You might find some relevant info if you search through existing issues.

@Shoury17
Copy link
Author

Shoury17 commented Sep 9, 2019

I provide this word to generate a pdf 'अंतरिक्ष' but in pdf, I will get this
Screenshot (32) - Copy
You can match that word.

@bsweeney
Copy link
Member

Without doing much more than noting the similarity, I'm guessing this is similar to the issue that we have displaying devanagari. For reference see #655 (particularly this comment).

@bsweeney
Copy link
Member

Going to close this ticket in favor of 2619 as the tracking ticket for the necessary functionality but will review comments here as we build out better support for Hindi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants