Ejemplo n.º 1
0
 /// <summary>
 /// Метод для записи конвертированого текста в PDF документ.
 /// </summary>
 /// <param name="p"></param>
 public void WriteToFile(string p)
 {
     if (File.Exists(p))
     {
         File.Delete(p);
     }
     pdfData.createPDF(p);
 }
Ejemplo n.º 2
0
        private byte[] returnPdfInBytes()
        {
            System.IO.MemoryStream stream = new MemoryStream();

            document.createPDF(stream);
            document = null;
            page     = null;

            return(stream.ToArray());
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            pdfDocument myDoc       = new pdfDocument("RemiseImpot", "ME");
            pdfPage     myFirstPage = myDoc.addPage();


            myDoc.createPDF(@"C:\Users\William\Documents\Remises_Impots.pdf");
            myFirstPage = null;
            myDoc       = null;
        }
Ejemplo n.º 4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            pdfDocument myDoc  = new pdfDocument("TUTORIAL", "ME");
            pdfPage     myPage = myDoc.addPage();

            myPage.addText("Hello,World!", 200, 450, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
            myDoc.addTrueTypeFont(@"verdana.ttf", "verdana");
            myPage.addText("Привет, мир!", 200, 250, myDoc.getFontReference("verdana"), 20);
            myDoc.createPDF(@"test.pdf");
            myPage = null;
            myDoc  = null;
        }
 public void CreatePDF(string pdfFileName)
 {
     try
     {
         myDoc.createPDF(pdfFileName);
     }
     catch
     {
         MessageBox.Show("Could not write results to PDF file." +
                         System.Environment.NewLine +
                         "Make sure file is not currently being viewed.", "PDF Error");
     }
 }
Ejemplo n.º 6
0
    private IEnumerator createPdf()
    {
        pdfDocument myDoc       = new pdfDocument("Palm Measure Application", "", false);
        pdfPage     myFirstPage = myDoc.addPage();

        //yield return StartCoroutine(myFirstPage.newAddImage(Application.persistentDataPath + "/" + "screenshot.png", 0, 800));
        myFirstPage.addText("Name: " + NameInputField.text, 0, 700, sharpPDF.Enumerators.predefinedFont.csCourier, 36);
        myFirstPage.addText("Id: " + IdInputField.text, 0, 650, sharpPDF.Enumerators.predefinedFont.csCourier, 36);
        myFirstPage.addText("Scale: " + PreviewZoomIndication.text, 0, 600, sharpPDF.Enumerators.predefinedFont.csCourier, 36);
        myFirstPage.addText("Comments: " + CommentsInputField.text, 0, 550, sharpPDF.Enumerators.predefinedFont.csCourier, 36);
        myDoc.createPDF(Application.persistentDataPath + "/Data.pdf");
        yield return(null);
    }
Ejemplo n.º 7
0
        /// <summary>
        /// Exports the chart to the specified output stream as binary. When
        /// exporting to a web response the WriteToHttpResponse() method is likely
        /// preferred.
        /// </summary>
        /// <param name="outputStream">An output stream.</param>
        internal void WriteToStream(Stream outputStream)
        {
            switch (this.ContentType)
            {
            case "image/jpeg":
                CreateSvgDocument().Draw().Save(
                    outputStream,
                    ImageFormat.Jpeg);
                break;

            case "image/png":
                // PNG output requires a seekable stream.
                using (MemoryStream seekableStream = new MemoryStream())
                {
                    CreateSvgDocument().Draw().Save(
                        seekableStream,
                        ImageFormat.Png);
                    seekableStream.WriteTo(outputStream);
                }
                break;

            case "application/pdf":
                SvgDocument svgDoc = CreateSvgDocument();
                Bitmap      bmp    = svgDoc.Draw();

                pdfDocument doc  = new pdfDocument(this.Name, null);
                pdfPage     page = doc.addPage(bmp.Height, bmp.Width);
                page.addImage(bmp, 0, 0);
                doc.createPDF(outputStream);
                break;

            case "image/svg+xml":
                using (StreamWriter writer = new StreamWriter(outputStream))
                {
                    writer.Write(this.Svg);
                    writer.Flush();
                }

                break;

            default:
                throw new InvalidOperationException(string.Format(
                                                        "ContentType '{0}' is invalid.", this.ContentType));
            }

            outputStream.Flush();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// imprimir O.S
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnImprimirOS_Click(object sender, EventArgs e)
        {
            if (ViewState["cmpIdOS"].ToString() == "0")
            {
                this.GravarOS();
            }

            ImprimirOs  Imprimir = new ImprimirOs();
            pdfDocument myDoc    = new pdfDocument("Horizon", "Orion");

            Imprimir.myDoc             = myDoc;
            Imprimir.myPage            = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
            Imprimir.cmpCoObra         = loadObra();
            Imprimir.cmpIdOS           = ViewState["cmpIdOS"].ToString();
            Imprimir.NomeObra          = "Serviços de TI";
            Imprimir.EnderecoLogoOrion = Server.MapPath("~/Imagens/logo_Orion.jpg");

            if (ViewState["cmpInLogoObra"].ToString() == "1")
            {
                Imprimir.EnderecoLogoObra = Server.MapPath("~/Imagens/logo_IPEN.bmp");
            }
            else
            {
                Imprimir.EnderecoLogoObra = "";
            }

            Imprimir.ImprimeOrdemServico();

            string filename = "pdf" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf";
            string nomepdf  = Server.MapPath("~/Relatorios/" + filename);

            myDoc.createPDF(nomepdf);

            Response.Write("<script>window.open('" + Global.UrlRelatorio + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105');</script>");

            // Impressão ambiente desenvolvimento local
            //Response.Write("<script language='javascript'>"
            //                + "window.open('" + @"http://*****:*****@"http://172.10.10.2/HzWebManutencao_Desenv/Relatorios/" + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105')"
            //                  + "</script>");
        }
Ejemplo n.º 9
0
        private void ImprimirFechamentoMes()
        {
            DataTable table = pesquisaOs();

            if (table != null && table.Rows.Count > 0)
            {
                //filename = "FechaMes" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf";
                string nomepdf = Server.MapPath("~/Relatorios/" + filename);

                pdfDocument myDoc = HzWebManutencao.ImprimirFechamentoMes.ImprimeFechamento(table, txtDataInicial.Text.ToString(), txtDataFinal.Text.ToString());
                myDoc.createPDF(nomepdf);

                Response.Write("<script>window.open('" + Global.UrlRelatorio + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105');</script>");

                // Impressão ambiente produção ambiente interno orion
                //Response.Write("<script language='javascript'>"
                //                  + "window.open('" + @"http://172.10.10.2/HzWebManutencao_Desenv/Relatorios/" + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105')"
                //                  + "</script>");
            }
        }
Ejemplo n.º 10
0
        private void ImprimirTodasOS()
        {
            DataTable table = pesquisaOs();

            if (table != null && table.Rows.Count > 0)
            {
                ImprimirOs  Imprimir = new ImprimirOs();
                pdfDocument myDoc    = new pdfDocument("Horizon", "Orion");
                Imprimir.myDoc             = myDoc;
                Imprimir.cmpCoObra         = ((HzLibGeneral.Util.HzLogin)Session["login"]).cmpCoObraGrupoLista;
                Imprimir.NomeObra          = cmbObra.SelectedItem.ToString();
                Imprimir.EnderecoLogoOrion = Server.MapPath("~/Imagens/logo_Orion.jpg");

                if (ViewState["cmpInLogoObra"].ToString() == "True")
                {
                    Imprimir.EnderecoLogoObra = Server.MapPath("~/Imagens/logo_IPEN.bmp");
                }
                else
                {
                    Imprimir.EnderecoLogoObra = "";
                }

                foreach (DataRow lin in table.Rows)
                {
                    Imprimir.cmpIdOS = lin["cmpIdOs"].ToString();
                    Imprimir.myPage  = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
                    Imprimir.ImprimeOrdemServico();
                }

                //filename = "pdf" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf";
                string nomepdf = Server.MapPath("~/Relatorios/" + filename);
                myDoc.createPDF(nomepdf);

                Response.Write("<script>window.open('" + Global.UrlRelatorio + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105');</script>");

                // Impressão ambiente produção ambiente interno orion
                //Response.Write("<script language='javascript'>"
                //                  + "window.open('" + @"http://172.10.10.2/HzWebManutencao_Desenv/Relatorios/" + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105')"
                //                  + "</script>");
            }
        }
Ejemplo n.º 11
0
    /// <summary>
    /// creates a pdf using:
    ///     #the given results
    ///     #name of active scene
    ///     #images from Screenshot folder
    /// </summary>
    /// <param name="results"> the results to be displayed in the pdf </param>
    public void createPdf(List <Results> results)
    {
        //get name of scene and current date
        sceneName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
        date      = System.DateTime.Now.ToString("dd-MM-yyyy_hh.mm");
        docname   = sceneName + "-" + date;

        //create document
        pdfDocument pdfDocument = new pdfDocument(docname, "TI-2020");

        //make the first page
        Titlepage(pdfDocument);

        //add the results from the results, 1 page per result
        addResults(results, pdfDocument);

        //add foto's to the document, 1 foto per page
        //get the image files
        DirectoryInfo d = new DirectoryInfo(ScreenshotPath);

        FileInfo[] files = d.GetFiles();

        //sort image files by date
        System.Array.Sort(files, (f1, f2) => f1.CreationTime.CompareTo(f2.CreationTime));

        foreach (var file in files)
        {
            //create new page and add image
            InsertImage(ScreenshotPath + "/" + file.Name, pdfDocument);
        }
        //save the pdf in folder
        if (!Directory.Exists("pdf"))
        {
            Directory.CreateDirectory("pdf");
        }
        pdfDocument.createPDF(@"pdf/" + docname + ".pdf");
    }
Ejemplo n.º 12
0
    // Update is called once per frame
    public IEnumerator CreatePDF()
    {
        pdfDocument myDoc       = new pdfDocument("Sample Application", "Me", false);
        pdfPage     myFirstPage = myDoc.addPage();



//		Debug.Log ( "Continue to create PDF");
        myFirstPage.addText("Daily Report", 10, 730, predefinedFont.csHelveticaOblique, 30, new pdfColor(predefinedColor.csOrange));



        /*Table's creation*/
        pdfTable myTable = new pdfTable();

        //Set table's border
        myTable.borderSize  = 1;
        myTable.borderColor = new pdfColor(predefinedColor.csDarkBlue);

        /*Add Columns to a grid*/
        myTable.tableHeader.addColumn(new pdfTableColumn("Building1", predefinedAlignment.csRight, 120));
        myTable.tableHeader.addColumn(new pdfTableColumn("Building2", predefinedAlignment.csCenter, 120));
        myTable.tableHeader.addColumn(new pdfTableColumn("Building3", predefinedAlignment.csLeft, 150));
        myTable.tableHeader.addColumn(new pdfTableColumn("Building4", predefinedAlignment.csLeft, 150));


        pdfTableRow myRow = myTable.createRow();

        myRow[0].columnValue = "A";
        myRow[1].columnValue = "100 km/h";
        myRow[2].columnValue = "180Kg";
        myRow[3].columnValue = "Orange";

        myTable.addRow(myRow);

        pdfTableRow myRow1 = myTable.createRow();

        myRow1[0].columnValue = "B";
        myRow1[1].columnValue = "130 km/h";
        myRow1[2].columnValue = "150Kg";
        myRow1[3].columnValue = "Yellow";

        myTable.addRow(myRow1);



        /*Set Header's Style*/
        myTable.tableHeaderStyle = new pdfTableRowStyle(predefinedFont.csCourierBoldOblique, 12, new pdfColor(predefinedColor.csBlack), new pdfColor(predefinedColor.csLightOrange));
        /*Set Row's Style*/
        myTable.rowStyle = new pdfTableRowStyle(predefinedFont.csCourier, 8, new pdfColor(predefinedColor.csBlack), new pdfColor(predefinedColor.csWhite));
        /*Set Alternate Row's Style*/
        myTable.alternateRowStyle = new pdfTableRowStyle(predefinedFont.csCourier, 8, new pdfColor(predefinedColor.csBlack), new pdfColor(predefinedColor.csLightYellow));
        /*Set Cellpadding*/
        myTable.cellpadding = 10;
        /*Put the table on the page object*/
        myFirstPage.addTable(myTable, 5, 700);



        yield return(StartCoroutine(myFirstPage.newAddImage(Application.dataPath + "/picture2.jpg", 2, 100)));

        myDoc.createPDF(attacName);
        myTable = null;
        Application.OpenURL(attacName);
    }
Ejemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HzConexao c = new HzConexao(@"192.168.200.170\desenv", "sa", "rona3007", "HzManutencao", "System.Data.SqlClient");

            String strFont      = "Helvetica";
            int    leftMargin   = 30;
            int    topMargin    = 30;
            int    bottomMargin = 30;
            int    lineHeight   = 20;
            int    linesPerPage;

            pdfDocument myDoc = new pdfDocument("Horizon", "Orion");
            // Add a page
            pdfPage myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);

            // Load an image (I was able to load JPEG, GIF, TIFF, and BMP formats)
            //myDoc.addImageReference(Server.MapPath("~/Assets/Images/Sample.gif"), "ex");
            //myPage.addImage(myDoc.getImageReference("ex"), leftMargin, getTop(myPage, 120));

            // Header Text
            myPage.addText("Ordem de Serviço", leftMargin, getTop(myPage, 30),
                           myDoc.getFontReference(strFont), 15, pdfColor.Black);

            // Body Text
            //myPage.addText("Divisão de Administração Predial, Obras e Instalações", leftMargin, getTop(myPage, 50),
            //               myDoc.getFontReference(strFont), 10, pdfColor.Black);
            //myPage.addText("Relatório emitido em: " + DateTime.Now.ToShortDateString(), leftMargin, getTop(myPage, 70),
            //               myDoc.getFontReference(strFont), 10, pdfColor.Black);

            //pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
            //                                new pdfTableStyle(myDoc.getFontReference(strFont),
            //                                10, pdfColor.Black, new pdfColor("d9d1b3")),
            //                                new pdfTableStyle(myDoc.getFontReference(strFont),
            //                                10, pdfColor.Black, pdfColor.White),
            //                                new pdfTableStyle(myDoc.getFontReference(strFont),
            //                                10, pdfColor.Black, pdfColor.White));

            int q   = 0;
            int pg  = 1;
            int top = 40;

            using (DataTable table = c.loadDataTable("select * from HzManutencao..vwATE_OS where cmpIdOS = 1"))
            {
                if (table != null && table.Rows.Count > 0)
                {
                    DataRow r = table.Rows[0];

                    pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                                    new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));

                    myTable.coordX = leftMargin;
                    myTable.coordY = getTop(myPage, top);

                    //// Create table's header
                    int cl = 0;
                    myTable.tableHeader.rowHeight = 10;
                    myTable.tableHeader.addColumn(150, predefinedAlignment.csLeft);
                    myTable.tableHeader[cl++].addText("Nº O.S.");

                    myTable.tableHeader.addColumn(420, predefinedAlignment.csLeft);
                    myTable.tableHeader[cl].columnAlign = predefinedAlignment.csLeft;
                    myTable.tableHeader[cl++].addText(r["cmpNuOS"].ToString());

                    // Create Table Row
                    pdfTableRow myRow = myTable.createRow();
                    cl    = 0;
                    myRow = myTable.createRow();
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Data Solicitação:");
                    myRow[cl++].addText(r["cmpDtAbertura"].ToString().Trim());
                    myTable.addRow(myRow);

                    cl    = 0;
                    myRow = myTable.createRow();
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Obra:");
                    myRow[cl++].addText(r["cmpNoObra"].ToString().Trim() + (r["cmpNuContrato"] != null ? " -> Contrato nº " + r["cmpNuContrato"].ToString() : ""));
                    myTable.addRow(myRow);

                    cl    = 0;
                    myRow = myTable.createRow();
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Soliciante:");
                    myRow[cl++].addText(r["cmpNoSolicitante"].ToString().Trim());
                    myTable.addRow(myRow);

                    cl    = 0;
                    myRow = myTable.createRow();
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Local:");
                    myRow[cl++].addText(r["cmpDcLocal"].ToString().Trim());
                    myTable.addRow(myRow);

                    cl    = 0;
                    myRow = myTable.createRow();
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Setor:");
                    myRow[cl++].addText(r["cmpNoSetor"].ToString().Trim());
                    myTable.addRow(myRow);

                    cl    = 0;
                    myRow = myTable.createRow();
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Data Início:");
                    myRow[cl++].addText(r["cmpDtInicioAtendimento"].ToString() != "" ? DateTime.Parse(r["cmpDtInicioAtendimento"].ToString()).ToString("dd/MM/yyyy HH:mm") : "");
                    myTable.addRow(myRow);

                    cl    = 0;
                    myRow = myTable.createRow();
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Data Conclusão:");
                    myRow[cl++].addText(r["cmpDtConclusaoAtendimento"].ToString() != "" ? DateTime.Parse(r["cmpDtConclusaoAtendimento"].ToString()).ToString("dd/MM/yyyy HH:mm") : "");
                    myTable.addRow(myRow);

                    cl    = 0;
                    myRow = myTable.createRow();
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Descrição do Serviço:");
                    myRow[cl++].addText(r["cmpDcDescricaoSolicitacao"].ToString().Trim());
                    myTable.addRow(myRow);

                    cl                    = 0;
                    myRow                 = myTable.createRow();
                    myRow.rowHeight       = 50;
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Verificação do Serviço:");
                    myRow[cl++].addText(r["cmpDcObservacaoConclusao"].ToString().Trim());
                    myTable.addRow(myRow);
                    top += 10 * 9;

                    myPage.addTable(myTable);

                    top += 100;
                    myPage.addText("Material Utilizado", leftMargin, this.getTop(myPage, top), myDoc.getFontReference(strFont), 10, pdfColor.Black);
                    top += 12;

                    string sql = "select * from HzManutencao..vwATE_OSMaterial where cmpIdOS = " + r["cmpIdOS"].ToString();
                    using (DataTable tblMat = Global.GetConnection().loadDataTable(sql))
                    {
                        if (tblMat != null && tblMat.Rows.Count > 0)
                        {
                            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, new pdfColor("FFFFFF")),
                                                   new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, pdfColor.White));

                            myTable.coordX = leftMargin;
                            //top = 210;
                            myTable.coordY = getTop(myPage, top);

                            //// Create table's header
                            cl = 0;
                            myTable.tableHeader.rowHeight = 10;
                            myTable.tableHeader.addColumn(350, predefinedAlignment.csLeft);
                            myTable.tableHeader[cl++].addText("Descrição");

                            myTable.tableHeader.addColumn(30, predefinedAlignment.csCenter);
                            myTable.tableHeader[cl].columnAlign = predefinedAlignment.csCenter;
                            myTable.tableHeader[cl++].addText("Unid");

                            myTable.tableHeader.addColumn(50, predefinedAlignment.csRight);
                            myTable.tableHeader[cl].columnAlign = predefinedAlignment.csRight;
                            myTable.tableHeader[cl++].addText("Qtd.");

                            myTable.tableHeader.addColumn(50, predefinedAlignment.csRight);
                            myTable.tableHeader[cl].columnAlign = predefinedAlignment.csRight;
                            myTable.tableHeader[cl++].addText("Preço");

                            myTable.tableHeader.addColumn(90, predefinedAlignment.csRight);
                            myTable.tableHeader[cl].columnAlign = predefinedAlignment.csRight;
                            myTable.tableHeader[cl++].addText("Sub-Total");
                            top += 15;

                            float total = 0f;
                            foreach (DataRow row in tblMat.Rows)
                            {
                                // Create Table Row
                                myRow = myTable.createRow();
                                cl    = 0;
                                myRow = myTable.createRow();
                                myRow[cl].columnAlign = predefinedAlignment.csLeft;
                                myRow[cl++].addText(row["DcMaterial"].ToString().Trim());
                                myRow[cl++].addText(row["cmpDcUnidade"].ToString().Trim());
                                myRow[cl++].addText(decimal.Parse(row["cmpQtMaterial"].ToString()).ToString("0,0.00"));
                                myRow[cl++].addText(decimal.Parse(row["cmpVlMaterial"].ToString()).ToString("0,0.00"));
                                myRow[cl++].addText(decimal.Parse(row["cmpVlSubTotal"].ToString()).ToString("0,0.00"));
                                total += float.Parse(row["cmpVlSubTotal"].ToString());
                                myTable.addRow(myRow);
                                top += 12;
                            }
                            myPage.addTable(myTable);
                            top += 3;

                            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));

                            myTable.coordX = leftMargin;
                            myTable.coordY = getTop(myPage, top);

                            //// Create table's header
                            cl = 0;
                            myTable.tableHeader.rowHeight = 10;
                            myTable.tableHeader.addColumn(570, predefinedAlignment.csRight);
                            //IFormatProvider fp = new CultureInfo("pt-BR", true);
                            myTable.tableHeader[cl++].addText("Total: " + total.ToString("0,0.00"));
                            top += 17;
                            myPage.addTable(myTable);
                        }
                    }


                    myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                           new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));

                    myTable.coordX = leftMargin;
                    myTable.coordY = getTop(myPage, top);

                    //// Create table's header
                    cl = 0;
                    myTable.tableHeader.rowHeight        = 30;
                    myTable.tableHeader.rowVerticalAlign = predefinedVerticalAlignment.csTop;
                    myTable.tableHeader.addColumn(570, predefinedAlignment.csLeft);
                    myTable.tableHeader[cl].columnVerticalAlign = predefinedVerticalAlignment.csTop;
                    myTable.tableHeader[cl++].addText("Conclusão/Aceite do Solicitante");
                    top += 30;

                    cl                    = 0;
                    myRow                 = myTable.createRow();
                    myRow.rowHeight       = 10;
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Data: " + DateTime.Now.ToShortDateString() + " às " + DateTime.Now.ToShortTimeString());
                    myTable.addRow(myRow);
                    top += 15;

                    cl                    = 0;
                    myRow                 = myTable.createRow();
                    myRow.rowHeight       = 10;
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Satisfeito com o serviço: " + "__Sim         __Não");
                    myTable.addRow(myRow);
                    top += 15;

                    myPage.addTable(myTable);

                    myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                           new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));

                    myTable.coordX = leftMargin;
                    myTable.coordY = getTop(myPage, top);

                    cl = 0;
                    myTable.tableHeader.rowHeight        = 50;
                    myTable.tableHeader.rowVerticalAlign = predefinedVerticalAlignment.csBottom;
                    myTable.tableHeader.addColumn(285, predefinedAlignment.csCenter);
                    myTable.tableHeader[cl].columnVerticalAlign = predefinedVerticalAlignment.csBottom;
                    myTable.tableHeader[cl++].addText("De acordo Empresa");

                    myTable.tableHeader.addColumn(285, predefinedAlignment.csCenter);
                    myTable.tableHeader[cl].columnVerticalAlign = predefinedVerticalAlignment.csBottom;
                    myTable.tableHeader[cl].addText("De acordo Gestor");

                    myPage.addTable(myTable);

                    myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 5, pdfColor.Black);
                    //string nomepdf = "c:\\Horizon\\Ocr\\Relatorios\\" + "Relatorio_" + (txtPlacaRelatorio.Text != "" ? txtPlacaRelatorio.Text : "Todas") + "_" + retornaDataRelatorio(txtDataInicial.Text) + "_" + retornaDataRelatorio(txtDataFinal.Text) + ".pdf";
                    string nomepdf = Server.MapPath("pdf" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf");
                    myDoc.createPDF(nomepdf);
                    System.Diagnostics.Process.Start(nomepdf);
                }
            }
            ++q;

            //if (q == 30)
            //{
            //    myPage.addText("Pág. " + pg++, leftMargin, 10,
            //                    myDoc.getFontReference(strFont), 5, pdfColor.Black);
            //    myPage.addTable(myTable);
            //    myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
            //    q = 0;
            //    myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 5,
            //                                    new pdfTableStyle(myDoc.getFontReference(strFont),
            //                                    10, pdfColor.Black, new pdfColor("d9d1b3")),
            //                                    new pdfTableStyle(myDoc.getFontReference(strFont),
            //                                    10, pdfColor.Black, pdfColor.White),
            //                                    new pdfTableStyle(myDoc.getFontReference(strFont),
            //                                    10, pdfColor.Black, pdfColor.White));
            //    myTable.coordX = leftMargin;
            //    myTable.coordY = getTop(myPage, 100);

            //    // Create table's header
            //    myTable.tableHeader.rowHeight = 10;
            //    c = 0;
            //    myTable.tableHeader.addColumn(100, predefinedAlignment.csCenter);
            //    myTable.tableHeader[c++].addText("Placa");
            //    if (rdbAcesso.IsChecked.Value)
            //    {
            //        myTable.tableHeader.addColumn(200, predefinedAlignment.csLeft);
            //        myTable.tableHeader[c++].addText("Nome");
            //    }
            //    myTable.tableHeader.addColumn(150, predefinedAlignment.csCenter);
            //    myTable.tableHeader[c++].addText("Data");
            //    if (rdbAcesso.IsChecked.Value)
            //    {
            //        myTable.tableHeader.addColumn(100, predefinedAlignment.csCenter);
            //        myTable.tableHeader[c].addText("Cancela");
            //    }

            //    myPage.addText("Procuradoria Geral da República", leftMargin, getTop(myPage, 30),
            //                    myDoc.getFontReference(strFont), 20, pdfColor.Black);

            //    // Body Text
            //    myPage.addText("Relatório dos Acessos à Garagem", leftMargin, getTop(myPage, 50),
            //                   myDoc.getFontReference(strFont), 10, pdfColor.Black);
            //    myPage.addText("Relatório emitido em: " + DateTime.Now.ToShortDateString(), leftMargin, getTop(myPage, 70),
            //                   myDoc.getFontReference(strFont), 10, pdfColor.Black);
            //}
        }
Ejemplo n.º 14
0
    // Update is called once per frame
    public IEnumerator CreatePDF()
    {
        pdfDocument myDoc        = new pdfDocument("Sample Application", "Me", false);
        pdfPage     myFirstPage  = myDoc.addPage();
        pdfPage     mySecondPage = myDoc.addPage();


        Debug.Log("Continue to create PDF");
        myFirstPage.addText("ADMIN Summary Sheet", 10, 730, predefinedFont.csHelveticaOblique, 30, new pdfColor(predefinedColor.csOrange));



        /*Table's creation*/
        pdfTable myTable = new pdfTable();

        //Set table's border
        myTable.borderSize  = 1;
        myTable.borderColor = new pdfColor(predefinedColor.csDarkBlue);

        /*Add Columns to a grid*/
        myTable.tableHeader.addColumn(new pdfTableColumn("faculty name", predefinedAlignment.csLeft, 90));
        myTable.tableHeader.addColumn(new pdfTableColumn("year", predefinedAlignment.csLeft, 90));
        myTable.tableHeader.addColumn(new pdfTableColumn("subject", predefinedAlignment.csLeft, 90));
        myTable.tableHeader.addColumn(new pdfTableColumn("section", predefinedAlignment.csLeft, 90));
        myTable.tableHeader.addColumn(new pdfTableColumn("category name", predefinedAlignment.csLeft, 90));
        myTable.tableHeader.addColumn(new pdfTableColumn("filename", predefinedAlignment.csLeft, 90));
        myTable.tableHeader.addColumn(new pdfTableColumn("extension", predefinedAlignment.csLeft, 50));



        pdfTableRow myRow = myTable.createRow();

        myRow[0].columnValue = "preeti";
        myRow[1].columnValue = "2017-18";
        myRow[2].columnValue = "4-Linux System Programming";
        myRow[3].columnValue = "A";
        myRow[4].columnValue = "Ethics";
        myRow[5].columnValue = "facnames(1).pdf";
        myRow[6].columnValue = "pdf";


        myTable.addRow(myRow);

        //pdfTableRow myRow1 = myTable.createRow();
        //myRow1[0].columnValue = "B";
        //myRow1[1].columnValue = "130 km/h";
        //myRow1[2].columnValue = "150Kg";
        //myRow1[3].columnValue = "Yellow";

        //myTable.addRow(myRow1);



        /*Set Header's Style*/
        myTable.tableHeaderStyle = new pdfTableRowStyle(predefinedFont.csCourierBoldOblique, 12, new pdfColor(predefinedColor.csBlack), new pdfColor(predefinedColor.csLightOrange));
        /*Set Row's Style*/
        myTable.rowStyle = new pdfTableRowStyle(predefinedFont.csCourier, 8, new pdfColor(predefinedColor.csBlack), new pdfColor(predefinedColor.csWhite));
        /*Set Alternate Row's Style*/
        myTable.alternateRowStyle = new pdfTableRowStyle(predefinedFont.csCourier, 8, new pdfColor(predefinedColor.csBlack), new pdfColor(predefinedColor.csLightYellow));
        /*Set Cellpadding*/
        myTable.cellpadding = 10;
        /*Put the table on the page object*/
        myFirstPage.addTable(myTable, 5, 700);

        //yield return StartCoroutine(myFirstPage.newAddImage("D:/TEMPORARY/UnitySharpPDF/picture2.jpg", 2, 100));
        //yield return StartCoroutine(mySecondPage.newAddImage("D:/TEMPORARY/UnitySharpPDF/picture1.jpg", 2, 100));
        yield return(myFirstPage);

        yield return(mySecondPage);

        myDoc.createPDF(attacName);
        Debug.Log(" pdf created ");
        myTable = null;

        //yield return null;
    }
        private void btnGeneratePDF_Click(object sender, EventArgs e)
        {
            // Si un employé est sélectionné
            if (this.dataEmployes.SelectedRows.Count > 0)
            {
                FolderBrowserDialog folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
                DialogResult        result = folderBrowserDialog.ShowDialog();

                if (result == DialogResult.OK)
                {
                    IGestionEmployes
                        gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

                    string                  folderName       = folderBrowserDialog.SelectedPath;
                    int                     selectedRowIndex = this.dataEmployes.SelectedRows[0].Index;
                    int                     IdUtilisateur    = Convert.ToInt32(this.dataEmployes.Rows[selectedRowIndex].Cells["IdUtilisateur"].Value);
                    object[]                tabInfoUser      = gestionEmployes.findUtilisateur(IdUtilisateur);
                    Utilisateur             utilisateur      = (Utilisateur)tabInfoUser[0];
                    Adresse                 adresse          = (Adresse)tabInfoUser[1];
                    Societe                 societe          = (Societe)tabInfoUser[2];
                    Role                    role             = (Role)tabInfoUser[3];
                    Ville                   ville            = (Ville)tabInfoUser[4];
                    FormModificationEmploye form             = new FormModificationEmploye();

                    // Génération du fichier PDF
                    try
                    {
                        pdfDocument myDoc       = new pdfDocument("Sample Application", "Me", false);
                        pdfPage     myFirstPage = myDoc.addPage(700, 700);
                        myFirstPage.addText("Fiche d'information - " + utilisateur.Prenom.Trim() + " " + utilisateur.Nom.Trim(),
                                            100, 630, predefinedFont.csHelvetica, 30, new pdfColor(predefinedColor.csBlack));
                        /*Table's creation*/
                        pdfTable myTable = new pdfTable();
                        //Set table's border
                        myTable.borderSize  = 0;
                        myTable.borderColor = new pdfColor(predefinedColor.csBlack);
                        /*Create table's header*/
                        myTable.tableHeader.addColumn(new pdfTableColumn("Information", predefinedAlignment.csLeft, 150));
                        myTable.tableHeader.addColumn(new pdfTableColumn("Valeur", predefinedAlignment.csCenter, 250));

                        /*Create table's rows*/
                        pdfTableRow myRow = myTable.createRow();
                        myRow[0].columnValue = "Prénom";
                        myRow[1].columnValue = utilisateur.Prenom.Trim();
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Nom";
                        myRow[1].columnValue = utilisateur.Nom.Trim();
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Identifiant";
                        myRow[1].columnValue = utilisateur.Identifiant;
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Mot de passe";
                        myRow[1].columnValue = utilisateur.MotPasse;
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Rôle";
                        myRow[1].columnValue = role.CodeRole;
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Date de début";
                        myRow[1].columnValue = utilisateur.DateDebut.ToShortDateString();
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Date de fin";
                        myRow[1].columnValue = utilisateur.DateFin.ToShortDateString();
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Adresse";
                        myRow[1].columnValue = adresse.NumeroRue + " " + adresse.NomRue + ", " + adresse.CodePostal + " " +
                                               ville.CodeVille;
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Nom de société";
                        myRow[1].columnValue = societe.NomSociete;
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Description de société";
                        myRow[1].columnValue = societe.DescriptionSociete;
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Numéro de siret";
                        myRow[1].columnValue = societe.NumeroSiret;
                        myTable.addRow(myRow);

                        /*Set Header's Style*/
                        myTable.tableHeaderStyle = new pdfTableRowStyle(predefinedFont.csHelveticaBold, 12,
                                                                        new pdfColor(predefinedColor.csWhite), new pdfColor(predefinedColor.csRed));
                        /*Set Row's Style*/
                        myTable.rowStyle = new pdfTableRowStyle(predefinedFont.csHelvetica, 10, new pdfColor(predefinedColor.csBlack),
                                                                new pdfColor(predefinedColor.csWhite));
                        /*Set Alternate Row's Style*/
                        myTable.alternateRowStyle = new pdfTableRowStyle(predefinedFont.csHelvetica, 10,
                                                                         new pdfColor(predefinedColor.csBlack), new pdfColor(predefinedColor.csLightGray));
                        /*Set Cellpadding*/
                        myTable.cellpadding = 10;
                        /*Put the table on the page object*/
                        myFirstPage.addTable(myTable, 150, 550);
                        myTable = null;
                        myDoc.createPDF(folderName + "\\FicheInformation.pdf");
                        MessageBox.Show("Le fichier PDF a bien été créé", "Génération de PDF");
                        Process.Start(folderName + "\\FicheInformation.pdf");
                        // Fin de génération du fichier PDF
                    }
                    // Quand il y a une erreur
                    catch (Exception exception)
                    {
                        MessageBox.Show("L'erreur suivante s'est produite : " + exception.Message + "", "Erreur lors de l'éxécution");
                    }
                }
            }
            // Si aucun employé n'est sélectionné
            else
            {
                MessageBox.Show("Sélectionnez un utilisateur.", "Génération fichier PDF");
            }
        }
Ejemplo n.º 16
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            string date1 = Date1.Text;
            string date2 = Date2.Text;

            string[] dateSeparator = { "/" };
            string[] wordDate1     = date1.Split(dateSeparator, StringSplitOptions.RemoveEmptyEntries);
            string[] wordDate2     = date2.Split(dateSeparator, StringSplitOptions.RemoveEmptyEntries);

            string        text   = "";
            XmlTextReader reader = new XmlTextReader("calendar.xml");

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:     // Узел является элементом.
                    text = text + "<" + reader.Name + ">";
                    break;

                case XmlNodeType.Text:     // Вывести текст в каждом элементе.
                    text = text + reader.Value;
                    break;

                case XmlNodeType.EndElement:     // Вывести конец элемента.
                    text = text + "</" + reader.Name + ">";
                    break;
                }
            }

            string[] separator = { "<", ">", " " };
            string[] word      = text.Split(separator, StringSplitOptions.RemoveEmptyEntries);// Разделение текста на слова



            int         i       = 0;
            pdfDocument myDoc   = new pdfDocument("TUTORIAL", "ME");
            string      newText = "";

            while (i < word.Length)
            {
                int j = i + 1;

                if (word[i] == "First")
                {
                    while (word[j] != "/First")
                    {
                        newText = newText + word[j] + " ";
                        j       = j + 1;
                    }
                    newText = newText + ";   ";
                }

                if (word[i] == "Check")
                {
                    while (word[j] != "/Check")
                    {
                        newText = newText + word[j] + " ";
                        j       = j + 1;
                    }
                    newText = newText + ";   ";
                }

                if (word[i] == "Date")
                {
                    string[] currentDate = word[i + 1].Split(dateSeparator, StringSplitOptions.RemoveEmptyEntries);
                    if (Convert.ToInt32(currentDate[2]) >= Convert.ToInt32(wordDate1[2]) && Convert.ToInt32(currentDate[2]) <= Convert.ToInt32(wordDate2[2]))
                    {
                        if (Convert.ToInt32(currentDate[0]) >= Convert.ToInt32(wordDate1[0]) && Convert.ToInt32(currentDate[0]) <= Convert.ToInt32(wordDate2[0]))
                        {
                            if (Convert.ToInt32(currentDate[1]) >= Convert.ToInt32(wordDate1[1]) && Convert.ToInt32(currentDate[1]) <= Convert.ToInt32(wordDate2[1]))
                            {
                                while (word[j] != "/Date")
                                {
                                    newText = newText + word[j] + " ";
                                    j       = j + 1;
                                }
                                newText = newText + ".";
                                pdfPage myPage = myDoc.addPage();
                                myPage.addText(newText, 20, 700, myDoc.getFontReference(predefinedFont.csCourier), 14);
                                myDoc.createPDF(@"Dairy.pdf");
                                myPage  = null;
                                newText = "";
                            }
                            else
                            {
                                newText = "";
                            }
                        }
                        else
                        {
                            newText = "";
                        }
                    }
                    else
                    {
                        newText = "";
                    }
                }
                i++;
            }
            myDoc = null;
        }
        private void Main(object link)
        {
            try
            {
                _novel = KitaabGhar.GetNovelInformation(link.ToString());
                LogMessage("Information collected.");
                LogMessage(string.Format("Total pages: {0} ({1} - {2})", _novel.TotalPages,
                                         _novel.FirstIndex, _novel.LastIndex));
            }
            catch (Exception ex)
            {
                LogMessage("Error: " + ex.Message);
                _running = false;
                return;
            }

            var directory = System.Web.Hosting.HostingEnvironment.MapPath(Path.Combine(DownloadLocation, _novel.Name));

            if (directory == null)
            {
                LogMessage("Unable to get permission");
                return;
            }
            var imageFormat = Path.Combine(directory, "{0}.gif");

            Directory.CreateDirectory(directory);
            for (var i = _novel.FirstIndex; i <= _novel.LastIndex; i++)
            {
                LogMessage("Downloading page: " + i);

                var r = 0;
Retry:
                if (!_running)
                {
                    return;
                }
                try
                {
                    //TODO retries
                    if (r <= 3)
                    {
                        //TODO resume
                        //if (!(true  && File.Exists(string.Format(imageFormat, i))))
                        if (!File.Exists(string.Format(imageFormat, i)))
                        {
                            var tempImage = Http.DownloadImage(_novel.GetImageLink(i), _novel.GetRefLink(i),
                                                               _novel.NewFormat);
                            tempImage.Save(string.Format(imageFormat, i));
                            tempImage.Dispose();
                        }
                        if (!_running)
                        {
                            return;
                        }
                        Progress((int)((double)((i - _novel.FirstIndex) * 100) / _novel.TotalPages));
                    }
                    else
                    {
                        LogMessage("Unable to download within the provided number of retries.");
                    }
                }
                catch
                (Exception
                 ex)
                {
                    LogMessage("Unable to download page: " + i);
                    LogMessage("Trying to download page" + i + " again.");
                    LogMessage("Error: " + ex.Message);
                    r++;
                    goto Retry;
                }
            }
            LogMessage("Download complete.");
            //TODO ApplicationSettings.CreatePdf
            if (true)
            {
                LogMessage("Creating PDF file.");
                try
                {
                    using (var pdfFile = new pdfDocument(_novel.Name, "Abdullah Saleem"))
                    {
                        for (var i = _novel.FirstIndex; i <= _novel.LastIndex; i++)
                        {
                            var file = string.Format(imageFormat, i);
                            LogMessage("Processing page: " + i);
                            if (File.Exists(file))
                            {
                                try
                                {
                                    using (var image = Image.FromFile(file))
                                    {
                                        pdfFile.addImageReference(file, i.ToString(CultureInfo.InvariantCulture));
                                        var tempPage = pdfFile.addPage(image.Height, image.Width);
                                        tempPage.addImage(
                                            pdfFile.getImageReference(i.ToString(CultureInfo.InvariantCulture)), 0, 0);
                                    }
                                    LogMessage("Page " + i + " added.");
                                }
                                catch (Exception)
                                {
                                    LogMessage("Page number " + i + "missing.");
                                }
                            }
                            else
                            {
                                LogMessage("Page number " + i + "missing.");
                            }
                        }
                        pdfFile.createPDF(Path.Combine(directory, _novel.Name + ".pdf"));
                        LogMessage("PDF Created!");

                        //TODO ApplicationSettings.OpenPdf
                        //if (false)
                        //{
                        //    Process.Start(Path.Combine(directory, _novel.Name + ".pdf"));
                        //}
                    }
                }
                catch (Exception ex)
                {
                    LogMessage("Error occured while creating the PDF.");
                    LogMessage("Error: " + ex.Message);
                }
            }
            //TODO: ApplicationSettings.DeleteImages
            if (true)
            {
                LogMessage("Deleting images.");
                for (var i = _novel.FirstIndex; i <= _novel.LastIndex; i++)
                {
                    if (File.Exists(string.Format(imageFormat, i)))
                    {
                        try
                        {
                            File.Delete(string.Format(imageFormat, i));
                        }
                        catch (Exception ex)
                        {
                            LogMessage("Error occured while deleting images.");
                            LogMessage("Error: " + ex.Message);
                        }
                    }
                }
            }
            LogMessage("Completed.");
        }
Ejemplo n.º 18
0
        private void onCreatePDFFile()
        {
            if (string.IsNullOrWhiteSpace(fileName))
            {
                NotifyWindow notifyWindow = new NotifyWindow("错误", "请先输入生成PDF文件名称!");
                notifyWindow.Show();
                return;
            }

            if (ImagesList.Count == 0)
            {
                NotifyWindow notifyWindow = new NotifyWindow("错误", "请先添加文件!");
                notifyWindow.Show();
                return;
            }

            pdfDocument doc      = new pdfDocument(fileName, "", false);
            bool        getIamge = false;

            foreach (AddImageEntity imageEntity in ImagesList)
            {
                try
                {
                    WriteableBitmap bitmap;
                    using (FileStream fs = new FileStream(imageEntity.FilePath, FileMode.Open))
                    {
                        BitmapImage bi = new BitmapImage();
                        bi.SetSource(fs);
                        bitmap = new WriteableBitmap(bi);
                    }

                    if (null != bitmap)
                    {
                        pdfPage page = doc.addPage((int)bitmap.PixelHeight, (int)bitmap.PixelWidth);
                        page.addImage(bitmap, 0, 0);
                        getIamge             = true;
                        createPDFFileSuccess = true;
                    }
                    else
                    {
                        createPDFFileSuccess = false;
                    }
                }
                catch
                {
                    createPDFFileSuccess = false;

                    NotifyWindow notifyWindow = new NotifyWindow("错误", string.Format("打开图片文件{0}失败,请检查文件!!!", imageEntity.FilePath));
                    notifyWindow.Show();
                }
            }

            if (getIamge)
            {
                tempPDFFile = System.IO.Path.GetTempFileName();

                using (FileStream fs = new FileStream(tempPDFFile, FileMode.Create))
                {
                    doc.createPDF(fs);
                }


                UserFile            = new UserFile();
                UserFile.FileName   = fileName;
                UserFile.FileFolder = taxPayerEntity.TaxPayerId.ToString();
                UserFile.FileStream = (new FileInfo(tempPDFFile)).OpenRead();

                taxPayerDocumentEntity = new TaxPayerDocumentEntity();
                taxPayerDocumentEntity.TaxPayerDocumentBytes = UserFile.FileStream.Length;

                (OnUpdate as DelegateCommand).RaiseCanExecuteChanged();

                UpdateChanged("UserFile");
            }
        }
Ejemplo n.º 19
0
        protected void grdOS_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string[] ParImpressao = e.CommandArgument.ToString().Split(new char[] { '$' });

            try
            {
                string p;
                switch (e.CommandName.ToLower().Trim())
                {
                case "lnk":
                    if (cmbObra.SelectedItem.ToString().TrimEnd() == "SERVIÇOS DE TI" || chkServicosTI.Checked == true)
                    {
                        p = "webATE_ServicosTI.aspx?id=" + e.CommandArgument.ToString();
                    }
                    else
                    {
                        p = "webATE_OS.aspx?id=" + e.CommandArgument.ToString();
                    }
                    Response.Redirect(p, false);
                    break;

                case "btn":
                    ImprimirOs  Imprimir = new ImprimirOs();
                    pdfDocument myDoc    = new pdfDocument("Horizon", "Orion");
                    Imprimir.myDoc             = myDoc;
                    Imprimir.myPage            = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
                    Imprimir.cmpCoObra         = ParImpressao[0].ToString();
                    Imprimir.cmpIdOS           = ParImpressao[1].ToString();
                    Imprimir.NomeObra          = cmbObra.SelectedItem.ToString();
                    Imprimir.EnderecoLogoOrion = Server.MapPath("~/Imagens/logo_Orion.jpg");

                    if (ViewState["cmpInLogoObra"].ToString() == "1")
                    {
                        Imprimir.EnderecoLogoObra = Server.MapPath("~/Imagens/logo_IPEN.bmp");
                    }
                    else
                    {
                        Imprimir.EnderecoLogoObra = "";
                    }

                    Imprimir.ImprimeOrdemServico();

                    //filename = "pdf" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf";
                    //string nomepdf = Server.MapPath("~/Relatorios/" + filename);

                    myDoc.createPDF(Server.MapPath("~/Relatorios/" + filename));

                    Response.Write("<script>window.open('" + Global.UrlRelatorio + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105');</script>");

                    break;

                case "log":
                    DataTable dtLog = tblLogOS.LogOS(Global.GetConnection(), e.CommandArgument.ToString().Trim());
                    grdLogs.DataSource = dtLog;
                    grdLogs.DataBind();
                    ModalPopupExtender2.Show();

                    break;
                }
            }
            catch (Exception ex)
            {
                Global.ShowError(Global.Title, ex);
            }
        }
Ejemplo n.º 20
0
    public int CreatePDF(int id, string idrecord)
    {
        int      pageIndex  = 0;
        int      tableIndex = 0;
        DateTime dateNow    = DateTime.Now;
        string   getDate    = String.Format("{0:D4}/{1:D2}/{2:D2} {3:D2}:{4:D2}", dateNow.Year, dateNow.Month, dateNow.Day, dateNow.Hour, dateNow.Minute);

        this.Get_user(id);
        this.Get_GameDetail(idrecord);
        this.Get_GameRecord(id, idrecord);
        attachName  = "Rundom_" + nama.ToUpper() + "_" + gametype + "_" + idrecord + ".pdf";
        myDoc       = new pdfDocument("Rundom PDF Proses", "rajebdev", false);
        myFirstPage = myDoc.addPage();

        pageList.Add(myFirstPage);


        pageList[0].addText("Hasil Perkembangan Siswa - RUNDOM GAME", 45, 730, predefinedFont.csHelveticaOblique, 20, new pdfColor(predefinedColor.csBlack));
        pageList[0].addText("Nama Siswa        :  " + nama.ToUpper(), 50, 680, predefinedFont.csHelveticaOblique, 14, new pdfColor(predefinedColor.csBlack));
        pageList[0].addText("Jenis Kelamin     :  " + sex, 50, 660, predefinedFont.csHelveticaOblique, 14, new pdfColor(predefinedColor.csBlack));
        pageList[0].addText("Tingkatan           :  " + gametype, 50, 640, predefinedFont.csHelveticaOblique, 14, new pdfColor(predefinedColor.csBlack));
        pageList[0].addText("ID Permainan     :  " + idrecord, 50, 620, predefinedFont.csHelveticaOblique, 14, new pdfColor(predefinedColor.csBlack));

        pageList[0].addText("Ringkasan Permainan ", 50, 580, predefinedFont.csHelveticaOblique, 16, new pdfColor(predefinedColor.csBlack));

        tableList.Add(new pdfTable());
        //Set table's border
        tableList[tableIndex].borderSize  = 1;
        tableList[tableIndex].borderColor = new pdfColor(predefinedColor.csDarkBlue);

        /*Set Header's Style*/
        tableList[tableIndex].tableHeaderStyle  = new pdfTableRowStyle(predefinedFont.csCourierBoldOblique, 12, new pdfColor(predefinedColor.csBlack), new pdfColor(predefinedColor.csLightOrange));
        tableList[tableIndex].rowStyle          = new pdfTableRowStyle(predefinedFont.csCourier, 12, new pdfColor(predefinedColor.csBlack), new pdfColor(predefinedColor.csWhite));
        tableList[tableIndex].alternateRowStyle = new pdfTableRowStyle(predefinedFont.csCourier, 12, new pdfColor(predefinedColor.csBlack), new pdfColor(predefinedColor.csLightYellow));
        tableList[tableIndex].cellpadding       = 7;
        //==========================

        /*Add Columns to a grid*/
        tableList[tableIndex].tableHeader.addColumn(new pdfTableColumn("Keterangan", predefinedAlignment.csCenter, 150));
        tableList[tableIndex].tableHeader.addColumn(new pdfTableColumn("Nilai", predefinedAlignment.csCenter, 200));


        pdfTableRow myRow = tableList[tableIndex].createRow();

        myRow[0].columnValue = "Jumlah Benar";
        myRow[1].columnValue = nilaibenar;
        tableList[tableIndex].addRow(myRow);

        pdfTableRow myRow1 = tableList[tableIndex].createRow();

        myRow1[0].columnValue = "Jumlah Salah";
        myRow1[1].columnValue = nilaisalah;
        tableList[tableIndex].addRow(myRow1);

        pdfTableRow myRow2 = tableList[tableIndex].createRow();

        myRow2[0].columnValue = "Score";
        myRow2[1].columnValue = score;
        tableList[tableIndex].addRow(myRow2);


        pdfTableRow myRow3 = tableList[tableIndex].createRow();

        myRow3[0].columnValue = "Waktu";
        myRow3[1].columnValue = time + " Detik";
        tableList[tableIndex].addRow(myRow3);


        pdfTableRow myRow4 = tableList[tableIndex].createRow();

        myRow4[0].columnValue = "Total Lompatan";
        myRow4[1].columnValue = (int.Parse(nilaibenar) + int.Parse(nilaisalah)).ToString() + " Kali";
        tableList[tableIndex].addRow(myRow4);

        pageList[pageIndex].addTable(tableList[tableIndex], 55, 560);

        // Detail Permainan

        pageList[0].addText("Detail Permainan ", 50, 350, predefinedFont.csHelveticaOblique, 16, new pdfColor(predefinedColor.csBlack));

        tableList.Add(new pdfTable());
        //Set table's border
        tableList[tableIndex].borderSize  = 1;
        tableList[tableIndex].borderColor = new pdfColor(predefinedColor.csDarkBlue);

        /*Set Header's Style*/
        tableList[1].tableHeaderStyle  = new pdfTableRowStyle(predefinedFont.csCourierBoldOblique, 11, new pdfColor(predefinedColor.csBlack), new pdfColor(predefinedColor.csLightOrange));
        tableList[1].rowStyle          = new pdfTableRowStyle(predefinedFont.csCourier, 11, new pdfColor(predefinedColor.csBlack), new pdfColor(predefinedColor.csWhite));
        tableList[1].alternateRowStyle = new pdfTableRowStyle(predefinedFont.csCourier, 11, new pdfColor(predefinedColor.csBlack), new pdfColor(predefinedColor.csLightYellow));
        tableList[1].cellpadding       = 5;
        //==========================

        /*Add Columns to a grid*/
        tableList[1].tableHeader.addColumn(new pdfTableColumn("No", predefinedAlignment.csCenter, 30));
        tableList[1].tableHeader.addColumn(new pdfTableColumn("Soal", predefinedAlignment.csCenter, 150));
        tableList[1].tableHeader.addColumn(new pdfTableColumn("Jawab", predefinedAlignment.csCenter, 150));
        tableList[1].tableHeader.addColumn(new pdfTableColumn("Kondisi", predefinedAlignment.csCenter, 50));
        tableList[1].tableHeader.addColumn(new pdfTableColumn("Score", predefinedAlignment.csCenter, 50));
        tableList[1].tableHeader.addColumn(new pdfTableColumn("Waktu", predefinedAlignment.csCenter, 70));

        // add data gameecord hit to data;

        string        connection = "URI=file:" + Application.dataPath + "/StreamingAssets/rundomdb.db";
        IDbConnection dbcon      = new SqliteConnection(connection);

        dbcon.Open();
        IDbCommand  cmnd_read = dbcon.CreateCommand();
        IDataReader reader;

        string query = "SELECT * FROM GameRecordHit" +
                       " WHERE idGameRecord='" + idrecord + "'";

        cmnd_read.CommandText = query;
        reader = cmnd_read.ExecuteReader();
        int no  = 1;
        int tmp = 0;

        while (reader.Read())
        {
            pdfTableRow tmpRow = tableList[1].createRow();
            tmpRow[0].columnValue = no.ToString();
            tmpRow[1].columnValue = soal[int.Parse(reader[1].ToString())];
            tmpRow[2].columnValue = reader[6].ToString() + " " + namaBangun[int.Parse(reader[5].ToString())];
            tmpRow[3].columnValue = reader[3].ToString() == "0" ? "SALAH" : "BENAR";
            tmpRow[4].columnValue = reader[4].ToString();
            tmpRow[5].columnValue = (int.Parse(reader[7].ToString()) - tmp).ToString() + " Detik";
            tmp = int.Parse(reader[7].ToString());
            tableList[1].addRow(tmpRow);
            no++;
        }

        pageList[pageIndex].addTable(tableList[1], 55, 330);


        pageList[0].addText("Generate at  " + getDate, 400, 50, predefinedFont.csHelveticaOblique, 8, new pdfColor(predefinedColor.csBlack));

        myDoc.createPDF(Application.dataPath + "/StreamingAssets/Pdf File/" + attachName);
        if (myDoc.isSucces == true)
        {
            pdfSuc.SetActive(true);
        }
        else
        {
            pdfWarn.SetActive(true);
        }

        pageList  = null;
        tableList = null;
        return(0);
    }
Ejemplo n.º 21
0
        //Onglet Recapitulatif
        private void btnCreeReca_Click(object sender, EventArgs e)
        {
            try
            {
                //Initialisation des variables
                connec.Open();
                string         mois             = dtpReca.Value.Month.ToString();
                string         annee            = dtpReca.Value.Year.ToString();
                string         text             = "____________________________________________________";
                string         typeNull         = "Type NULL";
                float          montant          = 0;
                int            recette          = 0;
                int            percu            = 0;
                int            indentation      = 20;
                int            hauteurDesLignes = 720;
                List <string>  un            = new List <string>();
                List <string>  de            = new List <string>();
                List <string>  tr            = new List <string>();
                List <string>  qu            = new List <string>();
                List <string>  ci            = new List <string>();
                List <string>  si            = new List <string>();
                List <Boolean> nbTransaction = new List <Boolean>();
                pdfDocument    myDoc         = new pdfDocument("Recapitulatif_" + mois + "_" + annee, "Pique_Sous");
                pdfPage        myPage        = myDoc.addPage();

                //SQL
                OleDbCommand    cd1 = new OleDbCommand("SELECT [Transaction].* FROM [Transaction] WHERE MONTH([dateTransaction]) = " + dtpReca.Value.Month.ToString(), connec);
                OleDbDataReader dr1 = cd1.ExecuteReader();

                //Lecture de la base
                while (dr1.Read())
                {
                    nbTransaction.Add(dr1.GetBoolean(4));
                    if (dr1.GetBoolean(4) == true)
                    {
                        recette++;
                    }
                    if (dr1.GetBoolean(5) == true)
                    {
                        percu++;
                    }
                    montant = montant + dr1.GetFloat(3);

                    un.Add(dr1[1].ToString().Substring(0, 11));
                    de.Add(dr1[2].ToString());
                    tr.Add(dr1[3].ToString());
                    qu.Add(dr1[4].ToString());
                    ci.Add(dr1[5].ToString());

                    if (dr1[6].ToString() != "")
                    {
                        si.Add(dr1[6].ToString());
                    }
                    else
                    {
                        si.Add(typeNull);
                    }
                }
                for (int i = 0; i < si.Count; i++)
                {
                    if (si[i] != typeNull)
                    {
                        //Pour eviter de faire une requette avec une jointure
                        OleDbCommand    cd2 = new OleDbCommand("SELECT [TypeTransaction].* FROM [TypeTransaction] where [codeType] = " + si[i], connec);
                        OleDbDataReader dr2 = cd2.ExecuteReader();
                        while (dr2.Read())
                        {
                            si[i] = dr2[1].ToString();
                        }
                    }
                }

                //Creation du text dans le PDF
                myPage.addText("Recapitulatif du : " + mois + "_" + annee, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText("Dépenses", indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - (30 + 25 * un.Count);
                myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText("Recette : " + recette.ToString(), indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText(" Depenses : " + montant.ToString(), indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText("Reste a persevoir : " + percu.ToString(), indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText("Somme total dépensée : -" + montant.ToString(), indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText("nombres de transactions : " + nbTransaction.Count.ToString(), indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);

                //Initiallisation tableau PDF
                pdfTable myTable = new pdfTable(myDoc);
                myTable.borderSize  = 1;
                myTable.borderColor = sharpPDF.pdfColor.Black;
                myTable.tableHeader.addColumn(90);
                myTable.tableHeader.addColumn(120);
                myTable.tableHeader.addColumn(70);
                myTable.tableHeader.addColumn(70);
                myTable.tableHeader.addColumn(70);
                myTable.tableHeader.addColumn(110);
                pdfTableRow myRow = myTable.createRow();

                //Remplissage de la première ligne du tableau
                myRow[0].addText("Date Transaction");
                myRow[1].addText("Description");
                myRow[2].addText("Montant");
                myRow[3].addText("Recette ?");
                myRow[4].addText("Perçu ?");
                myRow[5].addText("Type de dépence ?");
                myTable.addRow(myRow);

                //Remplissage des ligne du tableau
                for (int i = 0; i < un.Count; i++)
                {
                    myRow = myTable.createRow();
                    myRow[0].addText(un[i]);
                    myRow[1].addText(de[i]);
                    myRow[2].addText(tr[i]);
                    myRow[3].addText(qu[i]);
                    myRow[4].addText(ci[i]);
                    myRow[5].addText(si[i]);
                    myTable.addRow(myRow);
                }

                //Place le tableau
                myTable.coordY = 650;
                myTable.coordX = 20;
                myPage.addTable(myTable);

                //creer le PDF
                FolderBrowserDialog fbd = new FolderBrowserDialog();
                if (fbd.ShowDialog() == DialogResult.OK)
                {
                    myDoc.createPDF(fbd.SelectedPath + @"\Recapitulatif_" + mois + "_" + annee + ".pdf");
                }
                myPage = null;
                myDoc  = null;
                connec.Close();
                MessageBox.Show("PDF créé");
            }
            catch (InvalidOperationException erreur)
            {
                MessageBox.Show("Erreur de chaine de connexion ! pdf");
                MessageBox.Show(erreur.Message);
            }
            catch (OleDbException erreur)
            {
                MessageBox.Show("Erreur de requete SQL ! pdf");
                MessageBox.Show(erreur.Message);
            }
        }
Ejemplo n.º 22
0
        protected void btnGerarRel_Click(object sender, EventArgs e)
        {
            System.Threading.Thread.Sleep(5000);

            string filename;
            string nomepdf;

            DataTable table = new DataTable();

            if (ViewState["tipoMaterial"] != null && ViewState["tipoMaterial"].ToString() == "LGMT")
            {
                table = RetornaMaterialObra();
                if (table != null && table.Rows.Count > 0)
                {
                    ImprimirMaterialObra Imprimir = new ImprimirMaterialObra();
                    pdfDocument          myDoc    = new pdfDocument("Horizon", "Orion");
                    filename = "MaterialObra" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf";
                    nomepdf  = Server.MapPath("~/Relatorios/" + filename);

                    Imprimir.myDoc             = myDoc;
                    Imprimir.myPage            = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
                    Imprimir.NomeObra          = cmbObra.SelectedItem.ToString();
                    Imprimir.EnderecoLogoOrion = Server.MapPath("~/Imagens/logo_Orion.jpg");
                    if (ViewState["cmpInLogoObra"].ToString() == "True")
                    {
                        Imprimir.EnderecoLogoObra = Server.MapPath("~/Imagens/logo_IPEN.bmp");
                    }
                    else
                    {
                        Imprimir.EnderecoLogoObra = "";
                    }

                    Imprimir.ImprimeMaterial(table);

                    myDoc.createPDF(nomepdf);

                    btnImprimir.Visible = true;
                    btnImprimir.Attributes.Add("onclick", "window.open('" + Global.UrlRelatorio + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105');");
                }
                else
                {
                    CaixaMensagem.Mostar(Mensagem.Tipo.Aviso, "Não há consumo de material para o período!");
                }
            }
            else if (ViewState["tipoMaterial"] != null && ViewState["tipoMaterial"].ToString() == "LMUO")
            {
                if (ValidaPeriodo())
                {
                    table = RetornaMaterialPeriodo();
                    if (table != null && table.Rows.Count > 0)
                    {
                        ImprimirMaterialObraPeriodo Imprimir = new ImprimirMaterialObraPeriodo();
                        pdfDocument myDoc = new pdfDocument("Horizon", "Orion");
                        filename = "MaterialObra" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf";
                        nomepdf  = Server.MapPath("~/Relatorios/" + filename);

                        Imprimir.myDoc             = myDoc;
                        Imprimir.myPage            = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
                        Imprimir.NomeObra          = cmbObra.SelectedItem.ToString();
                        Imprimir.EnderecoLogoOrion = Server.MapPath("~/Imagens/logo_Orion.jpg");
                        if (ViewState["cmpInLogoObra"].ToString() == "True")
                        {
                            Imprimir.EnderecoLogoObra = Server.MapPath("~/Imagens/logo_IPEN.bmp");
                        }
                        else
                        {
                            Imprimir.EnderecoLogoObra = "";
                        }

                        Imprimir.DtInicial = txtDataInicial.Text.Substring(0, 10);
                        Imprimir.DtFinal   = txtDataFinal.Text.Substring(0, 10);

                        Imprimir.ImprimeMaterial(table);

                        myDoc.createPDF(nomepdf);

                        btnImprimir.Visible = true;
                        btnImprimir.Attributes.Add("onclick", "window.open('" + Global.UrlRelatorio + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105');");
                    }
                    else
                    {
                        CaixaMensagem.Mostar(Mensagem.Tipo.Aviso, "Não há consumo de material para o período!");
                    }
                }
            }
            else if (ViewState["tipoMaterial"] != null && ViewState["tipoMaterial"].ToString() == "LMUA")
            {
                if (ValidaPeriodo())
                {
                    table = RetornaMaterialGrupoObraPeriodo();
                    if (table != null && table.Rows.Count > 0)
                    {
                        ImprimirMaterialGrupoObraPeriodo Imprimir = new ImprimirMaterialGrupoObraPeriodo();
                        pdfDocument myDoc = new pdfDocument("Horizon", "Orion");
                        filename = "MaterialObra" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf";
                        nomepdf  = Server.MapPath("~/Relatorios/" + filename);

                        Imprimir.myDoc             = myDoc;
                        Imprimir.myPage            = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
                        Imprimir.NomeObra          = cmbObra.SelectedItem.ToString();
                        Imprimir.EnderecoLogoOrion = Server.MapPath("~/Imagens/logo_Orion.jpg");
                        if (ViewState["cmpInLogoObra"].ToString() == "True")
                        {
                            Imprimir.EnderecoLogoObra = Server.MapPath("~/Imagens/logo_IPEN.bmp");
                        }
                        else
                        {
                            Imprimir.EnderecoLogoObra = "";
                        }
                        Imprimir.DtInicial = txtDataInicial.Text.Substring(0, 10);
                        Imprimir.DtFinal   = txtDataFinal.Text.Substring(0, 10);

                        Imprimir.ImprimeMaterial(table);

                        myDoc.createPDF(nomepdf);

                        btnImprimir.Visible = true;
                        btnImprimir.Attributes.Add("onclick", "window.open('" + Global.UrlRelatorio + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105');");
                    }
                    else
                    {
                        CaixaMensagem.Mostar(Mensagem.Tipo.Aviso, "Não há consumo de material para o período!");
                    }
                }
            }
        }