PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Windows Service and MigraDoc Rendering https://forum.pdfsharp.net/viewtopic.php?f=2&t=1659 |
Page 1 of 1 |
Author: | Barth84 [ Tue May 17, 2011 3:25 pm ] |
Post subject: | Windows Service and MigraDoc Rendering |
Hello, I am developing a windows service that receives some data and creates a pdf file on the disk. When I call the rendering function of the PdfDocumentRendered or DocumentRenderer objects the service crashes with a StackOverflow Exception. I tried to change the service's user account from local system to a domain user, and I activate the flag for desktop interation (in both configurations) with no success. I tried to develop a console application with the same logic and in this case all works fine. Is the problem due do the GDI+ API and windows service? I also tried to create the hello world pdf file from the windows service with a PdfDocument and the XGraphics object, and this works. I need to create some tables, so I think that I need Migradoc objects. So the solution that I'm following is to create a console application that creates the pdf file, and the windows service calls that application. Do you have any solution or advice? Thank you very much. |
Author: | jeffhare [ Wed May 25, 2011 9:03 pm ] |
Post subject: | Re: Windows Service and MigraDoc Rendering |
I suspect you'll need to supply a little more code context. Are you saying that your call like this is having a stack overflow? myPdfDocumentRenderer.RenderDocument(); Where is the stack overflowing occurring? |
Author: | Barth84 [ Thu May 26, 2011 7:30 am ] |
Post subject: | Re: Windows Service and MigraDoc Rendering |
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 |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |