PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed Jul 10, 2024 6:20 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue May 17, 2011 3:25 pm 
Offline

Joined: Tue May 17, 2011 3:03 pm
Posts: 2
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.


Top
 Profile  
Reply with quote  
PostPosted: Wed May 25, 2011 9:03 pm 
Offline
Supporter
User avatar

Joined: Thu May 27, 2010 7:40 pm
Posts: 59
Location: New Hampshire, USA
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?


Top
 Profile  
Reply with quote  
PostPosted: Thu May 26, 2011 7:30 am 
Offline

Joined: Tue May 17, 2011 3:03 pm
Posts: 2
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 61 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group