Add custom text around a barcode with Zend_Pdf (Zend Framework 1.12) - zend-framework

I want to add a custom text around a barcode inside a PDF-document using Zend_Pdf and Zend_Barcode. Right now it is only showing the barcode but I want to add my custom text too above it.
So now I am getting this:
but I want this:
Here is my code:
$pdf = new Zend_Pdf();
$hidden =$_POST['hidden'];
$quantityfrom =$_POST['quantity_from'];
$quantityto =$_POST['quantity_to'];
//Here is code for update the Quantity
$product_id = $_POST['product_id'];
$table = new Account_Model_DbTable_Products();
$query = $table->updateQuantity($product_id,$quantityto);
Zend_Barcode::setBarcodeFont(dirname(ROOT_PATH) . '/inventory/library/Zend/Barcode/Object/fonts/open-sans/OpenSans-Semibold.ttf');
$numberOfPages = ceil(($quantityto-$quantityfrom)/15);
$equipmentCount = $quantityto-$quantityfrom+1;
for($i = 1; $i <= $numberOfPages; $i++)
{
$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
$width = $page->getWidth(); // A4 : 595
$height = $page->getHeight(); // A4 : 842
$page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 20);
$pdf->pages[] = $page;
}
$index = 0;
for($j=1 ; $j<=$numberOfPages;$j++){
if($equipmentCount > 10)
{
$barcodesOnThisPage = 10;
$equipmentCount = $equipmentCount - 10;
}
else
{
$barcodesOnThisPage = $equipmentCount;
}
echo $barcodesOnThisPage."</br>";
$k = 1;
for($i=1;$i<=$barcodesOnThisPage;$i++){
$num_padded = sprintf("%04d", $quantityfrom);
$barcodeOptions = array(
'text' => $hidden.$num_padded,
'barHeight' =>100,
);
$rendererOptions = array(
'topOffset' => 80*$k,
'horizontalPosition' =>'left'
);
$pdfWithBarcode = Zend_Barcode::factory('code39', 'pdf',
$barcodeOptions, $rendererOptions)->setResource($pdf,$index)->draw();
$pdfWithBarcode->save('testBarcode.pdf');
$k++;
$quantityfrom++;
}
$index++;
}
$this->_redirect('/testBarcode.pdf');
}

Related

Error in print prdf. Undefined property $_localeResolver

I am facing the below issue in print sales pdf in magento2 after upgrading the magento version.
1 exception(s):
Exception #0 (Exception): Notice: Undefined property:
InvoicePdfimage\Model\Magento\Sales\Order\Pdf\Invoice::$_localeResolver
in /InvoicePdfimage/Model/Magento/Sales/Order/Pdf/Invoice.php
Vendor/module/etc/di.xml,
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Sales\Model\Order\Pdf\Invoice" type="Vendor\module\Model\Order\Pdf\InvoicePdf"/>
</config>
Now you can create Vendor\module\Model\Order\Pdf\InvoicePdf.php file & add the below code,
<?php
namespace Vendor\module\Model\Order\Pdf;
use \Magento\Sales\Model\Order\Pdf\Invoice;
class InvoicePdf extends Invoice
{
public function getPdf($invoices = []) {
$this->_beforeGetPdf();
$this->_initRenderer('invoice');
$pdf = new \Zend_Pdf();
$this->_setPdf($pdf);
$style = new \Zend_Pdf_Style();
$this->_setFontBold($style, 10);
foreach ($invoices as $invoice) {
if ($invoice->getStoreId()) {
$this->_localeResolver->emulate($invoice->getStoreId());
$this->_storeManager->setCurrentStore($invoice->getStoreId());
}
$page = $this->newPage();
$order = $invoice->getOrder();
$this->insertLogo($page, $invoice->getStore());
$this->insertAddress($page, $invoice->getStore());
$this->insertOrder(
$page,
$order,
$this->_scopeConfig->isSetFlag(
self::XML_PATH_SALES_PDF_INVOICE_PUT_ORDER_ID,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$order->getStoreId()
)
);
$this->insertDocumentNumber($page, __('Invoice # ') . $invoice->getIncrementId());
$this->_drawHeader($page);
foreach ($invoice->getAllItems() as $item) {
if ($item->getOrderItem()->getParentItem()) {
continue;
}
$this->_drawItem($item, $page, $order);
$page = end($pdf->pages);
}
$this->insertTotals($page, $invoice);
if ($invoice->getStoreId()) {
$this->_localeResolver->revert();
}
$this->drawNotice($page);
}
$this->_afterGetPdf();
return $pdf;
}
protected function drawNotice(\Zend_Pdf_Page $page) {
$iFontSize = 10;
$iColumnWidth = 520;
$iWidthBorder = 260;
$iXCoordinateText = 30;
$sEncoding = 'UTF-8';
$this->draw -= 10;
try {
$oFont = $this->_setFontRegular($page, $iFontSize);
$iXCoordinateText = $this->getAlignCenter($sNotice, $iXCoordinateText, $iColumnWidth, $oFont, $iFontSize);
$page->setLineColor(new \Zend_Pdf_Color_Rgb(1, 0, 0));
$iXCoordinateBorder = $iXCoordinateText - 10;
$page->drawLine($iXCoordinateBorder, $this->draw, $iXCoordinateBorder + $iWidthBorder, $this->draw);
$this->draw -= 15;
$page->drawText($sNotice, $iXCoordinateText, $this->draw, $sEncoding);
$this->draw -= 10;
$page->drawLine($iXCoordinateBorder, $this->draw, $iXCoordinateBorder + $iWidthBorder, $this->draw);
$this->draw -= 10;
} catch (\Exception $exception) {
}
}
protected function _drawHeader(\Zend_Pdf_Page $page)
{
$this->_setFontRegular($page, 10);
$page->setFillColor(new \Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
$page->setLineColor(new \Zend_Pdf_Color_GrayScale(0.5));
$page->setLineWidth(0.5);
$page->drawRectangle(25, $this->y, 570, $this->y - 15);
$this->y -= 10;
$page->setFillColor(new \Zend_Pdf_Color_Rgb(0, 0, 0));
//columns headers
$lines[0][] = ['text' => __('Products'), 'feed' => 35];
$lines[0][] = ['text' => __('SKU'), 'feed' => 290, 'align' => 'right'];
// custom column
$lines[0][] = ['text' => __('Qty'), 'feed' => 435, 'align' => 'right'];
$lines[0][] = ['text' => __('Price'), 'feed' => 360, 'align' => 'right'];
$lineBlock = ['lines' => $lines, 'height' => 5];
$this->drawLineBlocks($page, [$lineBlock], ['table_header' => true]);
$page->setFillColor(new \Zend_Pdf_Color_GrayScale(0));
$this->y -= 20;
}
}

How to debug a script that will kill by system when await multi Promise?

Answer "the script used too much memory".
I start a few start to read text file line by line, and convert the text to blob, then send it to socket:
use experimental :pack;
sub heart-msg(Str $msg, Str $device-id --> Blob) {
my $heart-msg = $msg.substr(0, $msg.chars - 8);
my $header-buf = pack("H*", $heart-msg);
my $device-id-buf = pack("L*", $device-id);
$header-buf ~ $device-id-buf
}
sub deal-message(Str $msg, Str $device-id --> Blob) {
my $now = DateTime.now();
my $year = $now.year;
my $month = $now.month;
my $day = $now.day;
my $hour = $now.hour;
my $minute = $now.minute;
my $second = $now.second.Int;
my $check-number = 0;
my $head-msg = $msg.substr(0,4);
my $device-id-length = $msg.substr(4,2);
my $pf-code = $msg.substr(14, 2);
my $msg-length = $msg.substr(16, 4);
my $rel-time = $msg.substr(20, 4);
my $end-msg = $msg.substr(38, $msg.chars - 38 - 2);
my $head-msg-buf = pack("H*", $head-msg);
my $device-id-len-buf = pack("H*", $device-id-length);
my $device-id-buf = pack("L*", $device-id);
my $pf-code-buf = pack("H*", $pf-code);
my $msg-length-buf = pack("H*", $msg-length);
my $rel-time-buf = pack("H*", $rel-time);
my $year-buf = pack("S*", $year);
my $month-buf = pack("C*", $month);
my $day-buf = pack("C*", $day);
my $hour-buf = pack("C*", $hour);
my $minute-buf = pack("C*", $minute);
my $second-buf = pack("C*", $second);
my $end-msg-buf = pack("H*", $end-msg);
my #bufs = [$device-id-len-buf, $device-id-buf, $pf-code-buf, $msg-length-buf,
$rel-time-buf, $year-buf, $month-buf, $day-buf, $hour-buf, $minute-buf, $second-buf,
$end-msg-buf];
for #bufs -> $byte {
my $byte_sum = [+] $byte.contents;
$check-number += $byte_sum;
}
$check-number = $check-number % 256;
my $checked-msg-buf = pack("C*", $check-number);
[~] $head-msg-buf, |#bufs, $checked-msg-buf
}
sub deal-data(Str $msg, Str $device-id --> Blob) {
my $header = $msg.substr(0, 4);
given $header {
when '6868' {
return deal-message($msg, $device-id);
}
when '7468' {
return heart-msg($msg, $device-id);
}
default { return Buf.new }
}
}
sub MAIN(
:$host = '10.0.0.77',
Int() :$port = 4444,
Rat() :$interval = 0.001,
:$file = 'data.txt',
Int() :$device-num = 169) {
my $conn = IO::Socket::INET.new(:$host, :$port);
my #devices = "modelId.txt".IO.lines;
my #promises = gather for #devices[159..$device-num] -> $device-id {
take start {
my $f = lazy $file.IO.lines;
my $iterator = $f.iterator;
react {
whenever Supply.interval($interval) {
try {
my $line := $iterator.pull-one;
if $line =:= IterationEnd {
done;
} else {
my $blob = deal-data($line.chomp.split(/\s+/).tail, $device-id.Str);
#say $blob;
$conn.write($blob);
}
}
QUIT {
$conn.close;
say 'connecting closed';
default {
say .^name, '→ ', .Str;
say "handled in line $?LINE";
}
}
LAST {
say "Connection closed";
done;
}
}
}
}
}
await #promises;
}
When running on CentOS 7.4(12 core, 32G RAM), after a few seconds, my script was killed by system. When running on Win11(12 core, 16G RAM), it's OK.
So how to debug this script?

