How setEncryption can work with Unicode?

123 views
Skip to first unread message

Olga Farber

unread,
Sep 18, 2016, 9:13:44 AM9/18/16
to dompdf
Hi guys,

I'm trying to create a PDF file with dompdf, with Unicode characters, and with encryption. And if without [calling set]encryption I am succeeding to get the PDF ok, - when I call setEncryption, the letters disappear.

When the style tag in loaded HTML is added (with body { font-family: DejaVu Sans, sans-serif }), then when setEncryption is not called, the Cyrillic letters show up, but when I call setEncryption, it all just disappears, the English letters, too.

So I thought Cpdf is probably setting its own fonts, or should set, so I tried before setEncryption to call some setting fonts functions. I didn't find anywhere the examples of usage, so I don't know what the sequence of commands should be.
I tried the following:

$dompdf->get_canvas()->get_cpdf(); 
$cpdf->setFontFamily('DejaVuSans.ufm', array(
  'b' => 'DejaVuSans-Bold.ufm',
  'i' => 'DejaVuSans-Oblique.ufm',
  'bi' => 'DejaVuSans-BoldOblique.ufm',
  'ib' => 'DejaVuSans-BoldOblique.ufm'
));
$cpdf->selectFont('DejaVuSans.ufm');
$cpdf->setEncryption('', '', array( 'print' ));


then I tried to even change the Cpdf file (in dompdf/lib folder), to include the DejaVu Sans font when it's calling its init on fonts. Then I called the following:

$dompdf->get_canvas()->get_cpdf(); 
$cpdf->selectFont('DejaVuSans.ufm');
$cpdf->setEncryption('', '', array( 'print' ));

didn't help. Maybe you could suggest something?

Thank you!!

P.S. Is there any documentation on this kind of things?

BrianS

unread,
Sep 18, 2016, 9:20:12 AM9/18/16
to dompdf
There's a known issue with regard to using a custom font and encryption at the same time. You can follow the issue here for updates:
Reply all
Reply to author
Forward
0 new messages