0
votes

I am getting the following error

[ExternalException (0x80004005): A generic error occurred in GDI+.] System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams) +813085 InventoryMS.PrintBarcodes.Page_Load(Object sender, EventArgs e) +766 System.Web.UI.Control.LoadRecursive() +71 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178

Below is my code

%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PrintBarcodes.aspx.cs" Inherits="InventoryMS.PrintBarcodes" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title><link rel="stylesheet" href="css/bootstrap.min.css" />
        <link rel="stylesheet" href="css/font-awesome.css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="getCodetxt" runat="server" Visible="True"></asp:TextBox>
        <asp:Panel ID="pnlPrint" runat="server">
        <br />&nbsp;
          <% 

              int number = Convert.ToInt32(Session["val"].ToString());
              int t = 1;
              for (int i = 0; i < number; i++)
              {

              %>
            <div style="width:130px; height:99px; float:left; margin-left:17px;">
       <p style="text-align:center; margin-left:0px; margin-bottom:-17px; width:120px;font-size:11px">Testing     Company</p><br />
            <asp:Image ID="img" runat="server" Style="margin-bottom:12px;margin-left:-5px; height:43px; width:130px;"/><br />
                <p style="margin-top:-13px; font-size:10px; text-align:center">Size:<asp:Label ID="lblsize" runat="server" Text=""></asp:Label></p>
                </div>
          <% if (t == 2)
             {

                 t = 1;
                 %>
                 <br />&nbsp;
                 <%
             }
             else { t++; }
              }
              %>
              </asp:Panel>
    </div>
    </form>
</body>
</html>

Please guide me to resolve this issue.

1
You have not provided us with enough information about what your issue is, nor have you provided us with the code which actually fails. Can you please include the code for PrintBarcodes and a more detailed explanation? - Erik Karlstrand

1 Answers

0
votes

From my error this error usually has to do with the file paths. Make sure the folder you are trying to save to exists and that you have write permissions.