Woocommerce Custom Place Order API not working cart empty

public function RetriveCart($request){
global $woocommerce;
$woocommerce->frontend_includes();
$user_id = $request['user_id'];
wp_set_current_user( $user_id );
add_action('woocommerce_cart_calculate_fees', array($this,'woo_cart_fee_update'));
$woocommerce->session = new WC_Session_Handler();
$woocommerce->session->init();
$woocommerce->customer = new WC_Customer( get_current_user_id(), true );
$woocommerce->cart = new WC_Cart();
$items = $woocommerce->cart->get_cart();
if(empty($items)){
$response['status'] = 0;
$response['message'] = __("Cart is empty", self::domainText);
$response['data'] = new stdClass();
return new WP_REST_Response($response, 200);
}
foreach($items as $item => $values) {
$_product = wc_get_product( $values['product_id']);
$cart[] = array('key'=>$item,
'product_id'=>$values['product_id'],
'title'=>$_product->get_title(),
'quantity'=>$values['quantity'],
'price'=>$_product->get_price(),
'subtotal'=> strval(($_product->get_price()+$addons_price) * $values['quantity']),
'currency_symbol'=>get_woocommerce_currency_symbol(),
);
}
WC()->cart->calculate_totals();
$shipping = $woocommerce->cart->fee_total;
$cart_summary = array('sub_total'=>$woocommerce->cart->subtotal,
'shipping_amount'=>$shipping,
'order_type'=>$order_type,
'is_deliverable'=>$is_deliverable,
'discount_amount'=>$woocommerce->cart->get_cart_discount_total(),
'tax_amount'=>$woocommerce->cart->tax_total,
'total_amount'=>$woocommerce->cart->total,
'currency_symbol'=>get_woocommerce_currency_symbol(),
);
$output['cart_summary'] = $cart_summary;
$output['items'] = $cart;
$response['status'] = 1;
$response['message'] = __("Cart Items found", self::domainText);
$response['data'] = $output;
return new WP_REST_Response($response, 200);
}
public function newOrder($request){
global $wpdb,$woocommerce;
$woocommerce->frontend_includes();
$orderRequest = $request['order'];
$user_id = $orderRequest['user_id'];
wp_set_current_user( $user_id );
$woocommerce->session = new WC_Session_Handler();
$woocommerce->session->init();
$woocommerce->customer = new WC_Customer( get_current_user_id(), true );
$woocommerce->cart = new WC_Cart();
if ($woocommerce->cart->get_cart_contents_count() == 0) {
$response['status'] = 0;
$response['message'] = __('Cart is empty', self::domainText);
$response['data'] = new stdClass();
return new WP_REST_Response($response, 200);
}
$cart = $woocommerce->cart->get_cart();
$order = wc_create_order(array('customer_id' => get_current_user_id()));
$order_id = $order->id;
foreach($cart as $item => $values) {
$product = wc_get_product($values['product_id']);
$quantity = (int)$values['quantity'];
if(wc_prices_include_tax()){
$product_price = wc_get_price_including_tax($product);
}else{
$product_price = wc_get_price_excluding_tax($product);
}
$variationsArray = array();
$order->add_product($product, $quantity, $variationsArray);
}
$order->set_address( $orderRequest['billing_address'], 'billing' );
$order->set_address( $orderRequest['shipping_address'], 'shipping' );
$order->set_payment_method($orderRequest['payment_method']['id']);
$get_fees = $woocommerce->cart->get_fees();
foreach($get_fees as $fee_data){
$item_fee = new WC_Order_Item_Fee();
$item_fee->set_name($fee_data->name);
$item_fee->set_amount($fee_data->amount);
$item_fee->set_tax_class( '' );
$item_fee->set_tax_status( 'none' );
$item_fee->set_total($fee_data->total);
$item_fee->save();
$order->add_item($item_fee);
}
if(!empty($coupon)){
$order->apply_coupon($coupon[0]);
}
$order->update_status('created');
$order->calculate_totals();
$woocommerce->cart->empty_cart();
$customer_id = $order->get_user_id();
$response['status'] = 1;
$response['message'] = __("Order $order_id is successfully placed", self::domainText);
$response['order_id'] = $order_id;
return new WP_REST_Response($response, 200);
}
In RetriveCart() all datas are there when I try place order. Its give me an empty cart and fees not added.

