sivarajankumar / alivepdf

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

writeFlashHtmlText duplicates content if new page is added #167

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. set PDF to automatically do page breaks
2. write some long text to the PDF using a single call to writeFlashHtmlText 
(the text should be 
long enough to definitely fill more than one page so an automatic page break is 
forced)
3.

What is the expected output? What do you see instead?
Expected: new page is added to document and text continues from where it left 
on on the 
previous page.

Instead: new page contains content from the previous page in addition to 
content that is 
supposed to be on the page.

What version of the product are you using? On what operating system?
AlivePDF 1.5.0 beta revision 205 (trunk)

Please provide any additional information below.
Changing the following line inside the renderLine function of PDF.as fixes the 
issue:

changed:
addPage( currentPage.clone() );

to:
var page:Page = currentPage.clone();
page.content = "";
page.transitions = "";
addPage ( page );

Original issue reported on code.google.com by jens.wegar@gmail.com on 5 Nov 2009 at 8:37

GoogleCodeExporter commented 8 years ago
I had this same issue and while the above changes certainly work to fix it. I 
solved it by modifying the clone 
method to include two new booleans for cloning content and/or transitions.

I believe that this is more elegant b/c it allows the new pages to keep any 
transitions that have been set. As 
well as being able to take advantage of the new clone abilities in the future.

Proposed clone method:
//BEGIN DTG fix
        public function clone (blankPage:Boolean = false,noTrans:Boolean = false ):Page 
        {
            var page:Page = new Page ( orientation, _unit, size, rotation );

            if(!blankPage){
                page.content = content;
            }

            if(!noTrans){
                page.transitions = transitions;
            }

            return page;        
        }
        //END DTG fix

proposed change to renderLine method of PDF.as around line 3052

                addPage ( currentPage.clone(true) );

Original comment by dan.gaid...@gmail.com on 9 Jan 2010 at 5:30

GoogleCodeExporter commented 8 years ago
Hi guys,

Yes this one was fixed in the drop I am working on (0.1.5 RC).

Nice idea concerning the clone method, I will see how we can extend also that.

Thanks guys for using AlivePDF and submitting bugs,

best,

Thibault

Original comment by thibault.imbert on 23 Jan 2010 at 10:40

GoogleCodeExporter commented 8 years ago
As stated in the previous comment, the issue is fixed.

Original comment by felix.ge...@gmail.com on 15 Oct 2011 at 10:11