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.
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