Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

A generic error occurred in GDI+.

Posted on 2013-11-20
3
Medium Priority
?
30 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

824 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