Solved

A generic error occurred in GDI+.

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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