c# - "'System.StackOverflowException" in "OnEndPage" event handler -
c# - "'System.StackOverflowException" in "OnEndPage" event handler -
in code below, can see overrode onendpage
event , tried add together paragraph document. however, "system.stackoverflowexception" error when attempting run code. have thought why happening , how can prepare it?
public override void onendpage(pdfwriter writer, document document) { base.onendpage(writer, document); paragraph p = new paragraph("paragraph"); document.add(p); }
it forbidden utilize document.add()
in page event. document
object passed parameter pdfdocument
object. should utilize read-only purposes only. documented in book itext in action - sec edition.
if want add together content in onendpage
method, need writer
, instance writer.directcontent
.
c# itextsharp
Comments
Post a Comment