Laravel - paypal keep maximum 30 second exceed

Paypal in laravel keep returning maximum 30 seconds timeout, sometime it can proceed smoothly but when cart product increase, it will keep return this error, and sometime the error is when create payment, sometime is execute payment, extremely not stable, how can i solve this? i have tried extend the timeout setting to 300, but it still return me a timeout error.
here is my create payment code:
$item_array = [];
$shipping = $request->shipping;
$tax = $request->tax;
$tax_amount = 0;
$subtotal = $total = 0;
$currency = "MYR";
$payer = new Payer();
$payer->setPaymentMethod("paypal");
$credential = new OAuthTokenCredential(env('PAYPAL_SANDBOX_CLIENT_ID'), env('PAYPAL_SANDBOX_SECRET'));
$apiContext = new ApiContext($credential, null);
$order = Order::findOrFail($id);
// change order product status
foreach ($order->orderProduct as $order_product_key => $order_product) {
// get variant
$variant_title_array = array();
if (count($order_product->variantValue) > 0) {
foreach ($order_product->variantValue->variantOption as $variant_option) {
array_push($variant_title_array, $variant_option->name);
}
}
$variant= "";
if (count($variant_title_array) > 0) {
$variant = " ( ".implode(', ', $variant_title_array)." )";
}
// calculate product price and promotion price
$product_price = $compare_price = "";
$product_promotion = get_cart_product_promotion ($order_product, $order);
$product_price = get_product_price_in_cart ($order_product);
// if promotion exits
if (count($product_promotion) != 0) {
$compare_price = get_product_price_in_cart ($order_product);
$product_price = calculate_product_price_after_promotion ($compare_price, $product_promotion);
}
$item = new Item();
$item->setName($order_product->product->title . $variant)
->setCurrency($currency)
->setQuantity($order_product->quantity)
->setSku(get_product_sku_in_cart ($order_product)) // Similar to `item_number` in Classic API
->setPrice((float) str_replace('RM ','', $product_price));
$item_array[$order_product_key] = $item;
$subtotal += (float) str_replace('RM ','', $product_price) * $order_product->quantity;
}
// calculate tax
$tax_amount = ($subtotal * $tax) / 100;
$itemList = new ItemList();
$itemList->setItems($item_array);
$shipping_address = new ShippingAddress();
$shipping_address->setCity('City')
->setCountryCode('AR')
->setPostalCode('200')
->setLine1('Adress Line1')
->setState('State')
->setRecipientName('Recipient Name');
$details = new Details();
$details->setShipping($shipping)
->setTax($tax_amount)
->setSubtotal($subtotal);
$total = $subtotal + $shipping + $tax_amount;
$amount = new Amount();
$amount->setCurrency($currency)
->setTotal($total)
->setDetails($details);
$transaction = new Transaction();
$transaction->setAmount($amount)
->setItemList($itemList)
->setDescription("Payment description")
->setInvoiceNumber(uniqid());
$baseUrl = url('/');
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl("$baseUrl/ExecutePayment.php?success=true")
->setCancelUrl("$baseUrl/ExecutePayment.php?success=false");
$payment = new Payment();
$payment->setIntent("sale")
->setPayer($payer)
->setRedirectUrls($redirectUrls)
->setTransactions(array($transaction));
$request = clone $payment;
try {
$payment->create($apiContext);
} catch (PayPalConnectionException $ex) {
echo $ex->getCode(); // Prints the Error Code
echo $ex->getData(); // Prints the detailed error message
die($ex);
} catch (Exception $ex) {
die($ex);
}
$approvalUrl = $payment->getApprovalLink();
$response = array(
'paymentID' => $payment->id
);
return json_encode($response);
here is my execute payment code:
$shipping = $request->shipping;
$tax = $request->tax;
$tax_amount = 0;
$subtotal = $total = 0;
$currency = "MYR";
$credential = new OAuthTokenCredential(env('PAYPAL_SANDBOX_CLIENT_ID'), env('PAYPAL_SANDBOX_SECRET'));
$apiContext = new ApiContext($credential, null);
$paymentId = $request->paymentID;
$payment = Payment::get($paymentId, $apiContext);
$transaction = new Transaction();
$amount = new Amount();
$details = new Details();
$order = Order::findOrFail($id);
// store order address
$order_address = OrderAddress::firstOrCreate(
[
'order_id' => $order->id
],
[
'name' => $request->shipping_name ,
'phone' => $request->shipping_phone ,
'address1' => $request->shipping_address1 ,
'address2' => $request->shipping_address2 ,
'postcode' => $request->shipping_postcode ,
'state' => $request->shipping_state ,
'country' => $request->shipping_country ,
'city' => $request->shipping_city ,
'order_id' => $order->id
]
);
// update address if exist
$order_address->update([
'name' => $request->shipping_name ,
'phone' => $request->shipping_phone ,
'address1' => $request->shipping_address1 ,
'address2' => $request->shipping_address2 ,
'postcode' => $request->shipping_postcode ,
'state' => $request->shipping_state ,
'country' => $request->shipping_country ,
'order_id' => $order->id
]);
// change order product status
foreach ($order->orderProduct as $order_product) {
// calculate product price and promotion price
$product_price = $compare_price = "";
$product_promotion = get_cart_product_promotion ($order_product, $order);
$product_price = get_product_price_in_cart ($order_product);
// if promotion exits
if (count($product_promotion) != 0) {
$compare_price = get_product_price_in_cart ($order_product);
$product_price = calculate_product_price_after_promotion ($compare_price, $product_promotion);
}
$product_price = (float) str_replace("RM ","",$product_price);
// add promotion to order product if promotion exist
if ($compare_price != "") {
$order_product->order_promotion_id = $order->orderPromotion->promotion_id;
}
$order_product->price = $product_price;
$order_product->status = 2;
$subtotal += $product_price * $order_product->quantity;
$order_product->save();
}
// calculate tax
$tax_amount = ($subtotal * $tax) / 100;
// change cart detail
$current_date_time = Carbon::now();
$order->update([
'subtotal' => $subtotal,
'status' => 2,
'submited_on' => $current_date_time,
'payment_method' => "paypal"
]);
// update shipping fees
if ($shipping > 0) {
$order->shipping_fees = $shipping;
}
// update tax
if ($tax > 0) {
$order->tax = ($subtotal * $tax) / 100;
}
$order->save();
// paypal settings
$total = $subtotal + $shipping + $tax_amount;
$details->setShipping($shipping)
->setTax($tax_amount)
->setSubtotal($subtotal);
$amount->setCurrency($currency);
$amount->setTotal($total);
$amount->setDetails($details);
$transaction->setAmount($amount);
// Add the above transaction object inside our Execution object.
$execution->addTransaction($transaction);
try {
$result = $payment->execute($execution, $apiContext);
try {
$payment = Payment::get($paymentId, $apiContext);
} catch (Exception $ex) {
exit(1);
}
} catch (Exception $ex) {
exit(1);
}
echo "success";

