예제 #1
0
        protected Arquivo inserirArquivosNaLista(string id, string opcao)
        {
            List <Arquivo> list_temp = new List <Arquivo>();

            list_temp = (List <Arquivo>)Session[opcao];
            Arquivo arq_temp = new Arquivo();

            if (list_temp != null)
            {
                string nomeArquivo = montarFormatoGD(id, opcao + ext);
                int    count       = list_temp.Count;
                if (count >= 2)
                {
                    MergeDocument document = MergeDocument.Merge(diretorio + list_temp.ElementAt(0).nome_Arquivo, diretorio + list_temp.ElementAt(1).nome_Arquivo);
                    if (count > 2)
                    {
                        for (int i = 2; i < count; i++)
                        {
                            document.Append(diretorio + list_temp.ElementAt(i).nome_Arquivo);
                        }
                    }
                    document.Draw(nomeArquivo);
                    System.IO.File.Delete(diretorio + nomeArquivo);
                    System.IO.File.Move(nomeArquivo, diretorio + nomeArquivo);
                }
                arq_temp.nome_Arquivo = nomeArquivo;
                arq_temp.tipo_Arquivo = opcao;
            }
            return(arq_temp);
        }
        // A simple Merge of two PDF files.
        // Use the ceTe.DynamicPDF.Merger namespace for the MergeDocument class.
        static void Merge2Pdfs()
        {
            //Create MergeDocument object with source PDFs to Merge
            MergeDocument document = MergeDocument.Merge(GetResourcePath("doc-a.pdf"), GetResourcePath("doc-b.pdf"));

            //Save the merged PDF
            document.Draw("output-simple-merge.pdf");
        }
        // A simple merge and then appending another PDF.
        // Use the ceTe.DynamicPDF.Merger namespace for the MergeDocument class.
        static void MergeAndAppendPdfs()
        {
            //Create MergeDocument object with source PDFs to Merge
            MergeDocument document = MergeDocument.Merge(GetResourcePath("doc-a.pdf"), GetResourcePath("doc-b.pdf"));

            //Append a PDF document
            document.Append(GetResourcePath("doc-c.pdf"), 1, 2);

            //Save the merged PDF
            document.Draw("output-with-append.pdf");
        }
        public static void Run(string outputPdfPath)
        {
            // Create a merge document and set it's properties
            MergeDocument document = MergeDocument.Merge(Util.GetResourcePath("PDFs/DocumentA.pdf"), Util.GetResourcePath("PDFs/DocumentB.pdf"));

            // Append additional PDF
            document.Append(Util.GetResourcePath("PDFs/DocumentC.pdf"));

            // Append 3 pages from an aditional PDF
            document.Append(Util.GetResourcePath("PDFs/DocumentD.pdf"), 1, 3);

            // Outputs the merged document to the current web page
            document.Draw(outputPdfPath);
        }
예제 #5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            // Create a merge document and set it's properties
            MergeDocument document = MergeDocument.Merge(FileUpload1.PostedFile.FileName, FileUpload2.PostedFile.FileName);

            string nomeArquivo1 = FileUpload1.PostedFile.FileName.Substring(FileUpload1.PostedFile.FileName.LastIndexOf('\\') + 1);

            // Outputs the merged document to the current web page
            //document.DrawToWeb(FileUpload1.PostedFile.FileName);
            document.Draw(nomeArquivo1);

            // Opens the PDF (Requires a PDF Viewer)
            //System.Diagnostics.Process.Start(nomeArquivo1);

            // Put the file on a specific Path
            System.IO.File.Move(nomeArquivo1, "c://Temp//" + nomeArquivo1);
        }
예제 #6
0
        protected Arquivo inserirArquivosNaLista(string id, string opcao)
        {
            List <Arquivo> list_temp = new List <Arquivo>();

            list_temp = (List <Arquivo>)Session[opcao];
            Arquivo arq_temp = new Arquivo();

            if (list_temp != null)
            {
                string nomeArquivo = list_temp.ElementAt(0).nome_Arquivo;
                int    count       = list_temp.Count;

                if (count >= 2)
                {
                    MergeDocument document = MergeDocument.Merge(diretorio + list_temp.ElementAt(0).nome_Arquivo, diretorio + list_temp.ElementAt(1).nome_Arquivo);
                    if (count > 2)
                    {
                        for (int i = 2; i < count; i++)
                        {
                            document.Append(diretorio + list_temp.ElementAt(i).nome_Arquivo);
                        }
                    }
                    document.Draw(nomeArquivo);

                    //Deletando os arquivos temporarios usados no merge
                    for (int i = 0; i < count; i++)
                    {
                        if (!nomeArquivo.Equals((String)list_temp.ElementAt(i).nome_Arquivo))
                        {
                            System.IO.File.Delete(diretorio + list_temp.ElementAt(i).nome_Arquivo);
                        }
                    }
                    System.IO.File.Move(nomeArquivo, diretorio + nomeArquivo);
                }
                arq_temp.nome_Arquivo = nomeArquivo;
                arq_temp.tipo_Arquivo = opcao;
            }
            return(arq_temp);
        }
예제 #7
0
        protected void ImageButtonSalvar_Click(object sender, ImageClickEventArgs e)
        {
            if (FileUpload1.HasFile)
            {
                //lembrar de adicionar o ID do cadastro ao nome na hora de adicionar ao banco
                String nameFile = "";
                if (Session["abaAtiva"].ToString().Equals((string)"TabPanelPessoais"))
                {
                    nameFile = "docsPessoais";
                }
                else if (Session["abaAtiva"].ToString().Equals((string)"TabPanelTitulacao"))
                {
                    nameFile = "titulacoes";
                }
                else if (Session["abaAtiva"].ToString().Equals((string)"TabPanelPortaria"))
                {
                    nameFile = "portarias";
                }
                else if (Session["abaAtiva"].ToString().Equals((string)"TabPanelCI"))
                {
                    nameFile = "cis";
                }
                else if (Session["abaAtiva"].ToString().Equals((string)"TabPanelAviso"))
                {
                    nameFile = "avisoFerias";
                }
                else if (Session["abaAtiva"].ToString().Equals((string)"TabPanelRequerimento"))
                {
                    nameFile = "requerimentos";
                }
                else if (Session["abaAtiva"].ToString().Equals((string)"TabPanelOutros"))
                {
                    nameFile = "outros";
                }

                if (Session["postou_" + nameFile].ToString().Equals((string)"sim"))
                {
                    string nomeArquivo = nameFile + ext;
                    // Create a merge document and set it's properties
                    MergeDocument document = MergeDocument.Merge(pathDir + nomeArquivo, FileUpload1.PostedFile.FileName);
                    //string nomeArquivo1 = FileUpload1.PostedFile.FileName.Substring(FileUpload1.PostedFile.FileName.LastIndexOf('\\') + 1);
                    // Outputs the merged document
                    document.Draw(nomeArquivo);
                    System.IO.File.Delete(pathDir + nomeArquivo);
                    System.IO.File.Move(nomeArquivo, pathDir + nomeArquivo);
                }
                //se ainda nao postou o documento nao precisa fazer um merge
                else
                {
                    try
                    {
                        FileUpload1.SaveAs(pathDir + nameFile + ext);
                        //FileUpload1.SaveAs("C:\\Temp\\" + nameFile + ext);
                        Session.Add("fileName", nameFile + ext);
                    }
                    catch (Exception ex)
                    {
                        LabelErro.Text = ex.Message;
                    }
                }
                LabelArquivo.Text        = nameFile + ext;
                LinkButtonVer.Visible    = true;
                LinkButtonDelete.Visible = true;
                //levantar flag dizendo que o arquivo foi postado
                Session.Add("postou_" + nameFile, "sim");
            }
            else
            {
                //Mostra o Erro quando não tem arquivo selecionado
                LabelErro.Text = "Selecione o arquivo";
            }
        }
예제 #8
0
        static void Main(string[] args)
        {
            Stopwatch sw = new Stopwatch();                                 //Track application performace

            sw.Start();

            MergeDocument document;
            int           value = 1, decimalLength = 0;                     //decimalLength and num are both used for
                                                                            //creating an incremental string value
                                                                            //pattern. An example is 00001, 00002 etc.


            //Create instance of PDFExtract class to access reusable methods
            PDFTool obj = new PDFTool("PCS_technical_exercise", "*_SPD_*.pdf", "*_SPD COVER PAGE.pdf");

            //Use Task to improve application performance when locating individual files.
            Task <string[]> t1 = Task.Factory.StartNew(() => obj.GetNonCoverPDFPath());
            Task <string[]> t2 = Task.Factory.StartNew(() => obj.GetCoverPDFPath());
            Task <string[]> t3 = Task.Factory.StartNew(() => obj.GetNonCoverPDFFileName());
            Task <string[]> t4 = Task.Factory.StartNew(() => obj.GetCoverPDFFileName());

            Task.WhenAll(t1, t2, t3, t4);

            //Get project directory and PDF file path
            string path = obj.GetProjectPath();                             //application path

            string[] nonCoverPDFPath = t1.Result;                           //non-cover pdf filepath
            string[] coverPDFPath    = t2.Result;                           //cover pdf filepath

            //Get PDF file names
            string[] nonCoverPDFFileName = t3.Result;                       //Containing 'SPD COVER PAGE' in file name
            string[] coverPDFFileName    = t4.Result;                       //Containing only 'SPD' in file name


            try
            {
                for (int i = 0; i < nonCoverPDFPath.Length; i++)
                {
                    // Merge the two documents
                    document = MergeDocument.Merge(nonCoverPDFPath[i], coverPDFPath[i]);

                    //Get only the filename (without) its file's extension
                    string fileNameExtract = obj.GetFileNameWithoutExtension(nonCoverPDFFileName[i]);

                    //pad integer value with four leading zeros
                    decimalLength = value.ToString("D").Length + 4;
                    string valuePattern = value.ToString("D" + decimalLength.ToString());

                    //increment value
                    value++;

                    // Save new PDF file using only fileNameExtract and valuePattern
                    string newFile = path + @"\" + fileNameExtract + "_" + valuePattern + ".pdf";
                    document.Draw(newFile);

                    Console.WriteLine();

                    Console.WriteLine("File: " + fileNameExtract + "_" + valuePattern + ".pdf" +
                                      " succsessfully created in ");
                    Console.WriteLine("Directory: " + path);
                    Console.WriteLine("\n=========");
                }
            }
            catch (IndexOutOfRangeException e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                sw.Stop();
                long time = sw.ElapsedMilliseconds;
                Console.WriteLine("Execution time (milleseconds): " + time);     //Performance metric report
                Console.ReadLine();
            }
        }
예제 #9
0
        protected void ImageButtonSalvar_Click(object sender, ImageClickEventArgs e)
        {
            if (FileUpload1.HasFile)
            {
                string id       = "";
                string nameFile = "";
                try
                {
                    id = obterIdCadastrado();
                }
                catch (Exception ex)
                {
                    LabelErro.Text         = ex.Message;
                    ImageAttention.Visible = true;
                }
                if (Session["abaAtiva"].ToString().Equals((string)"TabPanelPessoais"))
                {
                    nameFile = "docsPessoais";
                }
                else if (Session["abaAtiva"].ToString().Equals((string)"TabPanelTitulacao"))
                {
                    nameFile = "titulacoes";
                }
                else if (Session["abaAtiva"].ToString().Equals((string)"TabPanelPortaria"))
                {
                    nameFile = "portarias";
                }
                else if (Session["abaAtiva"].ToString().Equals((string)"TabPanelCI"))
                {
                    nameFile = "cis";
                }
                else if (Session["abaAtiva"].ToString().Equals((string)"TabPanelAviso"))
                {
                    nameFile = "avisoFerias";
                }
                else if (Session["abaAtiva"].ToString().Equals((string)"TabPanelRequerimento"))
                {
                    nameFile = "requerimentos";
                }
                else if (Session["abaAtiva"].ToString().Equals((string)"TabPanelOutros"))
                {
                    nameFile = "outros";
                }
                string nomeArquivo = montarFormatoGD(id, nameFile + ext);
                if (Session["postou_" + nameFile].ToString().Equals((string)"sim"))
                {
                    // Create a merge document and set it's properties
                    MergeDocument document = MergeDocument.Merge(pathDir + nomeArquivo, FileUpload1.PostedFile.FileName);
                    // Outputs the merged document
                    document.Draw(nomeArquivo);
                    System.IO.File.Delete(pathDir + nomeArquivo);
                    System.IO.File.Move(nomeArquivo, pathDir + nomeArquivo);
                }
                //se ainda nao postou o documento nao precisa fazer um merge
                else
                {
                    try
                    {
                        FileUpload1.SaveAs(pathDir + nomeArquivo);
                        Session.Add("fileName", nomeArquivo);
                    }
                    catch (Exception ex)
                    {
                        LabelErro.Text         = ex.Message;
                        ImageAttention.Visible = true;
                    }
                }
                TableArquivo.Visible      = true;
                LabelArquivo.Text         = nomeArquivo;
                ImageButtonVer.Visible    = true;
                ImageButtonDelete.Visible = true;
                //levantar flag dizendo que o arquivo foi postado
                Session.Add("postou_" + nameFile, "sim");

                Arquivo arq = new Arquivo();
                arq.nome_Arquivo = nomeArquivo;
                arq.tipo_Arquivo = nameFile;

                List <Arquivo> lista = new List <Arquivo>();
                lista = (List <Arquivo>)Session["arquivos"];
                if (lista == null)
                {
                    lista = new List <Arquivo>();
                }
                lista.Add(arq);
                Session["arquivos"] = lista;
            }
            else
            {
                //Mostra o Erro quando não tem arquivo selecionado
                LabelErro.Text         = "Selecione o arquivo";
                ImageAttention.Visible = true;
            }
        }
예제 #10
0
        public ActionResult Create(LetterEntryView model)
        {
            JSONResponse result = new JSONResponse();

            result.Value    = false;
            result.Response = string.Empty;

            try
            {
                if (Session["BusinessUnitID"] == null | Session["CurrentUserID"] == null)
                {
                    throw new Exception(Resources.LetterEntry.Alert_SessionIsNull);
                }

                var businessunitid = new Guid(Convert.ToString(Session["BusinessUnitID"]));
                var systemuserid   = new Guid(Convert.ToString(Session["CurrentUserID"]));
                var userid         = db.systemUser.Single(p => p.SystemUserId == systemuserid);

                if (ModelState.IsValid)
                {
                    StringBuilder errorMessages = new StringBuilder(), successMessages = new StringBuilder();
                    KeyValuePair <int, string> results = new KeyValuePair <int, string>(1, string.Empty);
                    List <string> IdsList = string.IsNullOrEmpty(model.RequestIds) ? new List <string>() : new JavaScriptSerializer().Deserialize <List <string> >(model.RequestIds);

                    if (IdsList.Count.Equals(0))
                    {
                        throw new Exception(Resources.LetterEntry.Alert_NoRequest);
                    }
                    if (IdsList.Count > 5)
                    {
                        throw new Exception(Resources.LetterEntry.Alert_RequestMoreThanFive);
                    }
                    if (!model.LetterEntry.TemplateID.HasValue)
                    {
                        throw new Exception(Resources.LetterEntry.Alert_ChooseTemplate);
                    }

                    LetterTemplate lettertemplate = db.letterTemplate.Where(x => x.LetterTemplateId == model.LetterEntry.TemplateID).FirstOrDefault();
                    if (lettertemplate == null)
                    {
                        throw new Exception(Resources.LetterEntry.Alert_TemplateUndefined);
                    }

                    for (int i = 0; i <= IdsList.Count - 1; i++)
                    {
                        Guid    requestId = new Guid(IdsList.ElementAt(i));
                        Request request   = db.request.Where(x => x.RequestID == requestId).FirstOrDefault();

                        /*
                         * Jika kondisi nya multiple-request, maka branch yang diambil adalah branch dari Request.
                         * Sebaliknya, jika field CC diisi oleh user maka branch yang diambil adalah branch dari CC tersebut.
                         * Sebaliknya, jika field UserBranch pada Request tidak null, maka branch yang diambil adalah branch dari Request.
                         * Sebaliknya, branch sama dengan null.
                         */
                        Guid   branchID = (model.IsMultipleLetter) ? (request.BranchID.HasValue ? request.BranchID.Value : Guid.Empty) : (model.LetterEntry.CC_ID.HasValue ? model.LetterEntry.CC_ID.Value : (request.UserBranchID.HasValue ? request.UserBranchID.Value : Guid.Empty));
                        Branch branch   = branchID.Equals(Guid.Empty) ? null : db.branch.Where(x => x.BranchID == branchID).FirstOrDefault();

                        string address1 = null, address2 = null, address3 = null, city = null, postalcode = null;

                        if (request.Location != null)
                        {
                            StringMap stringmap = db.pickList
                                                  .Where(x => x.EntityName.Equals("CustomerAddress") && x.AttributeName.Equals("addresstypecode") && x.AttributeValue.Equals(request.Location.Value))
                                                  .FirstOrDefault();

                            if (stringmap != null & stringmap.label.ToUpper().Equals("OTHER"))
                            {
                                address1   = request.Address1;
                                address2   = request.Address2;
                                city       = request.City;
                                postalcode = request.PostalCode;
                            }
                            else if (request.CustomerID != null)
                            {
                                CCARE.Models.Customer customer = db.customer.Where(x => x.CustomerID == request.CustomerID.Value).FirstOrDefault();
                                if (customer != null)
                                {
                                    address1   = customer.Line1;
                                    address2   = customer.Line2;
                                    address3   = customer.Line3;
                                    city       = customer.City;
                                    postalcode = customer.PostalCode;
                                }
                            }
                        }
                        else if (request.NonCustomerID != null)
                        {
                            NonCustomer noncustomer = db.noncustomer.Where(x => x.NonCustomerID == request.NonCustomerID.Value).FirstOrDefault();
                            if (noncustomer != null)
                            {
                                address1   = noncustomer.Address1;
                                address2   = noncustomer.Address2;
                                address3   = noncustomer.Address3;
                                city       = noncustomer.City;
                                postalcode = noncustomer.Zipcode;
                            }
                        }

                        LetterEntry letterentry = new LetterEntry();
                        letterentry.AccountNo         = request.AccountNo;
                        letterentry.Address1          = address1;
                        letterentry.Address2          = address2;
                        letterentry.Address3          = address3;
                        letterentry.AttchATM          = model.LetterEntry.AttchATM;
                        letterentry.AttchATMSwitching = model.LetterEntry.AttchATMSwitching;
                        letterentry.AttchCirrus       = model.LetterEntry.AttchCirrus;
                        letterentry.AttchDebit        = model.LetterEntry.AttchDebit;
                        letterentry.AttchMaestro      = model.LetterEntry.AttchMaestro;
                        letterentry.AttchDuration     = model.LetterEntry.AttchDuration;
                        letterentry.BusinessUnitID    = businessunitid;
                        letterentry.CardNo            = request.CardNo;

                        if (branch != null)
                        {
                            if (branch.BranchID != null)
                            {
                                letterentry.CC_ID = branch.BranchID;
                            }
                            if (!string.IsNullOrEmpty(branch.Name))
                            {
                                letterentry.CC_Name = branch.Name;
                            }
                        }

                        letterentry.City          = city;
                        letterentry.Description1  = model.LetterEntry.Description1;
                        letterentry.Description2  = model.LetterEntry.Description2;
                        letterentry.Description3  = model.LetterEntry.Description3;
                        letterentry.Description4  = model.LetterEntry.Description4;
                        letterentry.FullName      = request.CustomerName;
                        letterentry.LetterDate    = model.LetterEntry.LetterDate == null ? DateTime.Now : model.LetterEntry.LetterDate.Value;
                        letterentry.LetterEntryID = Guid.NewGuid();

                        if (lettertemplate.Type.Equals((int)LetterType.SPC))
                        {
                            letterentry.LetterNo = Convert.ToString(Convert.ToDouble(model.LetterEntry.LetterNo) + i).PadLeft(4, '0');
                        }
                        else
                        {
                            string bcaNo = db.AutoNumber_GetNext("Letter Entry", DateTime.Now.Year);
                            if (bcaNo != "")
                            {
                                letterentry.LetterNo = string.Format("{0}/BHB/{1}/{2}", bcaNo.PadLeft(5, '0'), arrRomans.ElementAt(letterentry.LetterDate.Value.Month - 1), letterentry.LetterDate.Value.Year.ToString());
                            }
                            else
                            {
                                errorMessages.AppendLine("Unable to generate letter entry. Auto Number record does not exist. ");
                                continue;
                            }
                        }

                        letterentry.ModifiedBy    = systemuserid;
                        letterentry.RequestID     = request.RequestID.Value;
                        letterentry.TicketNumber  = request.TicketNumber;
                        letterentry.TemplateID    = lettertemplate.LetterTemplateId;
                        letterentry.ZIPPostalCode = postalcode;
                        results = db.LetterEntry_Insert(letterentry);

                        if (results.Key == 0 || results.Key == 16 || results.Key == 6)
                        {
                            MergeDocument aMergeDocument = new MergeDocument();
                            JSONResponse  mergeResult    = aMergeDocument.Merge(letterentry.LetterEntryID);

                            if (Convert.ToBoolean(mergeResult.Value))
                            {
                                successMessages.Append(letterentry.LetterEntryID.ToString());
                            }
                            else
                            {
                                errorMessages.AppendLine(string.Format(Resources.LetterEntry.Alert_GenerateLetterError, request.TicketNumber, mergeResult.Response));
                            }

                            continue;
                        }
                        else
                        {
                            errorMessages.AppendLine(results.Value.ToString());
                            continue;
                        }
                    }

                    string strAnyErrors  = errorMessages.ToString();
                    string strAnySuccess = successMessages.ToString();
                    successMessages.AppendLine(strAnyErrors);

                    if (string.IsNullOrEmpty(strAnyErrors))
                    {
                        UrlHelper u   = new UrlHelper(this.ControllerContext.RequestContext);
                        string    url = u.Action("Edit", "LetterEntry", new { id = successMessages.ToString().Trim() });

                        result.Value    = true;
                        result.Response = url;
                    }
                    else
                    {
                        throw new Exception(successMessages.ToString());
                    }
                }
                else
                {
                    foreach (var key in ModelState.Keys)
                    {
                        var error = ModelState[key].Errors.FirstOrDefault();
                        if (error != null)
                        {
                            throw new Exception(error.ErrorMessage);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                result.Value    = false;
                result.Response = e.Message;
            }

            return(Json(result));
        }
예제 #11
0
        /// <summary>
        /// Método usado para salvar o arquivo no disco e quando necessário fazer um merge no arquivo.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/> instance containing the event data.</param>
        protected void ImageButtonSalvar_Click(object sender, ImageClickEventArgs e)
        {
            if (FileUpload1.HasFile)
            {
                string id = "";
                string nameFile = "", abaAtiva;
                abaAtiva = retornaAbaAtiva();
                try
                {
                    id = obterMatricula();
                }
                catch (Exception ex)
                {
                    LabelErro.Text         = ex.Message;
                    ImageAttention.Visible = true;
                }

                //verificar se nao é uma titulaçao
                if (!abaAtiva.Equals("titulacoes"))
                {
                    nomeArquivo = montarFormatoGD(id, abaAtiva + ext);
                }
                else
                {
                    if (id.Length == 0)
                    {
                        ScriptManager.RegisterStartupScript(Page, GetType(), Guid.NewGuid().ToString(), "window.alert('Digite a matrícula!');", true);
                    }
                    else
                    {
                        nomeArquivo = adpt.montaFormatoTitulacao(FileUpload1.FileName.ToString(), id, DropDownListTipoProcesso.SelectedValue.ToString());
                    }
                }


                if (id.Length == 0)
                {
                    ScriptManager.RegisterStartupScript(Page, GetType(), Guid.NewGuid().ToString(), "window.alert('Digite a matrícula!');", true);
                }
                else
                {
                    if (Session["postou_" + abaAtiva].ToString().Equals((string)"sim") && !(abaAtiva.Equals("titulacoes")))
                    {
                        // Create a merge document and set it's properties
                        MergeDocument document = MergeDocument.Merge(pathDir + nomeArquivo, FileUpload1.PostedFile.FileName);
                        // Outputs the merged document
                        document.Draw(nomeArquivo);
                        System.IO.File.Delete(pathDir + nomeArquivo);
                        System.IO.File.Move(nomeArquivo, pathDir + nomeArquivo);
                    }
                    //se ainda nao postou o documento nao precisa fazer um merge. Ou é uma titulaçao que nao precisa de merge
                    else
                    {
                        try
                        {
                            FileUpload1.SaveAs(pathDir + nomeArquivo);
                            Session.Add("fileName", nomeArquivo);
                        }
                        catch (Exception ex)
                        {
                            LabelErro.Text         = ex.Message;
                            ImageAttention.Visible = true;
                        }
                    }
                    TableArquivo.Visible = true;
                    GridView1.Visible    = true;
                    LabelArquivo.Text    = nomeArquivo;
                    //ImageButtonVer.Visible = true;
                    ImageButtonDelete.Visible = true;
                    //levantar flag dizendo que o arquivo foi postado
                    Session.Add("postou_" + abaAtiva, "sim");

                    Arquivo arq = new Arquivo();
                    arq.nome_Arquivo = nomeArquivo;
                    arq.tipo_Arquivo = abaAtiva;

                    List <Arquivo> lista = new List <Arquivo>();
                    lista = (List <Arquivo>)Session["arquivos"];
                    if (lista == null)
                    {
                        lista = new List <Arquivo>();
                    }
                    lista.Add(arq);
                    Session["arquivos"] = lista;

                    carrega_Grid("arquivos");
                }
            }
            else
            {
                //Mostra o Erro quando não tem arquivo selecionado
                LabelErro.Text         = "Selecione o arquivo";
                ImageAttention.Visible = true;
            }
        }
        public static void MergePDF()
        {
            MergeDocument document = MergeDocument.Merge(Util.GetPath("Resources/PDFs/DocumentA.pdf"), Util.GetPath("Resources/PDFs/DocumentB.pdf"));

            document.Draw(Util.GetPath("Output/MergePDFs.pdf"));
        }