iTextSharp difference between implicit explicit NewPage -
i use onstartpage event handler write header, works great, need know whether issued newpage() or issued due page overflow. there elegant way tell? in advance help!
you've written page event implementation, , you've implemented 1 or more of methods. create instance of event this:
mypageevent event = new mypageevent(); writer.setpageevent(event);
whenever onstartpage()
called, want know if called within itext or code using newpage()
method. itext uses same newpage()
method internally, you'll have use trick.
add membervariable page event application. like:
protected boolean mynewpage = false;
now add method event:
public void newpage(document document) { mynewpage = true; document.newpage(); mynewpage = false; }
now whenever want trigger new page, don't use:
document.newpage();
use instead:
event.newpage(document);
the onstartpage()
method called internally every new page initialized, , @ moment, value of mynewpage
true
whenever newpage()
triggered yourself; otherwise false
. hope helps; didn't test it, i'm telling try.
(ps: i'm original developer of itext.)
Comments
Post a Comment