PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Jul 18, 2024 5:23 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Thu Feb 23, 2012 5:21 pm 
Offline

Joined: Thu Feb 23, 2012 4:43 pm
Posts: 2
Hello, all.

I have a pretty standard usage of PDFSharp (or at least I think it's pretty standard), taking a PNG image from the file system, and rendering it onto the first page of a single-page PDF.

My issue is that it works perfectly well in all environments, except one, but the problem is that environment is production.

In production, the process actually does succeed all the time, but it takes an inordinately long time. In all other environments, the process takes 2-3s, whereas in the affected servers, it takes 30-35s. :shock:

Please see the attached image which shows the timings we have been seeing.

The server environment is nothing special: Windows Server 2008 SP2, 32-bit. .NET framework 4.0 and 3.5 is installed.

Here is the code:

Code:
var doc = new PdfDocument();
var pdfOutputFile = Global.TemporaryFolderPhysicalPath + "\\" + uniqueId + ".pdf";

var page = new PdfPage()
{
Width = SummaryOutputPdfWidth,
Height = SummaryOutputPdfHeight
};

doc.Pages.Add(page);

var xGraphics = XGraphics.FromPdfPage(doc.Pages[0]);
var sourceImage = XImage.FromFile(Global.TemporaryFolderPhysicalPath + "\\" + uniqueId + ".png");

double width = SummaryScreenshotWidth;
double height = SummaryScreenshotHeight;

xGraphics.DrawImage(sourceImage, 10, 10, width, height); // <= ** This is what takes the longest amount of time **

doc.Save(pdfOutputFile);
doc.Close();

return pdfOutputFile;

It's the line indicated above which seems to take a massive amount of time; frustratingly, this is something we are totally unable to replicate in any other environment, from local machine, all the way through staging.

Can anyone offer any thoughts on what could possibly cause such a slow-down on a particular environment? Any known interactions with other software (or something missing)?

Thanks much,

Allen


Attachments:
File comment: Shows the timings we have been seeing.
App_Production_Trace.jpg
App_Production_Trace.jpg [ 230.02 KiB | Viewed 5290 times ]
Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 24, 2012 11:14 am 
Offline

Joined: Thu Feb 23, 2012 10:47 am
Posts: 6
Hi,
seems like I'm running into the similar issue.
While memory is releases on most workstation, when creating images in page of pdf,
one other memory is increasing immensly.

Any foundings so far.

regards
jones


Top
 Profile  
Reply with quote  
PostPosted: Sun Feb 26, 2012 8:18 am 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 343
Hi, Allen!
aracho wrote:
My issue is that it works perfectly well in all environments, except one, but the problem is that environment is production.
Are you using GDI+ build or WPF build? Have you tried the other build?
PNG, BMP, GIF, TIFF are all treated the same way by PDFsharp (but maybe the OS treats them different). Could you try BMP to see if it's faster?

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Sun Feb 26, 2012 5:01 pm 
Offline

Joined: Thu Feb 23, 2012 10:47 am
Posts: 6
Hi,
as asked before: Are you using GDI+ or WPF build?
If using GDI+, check for differences in gdiplus.dll version.
Not sure, if this is the reason for your issue, but I've seen differences
in my environments.
So, not knowing which FP would deliver the right dll version and which side effect replacing
only the gdiplus.dll would have, I tried to switch to WPF build.

At least on my systems, performance and mem issues are gone.

regards
jones


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 04, 2012 3:41 pm 
Offline

Joined: Thu Feb 23, 2012 4:43 pm
Posts: 2
Hi jones, Ohmesh -

Thank you for the replies!

I must be using the GDI+ build, since WPF is not involved in the application at all. I'll try see what I can discover about the version of gdiplus.dll. I have a feeling it must be something like that, since there is only one place where the application behaves like this (production). In all other places, it works perfectly, hence my suspicion that there is something different about production.

I'll take a look and report back here.

Regards,

Allen


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

All times are UTC


Who is online

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