PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 12:36 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Aug 30, 2016 12:35 pm 
Offline

Joined: Tue Aug 30, 2016 10:56 am
Posts: 4
I am using PDFSharp-MigraDoc-wpf 1.50.4000-beta3b with ASP.NET MVC 5.2.2 to generate one page PDFs on a Microsoft IIS 6.0 server which I then save to a MemoryStream.

This has been working flawlessly for many months, but in the last 10 days I've had 3785 exceptions across three different days (20th, 21st and then 27th). Almost all are of the type "The operation completed successfully", but there are 9 cases of "Not enough storage is available to process this command". In both cases the exception is:

Code:
System.ComponentModel.Win32Exception (0x80004005): The operation completed successfully
   at MS.Win32.HwndWrapper..ctor(Int32 classStyle, Int32 style, Int32 exStyle, Int32 x, Int32 y, Int32 width, Int32 height, String name, IntPtr parent, HwndWrapperHook[] hooks)
   at System.Windows.Media.MediaContextNotificationWindow..ctor(MediaContext ownerMediaContext)
   at System.Windows.Media.MediaContext..ctor(Dispatcher dispatcher)
   at System.Windows.Media.DrawingVisual.RenderOpen()
   at PdfSharp.Drawing.XGraphics..ctor(DrawingContext dc, XSize size, XGraphicsUnit pageUnit, XPageDirection pageDirection)
   at MigraDoc.Rendering.DocumentRenderer.PrepareDocument()
   at MigraDoc.Rendering.PdfDocumentRenderer.PrepareDocumentRenderer(Boolean prepareCompletely)
   at MigraDoc.Rendering.PdfDocumentRenderer.RenderDocument()
   at SystemData.Order.GeneratePDF()


The code:

Code:
Document document = new Document();

PDFGenerator.CreatePDFPage(ref document, this, logoPath);

// Create a renderer
PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer();

// Associate the MigraDoc document with a renderer
pdfRenderer.Document = document;

// Layout and render document to PDF (debug timing shows only 27-56ms to render document)
pdfRenderer.RenderDocument();

MemoryStream ms = new MemoryStream();
pdfRenderer.PdfDocument.Save(ms, false);
ms.Seek(0, SeekOrigin.Begin); 


In my googling I found a similar problem happening for MigraDoc with Azure back in July in this thread: http://forum.pdfsharp.net/viewtopic.php?f=2&t=3405&p=10143&hilit=0x80004005#p10143

Unfortunately, I'm not sure it is really relevant as it is a bit above my head, and so I would appreciate any help with what is going on.


Top
 Profile  
Reply with quote  
PostPosted: Tue Aug 30, 2016 1:31 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
Hi!

I think it is the same issue, so I would try the code modification from the other thread.

And please provide feedback whether the code modification solves your problem.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 139 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