PDFsharp & MigraDoc Foundation

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

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Sun Oct 06, 2013 5:32 pm 
Offline

Joined: Sun Oct 06, 2013 5:17 pm
Posts: 5
Hi,

When using PDFSharp on Windows Azure Web Site, I got a System.OutOfMemoryException in the XGraphics.FromPdfPage(PDfPage) method.

The system is not Under memory pressure during this problem. It works well if I execute this outside of Windows Azure Web Site.

You cand find the stacktrace below:

at System.Drawing.Graphics.FromHwndInternal(IntPtr hwnd)
at System.Drawing.Graphics.FromHwnd(IntPtr hwnd)
at PdfSharp.Drawing.XGraphics..ctor(PdfPage page, XGraphicsPdfPageOptions options, XGraphicsUnit pageUnit, XPageDirection pageDirection)
at PdfSharp.Drawing.XGraphics.FromPdfPage(PdfPage page)
at Alpha.Intra.Dossiers.Documents.BonCommande.GenerateDoc(PdfDocument document) in c:\code\Main\Alpha\Intra\Dossiers\Documents\BonCommande.ashx.cs:line 215
at Alpha.Intra.Dossiers.Documents.BonCommande.ProcessRequest(HttpContext context) in c:\code\Main\Alpha\Intra\Dossiers\Documents\BonCommande.ashx.cs:line 203
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Do you have an idea of how to fix this?

Thanks a lot.
Regards
Benjiiim


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 07, 2013 9:13 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3111
Location: Cologne, Germany
Hi!

Have you tried the WPF build instead of the GDI+ build?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 07, 2013 9:27 am 
Offline

Joined: Sun Oct 06, 2013 5:17 pm
Posts: 5
Thanks for your quick answer.

I have not tried yet. Can I use the WPF build in an ASP.NET application?

http://www.pdfsharp.net/NuGetPackage_PDFsharp-WPF.ashx states that "This build of PDFsharp is intended to be used in WPF desktop applications. In ASP.NET web applications PDFsharp (GDI) should be used."

Thanks


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 07, 2013 8:55 pm 
Offline

Joined: Sun Oct 06, 2013 5:17 pm
Posts: 5
Hi Thomas,

An other question: the Nuget package for the WPF version doesn't seem to be available.
I can't find it on Nuget http://www.nuget.org/packages?q=PDFsharp

Can you advise?

Thanks a lot.


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 08, 2013 9:14 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3111
Location: Cologne, Germany
You can find the binaries and the full source code on SourceForge or CodePlex. The WPF version is not yet on NuGet.

I heard from Stefan that FromHwnd() is not working on Azure servers. He said he would look at it.
He couldn't tell me whether the WPF build would work on Azure.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 08, 2013 12:03 pm 
Offline

Joined: Sun Oct 06, 2013 5:17 pm
Posts: 5
Hi,

I confirm that the root cause is on Windows Azure Web Site. Some System.Drawing features has been desactivated as they are not supported in a server environments.

I have found and tried the WPF version yesterday and it works well, with no change in the code, which is great. :-)

Having the WPF version on Nuget would be awesome.

Thanks for the answers and for the great work you are doing on PDFSharp.

Regards,


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 21, 2014 11:57 am 
Offline

Joined: Sun Oct 06, 2013 5:17 pm
Posts: 5
Hi Thomas,

I can see a PDFsharp-MigraDoc-WPF package on Nuget https://www.nuget.org/packages/PDFsharp-MigraDoc-WPF/

It doesn't seem to be an official package (not the same author).
Is there a plan to create an official package?

Thanks
Regards,


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 22, 2014 7:50 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3111
Location: Cologne, Germany
benjiiim wrote:
Is there a plan to create an official package?
Yes, but I don't know when it will be published.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 28, 2022 6:15 pm 
Offline

Joined: Fri Jan 28, 2022 6:02 pm
Posts: 1
I'm trying to generate a PDF file in a web api hosted in Azure as an App Service. First, I was using PDFSharp and Mirgradoc and after reading this post I uninstall them to install PDFSharp Migradoc WPF as suggested in the discussion. Now, I'm getting this error message: "One or more errors occurred. (Could not load file or assembly 'PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.)".

Is it possible to generate PDF files in an Azure App Services applications? What am I missing after installing the WPF version?


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 13 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