array( 'terms' => '<b>Payment Terms</b>' ),
'',
array(
+ 'fontSize' => 12,
'showHeadings' => 1,
'showLines' => 4,
'width' => 530,
$this->pdf_font_size
);
$barCodeText = $account['account_number'] . '-' . $invoice['id'];
+ // $barCodeText = $account['account_number'] . '-3013';
$code39RECT = $this->code39($barCodeText, 1, 30, 0, -5);
- $const = '';
+ $barcode = '';
foreach ($code39RECT as $v) {
- $const .= '<C:rect:'.implode(',', $v).'>';
+ $barcode .= '<C:rect:'.implode(',', $v).'>';
// x position + width
if (($v['x'] + $v['b']) > $MAXcodeWidth) {
$MAXcodeWidth = $v['x'] + $v['b'];
}
}
$pdf->ezSetY( 130 );
- $pdf->ezText( $const, $this->pdf_font_size, array( 'right' => 220, 'justification' => 'right' ) );
+ // $pdf->ezText( $barcode, $this->pdf_font_size, array( 'aright' => 335, 'justification' => 'right' ) );
+ $barCode = array(
+ array( 'content' => $barcode ),
+ );
+ $pdf->ezTable(
+ $barCode,
+ array( 'content' => 'barcode' ),
+ '',
+ array(
+ 'fontSize' => 12,
+ 'showHeadings' => 0,
+ 'showLines' => 0,
+ 'width' => 250,
+ 'xPos' => 300,
+ 'xOrientation' => 'right',
+ 'cols' => array(
+ 'content' => array( 'width' => 250 )
+ ),
+ )
+ );
+ $pdf->ezText( '', $this->pdf_font_size );
+ $paymentForm = array(
+ array( 'header' => '<b>Please Pay:</b>', 'value' => $invoice['balance'] ),
+ array(
+ 'header' => '<b>Payment Amount:</b>',
+ 'value' => '___________',
+ 'headerFill' => $this->color_white,
+ 'valueFill' => $this->color_white,
+
+ ),
+ array( 'header' => '<b>Member Billing #:</b>', 'value' => $account['account_number'] ),
+ );
+ $pdf->ezTable(
+ $paymentForm,
+ array( 'header' => 'Header', 'value' => 'Value' ),
+ '',
+ array(
+ 'fontSize' => 12,
+ 'showHeadings' => 0,
+ 'showLines' => 0,
+ 'width' => 230,
+ 'xPos' => 320,
+ 'xOrientation' => 'right',
+ 'cols' => array( 'header' => array( 'justification' => 'right' ), 'value' => array( 'justification' => 'right' ) ),
+ )
+ );
$pdf->ezStream();
}
wp_die();
}
- function code39($text, $barcodethinwidth = 2, $barcodeheight = 40, $xpos = 0, $ypos = 0)
+ function code39( $text, $barcodethinwidth = 2, $barcodeheight = 40, $xpos = 0, $ypos = 0 )
{
$barcodethickwidth = $barcodethinwidth * 3;
- $codingmap = array('0' => '000110100', '1' => '100100001',
+ $codingmap = array(
+ '0' => '000110100', '1' => '100100001',
'2' => '001100001', '3' => '101100000', '4' => '000110001',
'5' => '100110000', '6' => '001110000', '7' => '000100101',
'8' => '100100100', '9' => '001100100', 'A' => '100001001',
'W' => '111000000', 'X' => '010010001', 'Y' => '110010000',
'Z' => '011010000', ' ' => '011000100', '$' => '010101000',
'%' => '000101010', '*' => '010010100', '+' => '010001010',
- '-' => '010000101', '.' => '110000100', '/' => '010100010', );
- $text = strtoupper($text);
+ '-' => '010000101', '.' => '110000100', '/' => '010100010',
+ );
+ $text = strtoupper( $text );
$text = "*$text*"; // add start/stop chars.
- $textlen = strlen($text);
- $barcodewidth = ($textlen) * (7 * $barcodethinwidth + 3 * $barcodethickwidth) - $barcodethinwidth;
- for ($idx = 0; $idx < $textlen; ++$idx) {
- $char = substr($text, $idx, 1);
+ $textlen = strlen( $text );
+ $barcodewidth = ( $textlen ) * ( 7 * $barcodethinwidth + 3 * $barcodethickwidth ) - $barcodethinwidth;
+ for ( $idx = 0; $idx < $textlen; ++$idx ) {
+ $char = substr( $text, $idx, 1 );
// make unknown chars a '-';
- if (!isset($codingmap[$char])) {
+ if ( !isset( $codingmap[$char] ) ) {
$char = '-';
}
- for ($baridx = 0; $baridx <= 8; ++$baridx) {
- $elementwidth = (substr($codingmap[$char], $baridx, 1)) ?
- $barcodethickwidth
- : $barcodethinwidth;
- if (($baridx + 1) % 2) {
- $rectangle[] = array('x' => $xpos, 'y' => $ypos, 'b' => $elementwidth, 'h' => $barcodeheight);
+ for ( $baridx = 0; $baridx <= 8; ++$baridx ) {
+ $elementwidth = ( substr( $codingmap[$char], $baridx, 1 ) ) ? $barcodethickwidth : $barcodethinwidth;
+ if ( ( $baridx + 1 ) % 2 ) {
+ $rectangle[] = array( 'x' => $xpos, 'y' => $ypos, 'b' => $elementwidth, 'h' => $barcodeheight );
}
$xpos += $elementwidth;
}