Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @var MagentoFrameworkFilesystemDirectoryReadInterface
- */
- protected $_rootDirectory;
- /**
- * AddFontToPdf constructor.
- * @param MagentoFrameworkFilesystem $filesystem
- */
- public function __construct(
- MagentoFrameworkFilesystem $filesystem
- )
- {
- $this->_rootDirectory = $filesystem->getDirectoryRead(DirectoryList::ROOT);
- }
- public function beforeDrawLineBlocks($subject, $page, array $draw, array $pageSettings = [])
- {
- foreach ($draw as $key => $values) {
- if(isset($values['lines'])) {
- $lines = $values['lines'];
- foreach ($lines as $k => $v) {
- foreach ($v as $k1 => $v1) {
- $v[$k1]['font_file'] = $this->_rootDirectory->getAbsolutePath('lib/internal/DejaVu/DejaVuSansCondensed.ttf');
- $lines[$k][$k1] = $v[$k1];
- }
- }
- $draw[$key]['lines'] = $lines;
- }
- }
- // Update the $draw array to add your font
- return [$page, $draw, $pageSettings];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement