Background Color:
 
Background Pattern:
Reset
Search

Forum

Please Log In

We want you to contribute! 

This forum is a moderated environment. 
We try to keep it neat and tidy. In order to access the forum content we would like you to either or register.

HomeHomeScryberScryberIssues and Defe...Issues and Defe...GDI+ errorGDI+ error
Previous
 
Next
New Post
6/1/2019 12:16 AM
 

We are getting what appear to be random errors when generating some PDFs:

A generic error occurred in GDI+.
Parameter name: bmp | inner exceiption | System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.
   at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
   at Scryber.Drawing.Imaging.ImageFormatParser.GetRawBytesFromImage(Image bmp)
   at Scryber.Drawing.Imaging.PDFJpegImageData..ctor(String source, Image jpeg)
   at Scryber.Drawing.Imaging.ImageFormatParser.GetJpegImageData(String uri, Image img)
   at Scryber.Drawing.PDFImageData.InitImageData(String uri, Image bmp) | Stack Trace |    at Scryber.Drawing.PDFImageData.InitImageData(String uri, Image bmp)
   at Scryber.Drawing.PDFImageData.LoadImageFromBitmap(String sourcekey, Bitmap bitmap)
   at EZTrackerWebService.Controllers.InstallationController.createInstallationSignoffPDF(String projectID, String InstallersName, String InspectorsName, String EndUserName, String Date, String UserAddress, String UserCity, String UserState, String UserZip, String UserPhone, String CompanyName, String CompanyAddress, String CompanyCity, String CompanyState, String CompanyZipCode, String CompanyPhoneNumber, String OwnerName, String OwnerAddress, String OwnerCity, String OwnerState, String OwnerZipCode, String OwnerPhoneNumber, Bitmap InstallerSignature, Bitmap EndUserApprovalSignature, String approvalEndUserSignatureDate, Bitmap OwnerApprovalSignature, String approvalOwnerSignatureDate, String approvalEndUserName, String approvalEndUserRelation, String approvalOwnerName, String approvalOwnerRelation)
   at EZTrackerWebService.Controllers.InstallationController.ProcessInstallForm(String FormURLtxt, DateTime submittedDateTime)
   at EZTrackerWebService.Controllers.InstallationController.Get(String FormURL)

 

This does not happen all of the time and running in the lab on a failed set of data from production we cannot repro the error. Same data, same code, one generates the error and the other does not. We are working to see if we can reprocess the same data in production to see if it occurs reliably in production since the data is only processed once.

We are retrieving the image data from an XML file and converting it to a BMP for use in the PDF.

Bitmap OwnerApprovalSignature = null;

 

OwnerApprovalSignature = ConvertToBMP(myNodeList[0].InnerText);

Scryber.Drawing.PDFImageData.LoadImageFromBitmap("3", OwnerApprovalSignature);

 

private Bitmap ConvertToBMP(string base64String)
        {
            Bitmap bmpReturn = null;

            byte[] byteBuffer = Convert.FromBase64String(base64String);
            MemoryStream jpegStream = new MemoryStream(byteBuffer);
            Image image = Image.FromStream(jpegStream);
            MemoryStream bmpStream = new MemoryStream();
            image.Save(bmpStream, System.Drawing.Imaging.ImageFormat.Bmp);
            bmpReturn = (Bitmap)Image.FromStream(bmpStream);
            bmpStream.Dispose();
            jpegStream.Dispose();
            jpegStream = null;
            bmpStream = null;
            byteBuffer = null;
            return bmpReturn;
        }

 
Previous
 
Next
HomeHomeScryberScryberIssues and Defe...Issues and Defe...GDI+ errorGDI+ error