fpdf multi cell control

I am using fpdf to generate a report but one of the field I need to be multicell as the contents can be few lines long. Below is the codes what happens now is that the multicell will be few lines long but the rest of it will be only one standard size and the content after multicell will be on the next line. So how to overcome all this problem
$row_height = 5; // set the default
$column_width = 15;
$number_of_lines = ceil( $pdf->GetStringWidth($eventMessage) / ($column_width - 1) );
$cell_height = 5;
$height_of_cell = ceil( $number_of_lines * $cell_height );
if ( $cell_height > $row_height ) {
$row_height = $cell_height;
}
$pdf->Cell( 10, $row_height,$count, 1, 0, 'L', true );
$pdf->Cell( 15, $row_height,$row['latitude'], 1, 0, 'L', true );
$pdf->Cell( 16, $row_height,$row['longitude'], 1, 0, 'L', true );
$pdf->Cell( 25, $row_height,$row['dateTimer'], 1, 0, 'L', true );
$pdf->Cell( 25, $row_height,$row['insertDateTime'], 1, 0, 'L', true );
$pdf->MultiCell( 15, $row_height,$eventMessage, 1, 'J',true);
$pdf->Cell( 15, $row_height,$eventSource, 1, 0, 'L', true );
$pdf->Cell( 15, $row_height,$eventLocation, 1, 0, 'L', true );
$pdf->Cell( 18, $row_height,$row['stat'], 1, 0, 'L', true );
class pdf extends FPDF {
function GetMultiCellHeight($w, $h, $txt, $border=null, $align='J') {
// Calculate MultiCell with automatic or explicit line breaks height
// $border is un-used, but I kept it in the parameters to keep the call
// to this function consistent with MultiCell()
$cw = &$this->CurrentFont['cw'];
if($w==0)
$w = $this->w-$this->rMargin-$this->x;
$wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
$s = str_replace("\r",'',$txt);
$nb = strlen($s);
if($nb>0 && $s[$nb-1]=="\n")
$nb--;
$sep = -1;
$i = 0;
$j = 0;
$l = 0;
$ns = 0;
$height = 0;
while($i<$nb)
{
// Get next character
$c = $s[$i];
if($c=="\n")
{
// Explicit line break
if($this->ws>0)
{
$this->ws = 0;
$this->_out('0 Tw');
}
//Increase Height
$height += $h;
$i++;
$sep = -1;
$j = $i;
$l = 0;
$ns = 0;
continue;
}
if($c==' ')
{
$sep = $i;
$ls = $l;
$ns++;
}
$l += $cw[$c];
if($l>$wmax)
{
// Automatic line break
if($sep==-1)
{
if($i==$j)
$i++;
if($this->ws>0)
{
$this->ws = 0;
$this->_out('0 Tw');
}
//Increase Height
$height += $h;
}
else
{
if($align=='J')
{
$this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
$this->_out(sprintf('%.3F Tw',$this->ws*$this->k));
}
//Increase Height
$height += $h;
$i = $sep+1;
}
$sep = -1;
$j = $i;
$l = 0;
$ns = 0;
}
else
$i++;
}
// Last chunk
if($this->ws>0)
{
$this->ws = 0;
$this->_out('0 Tw');
}
//Increase Height
$height += $h;
return $height;
}
}
So
$pdf = new pdf();
$pdf->addPage();
$pdf->MultiCell(50, 4, 'Bla bla bla');
$pdf->ln(GetMultiCellHeight(50, 4, 'Bla bla bla'));
$pdf->Output();