mesaglam / alivepdf

Automatically exported from code.google.com/p/alivepdf
0 stars 0 forks source link

addMulticell does not keep x value on new page #39

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. use addMultiCell to create a cell that goes over a page break.

What is the expected output? What do you see instead?
The cell line should go to the next page and the x value should remain so that 
the cells line up 
properly.

Instead the x value is reset to the margin value.

Here is the solution: (in the addCell method)

//Automatic page break
var tempX:Number=this.x; //old line: x=this.x;
 ws=this.ws;
 if(ws>0)
  {
    this.ws=0;
    this.write('0 Tw');
  }
this.addPage(this.currentOrientation, this.defaultUnit, this.defaultFormat 
,currentPage.rotation);
this.x = tempX ;//old line this.x = x;

The problem looks to be one of scope.  it seems like these variables were 
scoped with Java in 
mind.  With actionscript the 'var' keyword is needed.  I changed the name of 
the variable (tempX) 
to be clearer that this.x and x are two different variables.

I looked through the code and there seem to be numerous assignments between 
local & class x 
& y values.  This may be causing problems in other places as well.

Original issue reported on code.google.com by onefootp...@gmail.com on 23 Apr 2008 at 8:13

GoogleCodeExporter commented 9 years ago
Hi onefootprod,

nice bug ! Scope issue, you are right :)
I fixed it for the next release.

thanks for tracking :)

Thibault

Original comment by thibault.imbert on 24 Apr 2008 at 8:10