PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

PdfSharp and Windows Azure
http://forum.pdfsharp.com/viewtopic.php?f=2&t=2605
Page 1 of 1

Author:  benjiiim [ Sun Oct 06, 2013 5:32 pm ]
Post subject:  PdfSharp and Windows Azure

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

Author:  Thomas Hoevel [ Mon Oct 07, 2013 9:13 am ]
Post subject:  Re: PdfSharp and Windows Azure

Hi!

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

Author:  benjiiim [ Mon Oct 07, 2013 9:27 am ]
Post subject:  Re: PdfSharp and Windows Azure

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

Author:  benjiiim [ Mon Oct 07, 2013 8:55 pm ]
Post subject:  Re: PdfSharp and Windows Azure

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.

Author:  Thomas Hoevel [ Tue Oct 08, 2013 9:14 am ]
Post subject:  Re: PdfSharp and Windows Azure

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.

Author:  benjiiim [ Tue Oct 08, 2013 12:03 pm ]
Post subject:  Re: PdfSharp and Windows Azure

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,

Author:  benjiiim [ Mon Apr 21, 2014 11:57 am ]
Post subject:  Re: PdfSharp and Windows Azure

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,

Author:  Thomas Hoevel [ Tue Apr 22, 2014 7:50 am ]
Post subject:  Re: PdfSharp and Windows Azure

benjiiim wrote:
Is there a plan to create an official package?
Yes, but I don't know when it will be published.

Author:  lfpenedo [ Fri Jan 28, 2022 6:15 pm ]
Post subject:  Re: PdfSharp and Windows Azure

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?

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/