sivarajankumar / alivepdf

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

Page.page is always zero when using writeText with long strings with autoPagination #145

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I am performing a series of writeText(), some with \n newline chars, 
and some that are wrapping on their own with strings about 6 lines long
2. I am overriding the header() and footer() function of PDF.as

What is the expected output? What do you see instead?
Inside the header() and footer() function the getCurrentPage.page().page 
is always zero.

What version of the product are you using? On what operating system?
version 0.1.4.9, on FlexBuilder 3, Flash 10, Vista

Please provide any additional information below.

In my code base, I fixed the issue by explicitly setting the page.page 
when I add a new page.
In Page.as:
public function set page ( newValue:int ):void //added by JM
        {
            _page = newValue;   
        }

Then I overrode the newPage in my own class:
    //Working around bug where addPage is not setting the page number 
        override public function addPage ( page:Page=null ):Page{
            var newPageNumber:int = (arrayPages.length)? 
getCurrentPage().page +1 : 0;
            if (page){
                page.page = newPageNumber;
            }
            var newPage:Page = super.addPage(page);
            return newPage;
        }

This seems to work fine. It seems strange that others haven't encountered 
this, and I haven't tested it with explicit addPage or other scenarios, so 
I doubt this is the best way to fix the issue.

Original issue reported on code.google.com by iUvjaci9...@gmail.com on 22 Jul 2009 at 8:10