'phpword dompdf docx to pdf special character

<?php 
include 'vendor/autoload.php';

$phpWord = new \PhpOffice\PhpWord\PhpWord();

$domPdfPath = realpath('vendor/dompdf/dompdf');
\PhpOffice\PhpWord\Settings::setPdfRendererPath($domPdfPath);
\PhpOffice\PhpWord\Settings::setPdfRendererName('DomPDF');

// //Load temp file
$phpWord = \PhpOffice\PhpWord\IOFactory::load('test.docx'); 


// //Save it
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord , 'PDF');
//  
$xmlWriter->setFont('arial');
header('Content-Type: application/pdf; charset=utf-8');
$xmlWriter->save('php://output'); 
?>

word to pdf works fine but Turkish characters in the resulting pdf '?' looks like



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source