From 7a5e7a5d9d0a709b527513828eff416a6c9270f8 Mon Sep 17 00:00:00 2001 From: kplaczek Date: Sun, 29 Jul 2018 17:05:26 +0200 Subject: [PATCH] Breaking up text to 32 character length on space. --- app/Paper/HtmlToPos.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/Paper/HtmlToPos.php b/app/Paper/HtmlToPos.php index 6b91fef..ca6567d 100644 --- a/app/Paper/HtmlToPos.php +++ b/app/Paper/HtmlToPos.php @@ -98,6 +98,18 @@ class HtmlToPos return $data; } + + /** + * łamie tekst w miejscu spacji do długości 32 znaki na linię + * @param $posText + * @return string + */ + public function textBreak($posText) + { + $posText = wordwrap($posText, 32); + return $posText; + } + public function convert($html = '') { $posText = $this->handleNewLine($html); @@ -107,8 +119,8 @@ class HtmlToPos $posText = $this->vocabularyWord($posText); $posText = $this->traficar($posText); -// print_r($posText); -// die(); + $posText = $this->textBreak($posText); + return $posText; } } \ No newline at end of file