Inside of a ASP.net Web application, we are using PDFSharp to take an image of a signature, and also a Date string, and stamp them on a PDF. It was tested and working at one point on the production server(Windows Server 2003). The line of code that the debugger hits prior to jsut hanging for an indefinite amount of time is: gfxSigPage.DrawString...
If that line of code is commented out, it will still hang on the DrawImage line below it.
This exact code works perfectly fine on my development machine still, and as i said worked at one point on the server.
If anyone has any ideas, they would be greatly appreciated,
Thanks,
Jeremiah
Code:
Array mySigImg = mySig.GetImageBytes(100, 100, FILETYPE.GIF, 100, 100);
Stream sigStream = new MemoryStream((byte[])mySig.GetImageBytes(100, 100, FILETYPE.GIF, 100, 100));
Stream pdfStream = new MemoryStream(bytFile, 0, bytFile.Length, true, true);
//create PDF object
PdfSharp.Pdf.PdfDocument myPDF = PdfSharp.Pdf.IO.PdfReader.Open(pdfStream, PdfSharp.Pdf.IO.PdfDocumentOpenMode.Modify);
//find last page, which is sig page
int SigPageNumber = myPDF.PageCount - 1;
//load last page into xGraphics object
PdfSharp.Drawing.XGraphics gfxSigPage = PdfSharp.Drawing.XGraphics.FromPdfPage(myPDF.Pages[SigPageNumber]);
//create system image file, that the image stream can be written to.
Bitmap bmp = new Bitmap(sigStream);
PdfSharp.Drawing.XFont fontArial = new PdfSharp.Drawing.XFont("Arial", 12);
PdfSharp.Drawing.XPoint pdfPoint = new PdfSharp.Drawing.XPoint(450, 347);
//create image object to add to that page, filling it with the bmp created above
PdfSharp.Drawing.XImage sigImage = PdfSharp.Drawing.XImage.FromGdiPlusImage((System.Drawing.Image)bmp);
gfxSigPage.DrawString(SignedDate, fontArial, PdfSharp.Drawing.XBrushes.Black, pdfPoint);
gfxSigPage.DrawImage(sigImage, 200, 320);
Stream finalpdfStream = new MemoryStream();
myPDF.Save(finalpdfStream, false);
bytFile = StreamToByteArray(finalpdfStream);