tags:

views:

988

answers:

2

I am using java port of fpdf. I am encountering fowwlowing errors.

1).When i call multicell 2 times every time the text is printed on a new line.

MultiCell(0, 1, "abcd", currentBorders, Alignment.LEFT, false); //prints on one line
 MultiCell(0, 1, "efg", currentBorders, Alignment.LEFT, false); //prints on next line

I want that there is no line break after the call to multicell. How can i do it?

2)If i do the following thing then some part of my string gets printed on one line and some on next.

 MultiCell(getStringWidth(myString), 1, myStringcurrentBorders, Alignment.LEFT, false);

3)If i do the following thing then there are many blank lines after the line on which myString is printed. It works correctly if i use one 1 ans second parameter

 MultiCell(0, myFontSize, "123456", currentBorders, Alignment.LEFT, false);

What is the problem?

+1  A: 

I would get the current y position before writing the multicell and then move the 'cursor' back to that y position after the multicell generation.

$current_y = $pdf->GetY();
$current_x = $pdf->GetX();

$cell_width = 50;
MultiCell($cell_width, 1, "abcd", currentBorders, Alignment.LEFT, false);

$pdf->SetXY($current_x + $cell_width, $current_y);

$current_x = $pdf->GetX();
MultiCell($cell_width, 1, "abcd", currentBorders, Alignment.LEFT, false);

Something like that.

Josh Pinter
A: 

Worked great thanks!

shar