Answer the question
In order to leave comments, you need to log in
How to enable Russian language support in Dompdf?
Hello everyone
I want to convert html page to pdf. The page itself contains only html code without css. I do everything using the Dompdf extension.
Installed with Composer
public function index()
{
// Configure Dompdf according to your needs
$pdfOptions = new Options();
$pdfOptions->set('defaultFont', 'Arial');
// Instantiate Dompdf with our options
$dompdf = new Dompdf($pdfOptions);
// Retrieve the HTML generated in our twig file
$html = $this->renderView('default/mypdf.html.twig', [
'title' => "Welcome to our PDF Test"
]);
// Load HTML to Dompdf
$dompdf->loadHtml($html);
// (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
$dompdf->setPaper('A4', 'portrait');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser (force download)
$dompdf->stream("mypdf.pdf", [
"Attachment" => true
]);
}
Answer the question
In order to leave comments, you need to log in
Problem with cyrillic characters, try https://github.com/dompdf/dompdf/wiki/UnicodeHowTo
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question