Solved

A generic error occurred in GDI+.

Posted on 2013-11-20
3
21 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

16 Experts available now in Live!

Get 1:1 Help Now