The stackoverflow occurs when I call the function like this:
myPdfDocumentRenderer.RenderDocument();Here there is the code that I use in the service:
Code:
MigraDoc.DocumentObjectModel.Document docInvoice = Invoice.CreateDocument();
docInvoice.UseCmykColor = true;
PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true);
// Set the MigraDoc document
pdfRenderer.Document = docInvoice;
// Create the PDF document
pdfRenderer.RenderDocument();
pdfRenderer.Save(@"Invoice.pdf")
;
When I call
Code:
pdfRenderer.RenderDocument();
occurs the stackoverflow exception.
the Invoice's CreateDocument method is this:
Code:
public MigraDoc.DocumentObjectModel.Document CreateDocument()
{
MigraDoc.DocumentObjectModel.Document document = new Document();
document.Info.Author = "XXXX";
document.Info.Title = "Invoice";
DefineStyles();
CreatePage();
fillDocument();
return document;
}
where the other methods are the same of MigraDoc's Invoice sample.
Thank you