sivarajankumar / alivepdf

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

Page Add Event font modification overrides font styling of addMultiCell that triggered it #156

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I have a Page Add event handler that adds a header and watermark to the
PDF.  The header is in a bold larger font.
2. When an addMultiCell call triggers a new page to be added the font of
the header is used for the text being output next.
3. The order of behaviour is this - Set the font, call addMultiCell, a new
page event fires changes the font, the multicell outputs in the header font.

To be able to correctly handle the Page Add event the PDF object needs to
either store the current font/style/size prior to the event firing and
restore it afterward.  This behaviour could perhaps be switched on/off.

Alternatively access to
getCurrentFontFamily/getCurrentFontStyle/getCurrentFontSize so as to be
able to retrieve and then restore them manually within the Page Add event
handler.

What version of the product are you using? On what operating system?

0.1.4.9

Please provide any additional information below.

If I get a chance I will investigate adding this ability though my
ActionScript skills are still developing so it might take a while to work
out.  :)

Original issue reported on code.google.com by elton%co...@gtempaccount.com on 15 Sep 2009 at 6:11

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Well that was easier than I imagined.  I simply added another call to restore
the font after the dispatch of the PageEvent.ADDED and the issue was fixed.  My 
add
page event handler can modify the font and it is restored correctly.

        dispatcher.dispatchEvent( new PageEvent ( PageEvent.ADDED, currentPage ) );

        //Restore font again...
        if ( family ) setFont ( family, style, size );

        return page;
   }

Original comment by elton%co...@gtempaccount.com on 15 Sep 2009 at 6:41

GoogleCodeExporter commented 8 years ago
Hi there,

The 0.1.5 is handling this natively now with a different approach, which would 
work 
perfectly with your case. Btw, you'll tell me here when the 0.1.5 RC will be 
out and 
test and let me know if it breaks something.

Thanks!

Thibault

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

GoogleCodeExporter commented 8 years ago
Hello,

I am experiencing a similar issue using 0.1.5...

- I set my font to a bold font and the color to a gray.
- I make a call to the addMutliCell method, and the text I am displaying takes 
2 pages.
- The output shows the correct font and color on the first page, but the 2nd 
page doesn't have the bold font and the gray color.

Please advise on a solution.

Thanks.

Original comment by owah...@gmail.com on 21 Jul 2010 at 11:01