PDF Invoice Plugin Cutting Off

  • Posts: 13
  • Thank you received: 0
11 years 3 months ago #152749

I have the latest version of PDF Plugin as I just installed it. When I open all of my invoices most of them are getting cut off. How can I fix this? I have attached a screen shot.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 84146
  • Thank you received: 13649
  • MODERATOR
11 years 3 months ago #152759

Hi,

That's because your product names are too long. You'll have to change the line:

<?php echo $product->order_product_name;
by:
<?php echo implode('<br/>',$this->str_split_unicode($product->order_product_name,50));
in the file plugins/hikashop/attachinvoice/attachinvoice/invoice.php
and add the code:
function str_split_unicode($str, $l = 0) {
		if ($l > 0) {
			$ret = array();
			$len = mb_strlen($str, "UTF-8");
			for ($i = 0; $i < $len; $i += $l) {
				$ret[] = mb_substr($str, $i, $l, "UTF-8");
			}
			return $ret;
		}
		return preg_split("//u", $str, -1, PREG_SPLIT_NO_EMPTY);
	}
before the line:
}//endclass
in the file plugins/hikashop/attachinvoice/attachinvoice.php
That way, it will split the product names into several lines when they are too big to fit on a line.

Please Log in or Create an account to join the conversation.

Time to create page: 0.066 seconds
Powered by Kunena Forum