Solved

A generic error occurred in GDI+.

Posted on 2013-11-20
3
23 Views
Last Modified: 2015-06-24
Hi,

I am converting a string to Barcode. Here is my function :

 public void GenerateBarCode(string codeword, string FareCardID, string ClientNm)
        {

            string Code = codeword; // "12345678"; //Request["code"].ToString();
            int w = Code.Length * 40;
            Bitmap oBitmap = new Bitmap(w, 100);
            Graphics oGraphics = Graphics.FromImage(oBitmap);
            Font oFont = new Font("IDAutomationHC39M", 18);
            PointF oPoint = new PointF(2f, 2f);
            SolidBrush oBrushWrite = new SolidBrush(Color.Black);
            SolidBrush oBrush = new SolidBrush(Color.White);
            oGraphics.FillRectangle(oBrush, 0, 0, w, 100);
            oGraphics.DrawString("*" + Code + "*", oFont, oBrushWrite, oPoint);

         
            oBitmap.Save(Server.MapPath("~/Images/Code5.Jpeg"),        System.Drawing.Imaging.ImageFormat.Jpeg);

            GetImage(FareCardID, ClientNm);

        }


This is working fine when I am debugging inside visual studio 2008 on Windows Server 2008 R2 64 bit machine
but when I build and configure it on IIS 7.5 it is giving following error Generic GDI+ error.

It is giving throwing error on the following line

oGraphics.DrawString("*" + Code + "*", oFont, oBrushWrite, oPoint);

Please help

Thanks
0
Comment
Question by:shahjagat
  • 2
3 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39665715
The obvious question would be, "Is the font installed on the server?"
0
 

Accepted Solution

by:
shahjagat earned 0 total points
ID: 39669771
We resolved it. The problem was with permissions for image folder.
0
 

Author Closing Comment

by:shahjagat
ID: 40848143
Issue fixed by us.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now