protected void btnCreate_Click(object sender, EventArgs e)
    {
        string temp2 = UploadPdfFile();

        if (temp2 == "File uploaded!")
        {
            string temp1 = NameTextBox.Text;
            int    chk   = temp1.IndexOf(" ");
            if ((IsAlphaNumeric(NameTextBox.Text)) && chk == -1)
            {
                Issue newIssue = new Issue();
                newIssue.IssueId        = NameTextBox.Text;
                newIssue.IssueDirectory = ConfigurationManager.AppSettings["imagepath"] + NameTextBox.Text;
                if (Directory.Exists(newIssue.IssueDirectory))
                {
                    StatusLabel.Text = "Folder already exists!";
                }
                else
                {
                    if (!File.Exists(HttpContext.Current.Server.MapPath("~/pdf") + @"\temp.pdf"))
                    {
                        StatusLabel.Text = "Please upload PDF file first!";
                    }
                    else
                    {
                        Directory.CreateDirectory(newIssue.IssueDirectory);
                        newIssue.Resolution           = ResolutionDropDownList.SelectedValue;
                        newIssue.Quality              = QualityTextBox.Text;
                        newIssue.TextAntialiasing     = TxtAliasingDropDownList.SelectedValue;
                        newIssue.GraphicsAntialiasing = GraphAliasingDropDownList.SelectedValue;
                        //StatusLabel.Text = CreateImages.CreateImagesGhostScript(newIssue);
                        string        pdfpath   = HttpContext.Current.Server.MapPath("~/pdf");
                        string        sourcePDF = pdfpath + @"\temp.pdf";
                        List <string> fileList;
                        GhostScript.DeviceOption[] options = GhostScript.DeviceOptions.jpg(int.Parse(newIssue.Quality), int.Parse(newIssue.TextAntialiasing), int.Parse(newIssue.GraphicsAntialiasing));
                        GhostScript gs = new GhostScript(ConfigurationManager.AppSettings["gspath"]);
                        fileList = gs.Convert(GhostScript.OutputDevice.jpeg, options, sourcePDF, newIssue.IssueDirectory, "%d.jpg", pdfpath, int.Parse(newIssue.Resolution));
                        gs.Dispose();
                        string destinationPDF = newIssue.IssueDirectory + @"\" + newIssue.IssueId + ".pdf";
                        File.Move(sourcePDF, destinationPDF);
                        if (fileList.Count == 0)
                        {
                            MagazineData.CreateIssue(newIssue);
                            CreateXML.CreatePagesXMLFile(newIssue.IssueId);
                            btnPreview.Visible        = true;
                            btnUploadOnServer.Visible = true;
                            StatusLabel.Text          = "Image files created!";
                        }
                        else
                        {
                            StatusLabel.Text = "Error!";
                        }
                    }
                }
            }
            else
            {
                StatusLabel.Text = "Enter valid Issue name";
            }
        }
        else
        {
            StatusLabel.Text = temp2;
        }
    }