Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. /**
  2. * @var MagentoFrameworkFilesystemDirectoryReadInterface
  3. */
  4. protected $_rootDirectory;
  5.  
  6. /**
  7. * AddFontToPdf constructor.
  8. * @param MagentoFrameworkFilesystem $filesystem
  9. */
  10. public function __construct(
  11. MagentoFrameworkFilesystem $filesystem
  12. )
  13. {
  14. $this->_rootDirectory = $filesystem->getDirectoryRead(DirectoryList::ROOT);
  15. }
  16.  
  17. public function beforeDrawLineBlocks($subject, $page, array $draw, array $pageSettings = [])
  18. {
  19. foreach ($draw as $key => $values) {
  20. if(isset($values['lines'])) {
  21. $lines = $values['lines'];
  22. foreach ($lines as $k => $v) {
  23. foreach ($v as $k1 => $v1) {
  24. $v[$k1]['font_file'] = $this->_rootDirectory->getAbsolutePath('lib/internal/DejaVu/DejaVuSansCondensed.ttf');
  25. $lines[$k][$k1] = $v[$k1];
  26. }
  27. }
  28.  
  29. $draw[$key]['lines'] = $lines;
  30. }
  31.  
  32. }
  33. // Update the $draw array to add your font
  34. return [$page, $draw, $pageSettings];
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement