當前位置: 首頁>>代碼示例>>C#>>正文


C# Document.IsOpen方法代碼示例

本文整理匯總了C#中iTextSharp.text.Document.IsOpen方法的典型用法代碼示例。如果您正苦於以下問題:C# Document.IsOpen方法的具體用法?C# Document.IsOpen怎麽用?C# Document.IsOpen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iTextSharp.text.Document的用法示例。


在下文中一共展示了Document.IsOpen方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RenderAllTables

        /// <summary>
        /// Render all data add and writes it to the specified writer
        /// </summary>
        /// <param name="model">
        /// The model to render
        /// </param>
        /// <param name="os">
        /// The output to write to
        /// </param>
        public override void RenderAllTables(IDataSetModel model, Stream os)
        {
            // TODO check the number of horizontal & vertical key values to determine the orientation of the page
            var doc = new Document(this._pageSize, 80, 50, 30, 65);

            // This doesn't seem to do anything...
            doc.AddHeader(Markup.HTML_ATTR_STYLESHEET, "style/pdf.css");
            doc.AddCreationDate();
            doc.AddCreator("NSI .NET Client");
            try
            {
                PdfWriter.GetInstance(doc, os);
                doc.Open();
                this.WriteTableModels(model, doc);
            }
            catch (DocumentException ex)
            {
                Trace.Write(ex.ToString());
                LogError.Instance.OnLogErrorEvent(ex.ToString());
            }
            catch (DbException ex)
            {
                Trace.Write(ex.ToString());
                LogError.Instance.OnLogErrorEvent(ex.ToString());
            }
            finally
            {
                if (doc.IsOpen())
                {
                    doc.Close();
                }
            }
        }
開發者ID:alcardac,項目名稱:SDMX_DATA_BROWSER,代碼行數:42,代碼來源:PdfRenderer.cs

示例2: DisposePdf

 /// <summary>
 /// 關閉PDF文檔流
 /// </summary>
 /// <param name="doc"></param>
 public void DisposePdf(Document doc)
 {
     if (doc.IsOpen())
     {
         doc.Close();
     }
     doc.Dispose();
 }
開發者ID:fuhongliang,項目名稱:GraduateProject,代碼行數:12,代碼來源:DIStatementExport.aspx.cs

示例3: OnStartPage

 //重寫 打開一個新頁麵時
 public override void OnStartPage(PdfWriter writer, Document document)
 {
     try
     {
         if (PAGE_NUMBER)
         {
             writer.PageCount = writer.PageNumber;
         }
         if (isPdfTable)
         {
             if (!document.IsOpen())
             {
                 document.Open();
             }
             document.Add(pdftable);
         }
     }
     catch (Exception ex)
     {
         throw new Exception("HeaderAndFooterEvent-->OnStartPage-->" + ex.Message);
     }
    
 }
開發者ID:lxh2014,項目名稱:gigade-net,代碼行數:24,代碼來源:HeaderAndFooterEvent.cs

示例4: convertPDF

 private void convertPDF()
 {
     DirectoryInfo di = new DirectoryInfo(_imagepath);
     FileInfo[] files = di.GetFiles("*" + ImageType);
     Array.Sort(files, mySort);
     Document document = new Document(iTextSharp.text.PageSize.A4, 0, 0, 0, 0);
     try
     {
         PdfWriter pdfWrite = PdfWriter.GetInstance(document, new FileStream(PDFFilePath, FileMode.Create, FileAccess.ReadWrite));
         document.Open();
         iTextSharp.text.Image image;
         document.AddTitle(_book.Title);
         foreach (FileInfo file in files)
         {
             image = iTextSharp.text.Image.GetInstance(file.FullName);
             document.SetPageSize(new iTextSharp.text.Rectangle(image.Width, image.Height));
             image.Alignment = iTextSharp.text.Image.ALIGN_MIDDLE;
             document.NewPage();
             document.Add(image);
         }
         try
         {
             BookContentNode content = BookContent.GetBookContent(_book.did, _book.PdgPath);
             PdfContentByte pdfcontent = pdfWrite.DirectContent;
             AddBookContents(pdfWrite, pdfcontent.RootOutline, content);
         }
         catch (Exception e)
         {
             if (e is ThreadAbortException)
                 throw e;
         }
         Directory.Delete(_imagepath, true);
     }
     catch (Exception e)
     {
         if (e is ThreadAbortException)
             throw e;
         throw new Exception("轉換PDF時出錯");
     }
     finally
     {
         if (document != null && document.IsOpen())
             document.Close();
     }
 }
開發者ID:leicheng1996,項目名稱:eReading,代碼行數:45,代碼來源:Download.cs

示例5: EnviarPDF

        public ActionResult EnviarPDF(int? procID)
        {
            try
            {
                var docs = db.DOCUMENTOS.Where(d => d.DOC_PROC_ID == procID).ToList();
                string _arquivo = "";
                string path = HttpContext.Server.MapPath("~/DOCS/");
                //TODO: 17/03/2016
                var proc = new Processo().GetProcesso(procID);
                string _nrodoccaixa = proc.PRC_DOCCAIXA.ToString();
                string _diamesano = new DAO.Documento().DiaMesAnoAtual();
                string pdfpath = HttpContext.Server.MapPath("~/PDF/") + _nrodoccaixa + _diamesano + ".pdf";
                string nomearquivo = _nrodoccaixa + _diamesano + ".pdf";
                //string pdfpath = HttpContext.Server.MapPath("~/PDF/") + procID.ToString() + ".pdf";

                if (System.IO.File.Exists(pdfpath))
                {
                    System.IO.File.Delete(pdfpath);
                }

                using (var doc = new iTextSharp.text.Document())
                {
                    if (doc.IsOpen()) doc.Close();
                    iTextSharp.text.pdf.PdfWriter.GetInstance(doc, new FileStream(pdfpath, FileMode.Create));
                    doc.Open();

                    //DADOS CAPA
                    doc.Add(new Paginacao().ParagrafoNegrito("ESTADO DO CEARÁ \n\n", 24f));
                    doc.Add(new Paginacao().ParagrafoNegrito(new Entidade().NomeEntidade()+"\n\n\n", 24f));
                    doc.Add(new Paginacao().ParagrafoNegrito("PROCESSO DE PAGAMENTO \n\n", 24f));

                    doc.Add(new Paginacao().ParagrafoNegrito("Exercício:" + proc.PRC_DTREFDOC.Substring(2, 4) + " \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", 24f));

                    Single _tamfont = 10f;
                    var fun = new Funcoes();

                    doc.Add(new Paginacao().Paragrafo("Credor: " + fun.NaoNull(proc.PRC_CREDOR.ToString()) + "", _tamfont, 1));
                    doc.Add(new Paginacao().Paragrafo("Documento Caixa: " + fun.NaoNull(proc.PRC_DOCCAIXA.ToString()) + "", _tamfont, 1));
                    doc.Add(new Paginacao().Paragrafo("Empenho: " + fun.NaoNull(proc.PRC_NOTAEMP.ToString()) + "", _tamfont, 1));
                    doc.Add(new Paginacao().Paragrafo("Valor: " + fun.NaoNull(proc.PRC_VRPAGAM.ToString()) + "", _tamfont, 1));
                    doc.Add(new Paginacao().Paragrafo("Código Orgão: " + fun.NaoNull(proc.PRC_ORGAO.ToString()) + "", _tamfont, 1));
                    doc.Add(new Paginacao().Paragrafo("Código Unidade Orç: " + fun.NaoNull(proc.PRC_UND_ORC.ToString()) + "", _tamfont, 1));

                    if(proc.PRC_UND_GEST!=null)
                        doc.Add(new Paginacao().Paragrafo("Unidade Gestora: " + new UnidadeGestora(proc.PRC_UND_GEST).NomeUnidGestora + "", _tamfont, 1));
                    else
                        doc.Add(new Paginacao().Paragrafo("Unidade Gestora: Não Informada", _tamfont, 1));

                    doc.Add(new Paginacao().Paragrafo("\n\n\n\n\n\n\n\n", _tamfont, 1));
                    doc.Add(new Paginacao().Paragrafo("Ged SESCONTI", _tamfont, 0));
                    doc.Add(new Paginacao().Paragrafo("Emissão em "+Funcoes.DataAtual(), _tamfont, 0));

                    doc.NewPage();

                    foreach (var itm in docs)
                    {
                        _arquivo = path + itm.DOC_ARQUIVO;
                        iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(_arquivo);

                        image.ScaleToFit(doc.PageSize.Width - 120, doc.PageSize.Height - 80);
                        image.ScaleAbsoluteHeight(doc.PageSize.Height - 80);
                        image.ScaleAbsoluteWidth(doc.PageSize.Width - 80);

                        doc.Add(image);
                    }
                }
                ViewBag.PDFEnviado = nomearquivo;
                TempData["MsgFixa"] = "Documentos gravados em PDF com sucesso.";
            }
            catch (Exception ex)
            {
                TempData["MsgErro"] = "Occoreu um erro: " + ex.Message;
            }

            PROCESSOS pROCESSOS = db.PROCESSOS.Find(procID);
            return View("Edit", pROCESSOS);
        }
開發者ID:andresombra,項目名稱:ged,代碼行數:77,代碼來源:ProcessosController.cs

示例6: btnSlipPrint_Click

        private void btnSlipPrint_Click(object sender, EventArgs e)
        {
            string sss = DateTime.Now.Millisecond + "Doc1.pdf";
            string filename = AppDomain.CurrentDomain.BaseDirectory + sss;
            Document document = new Document(new iTextSharp.text.Rectangle(155f, 219f), 1f, 1f, 1f, 1f);

            PdfWriter.GetInstance(document, new FileStream(filename, FileMode.Create));

            #region Header

            iTextSharp.text.Table tblHeader = new iTextSharp.text.Table(2, 6);
            tblHeader.Padding = 0;
            tblHeader.BorderWidth = 0;
            tblHeader.Border = 0;
            tblHeader.BorderColor = iTextSharp.text.Color.WHITE;
            tblHeader.Width = 100;
            tblHeader.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
            tblHeader.DefaultCell.BorderWidth = 0;
            tblHeader.DefaultCell.BorderColor = iTextSharp.text.Color.WHITE;
            tblHeader.SetWidths(new[] { 45, 100 });
            tblHeader.AddCell(CellCreate("CAFE MOLA", Element.ALIGN_CENTER, Element.ALIGN_CENTER, 2, 1, 10), 0, 0);
            tblHeader.AddCell(CellCreate("Masa No", Element.ALIGN_LEFT, Element.ALIGN_CENTER, 1, 0, 8), 1, 0);
            tblHeader.AddCell(CellCreate(":" + gTable.TableName, Element.ALIGN_LEFT, Element.ALIGN_CENTER), 1, 1);
            tblHeader.AddCell(CellCreate("Açılış", Element.ALIGN_LEFT, Element.ALIGN_CENTER, 1, 0, 8), 2, 0);
            tblHeader.AddCell(
                CellCreate(":" + gTable.RecordDate.ToString("dd.MM.yyyy hh:mm:ss"), Element.ALIGN_LEFT, Element.ALIGN_CENTER),
                2, 1);
            tblHeader.AddCell(CellCreate("Adisyon No", Element.ALIGN_LEFT, Element.ALIGN_CENTER, 1, 0, 8), 3, 0);
            tblHeader.AddCell(CellCreate(":" + gTable.Id.ToString(), Element.ALIGN_LEFT, Element.ALIGN_CENTER), 3, 1);

            #endregion

            #region Content

            iTextSharp.text.Table aTableProduct = new iTextSharp.text.Table(4, vBasket.Count + 1);
            aTableProduct.Padding = 0;
            aTableProduct.BorderWidth = 0;
            aTableProduct.Border = 0;
            aTableProduct.BorderColor = iTextSharp.text.Color.WHITE;
            aTableProduct.Width = 100;
            aTableProduct.SetWidths(new[] { 70, 25, 25, 25 });
            aTableProduct.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
            aTableProduct.DefaultCell.BorderWidth = 0;
            aTableProduct.DefaultCell.BorderColor = iTextSharp.text.Color.WHITE;

            aTableProduct.AddCell(CellCreate("Ürün", Element.ALIGN_LEFT, Element.ALIGN_CENTER, 1, 2, 8));
            aTableProduct.AddCell(CellCreate("Mik.", Element.ALIGN_LEFT, Element.ALIGN_CENTER, 1, 2, 8));
            aTableProduct.AddCell(CellCreate("Fiyat", Element.ALIGN_LEFT, Element.ALIGN_CENTER, 1, 2, 8));
            aTableProduct.AddCell(CellCreate("Tutar", Element.ALIGN_LEFT, Element.ALIGN_CENTER, 1, 2, 8));

            foreach (Basket t in vBasket)
            {
                aTableProduct.AddCell(CellCreate(t.Product.ProductName, Element.ALIGN_LEFT, Element.ALIGN_CENTER, 1, 1, 6));
                aTableProduct.AddCell(CellCreate(t.Quantity.ToString(CultureInfo.CurrentCulture), Element.ALIGN_LEFT,
                    Element.ALIGN_CENTER, 1, 1, 6));
                aTableProduct.AddCell(CellCreate(t.Product.SalesPrice.ToString("N2"), Element.ALIGN_LEFT,
                    Element.ALIGN_CENTER, 1, 1, 6));
                aTableProduct.AddCell(CellCreate(t.Total.ToString("N2"), Element.ALIGN_LEFT, Element.ALIGN_CENTER, 1, 1, 6));
            }

            #endregion

            #region Footer

            iTextSharp.text.Table tblFooter = new iTextSharp.text.Table(2, 3);
            tblFooter.Padding = 0;
            tblFooter.BorderWidth = 0;
            tblFooter.Border = 0;
            tblFooter.BorderColor = iTextSharp.text.Color.WHITE;
            tblFooter.Width = 100;
            tblFooter.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
            tblFooter.DefaultCell.BorderWidth = 0;
            tblFooter.DefaultCell.BorderColor = iTextSharp.text.Color.WHITE;
            tblFooter.SetWidths(new[] { 100, 45 });
            tblFooter.AddCell(CellCreate("Ara", Element.ALIGN_LEFT, Element.ALIGN_CENTER, 1, 1, 8), 0, 0);
            tblFooter.AddCell(CellCreate(total.ToString("N2"), Element.ALIGN_RIGHT, Element.ALIGN_CENTER, 1, 1, 8), 0,
                1);
            tblFooter.AddCell(CellCreate("Genel Toplam", Element.ALIGN_LEFT, Element.ALIGN_CENTER, 1, 1, 8), 1, 0);
            tblFooter.AddCell(CellCreate(total.ToString("N2"), Element.ALIGN_RIGHT, Element.ALIGN_CENTER, 1, 1, 8), 1,
                1);
            tblFooter.AddCell(CellCreate("Afiyet Olsun", Element.ALIGN_CENTER, Element.ALIGN_CENTER, 2, 1, 12), 2, 0);

            #endregion

            if (document.IsOpen() == false)
            {
                document.Open();
            }

            Paragraph headerPhrase = new Paragraph("") { Alignment = Element.ALIGN_CENTER };
            document.Add(tblHeader);
            document.Add(headerPhrase);
            document.Add(aTableProduct);
            document.Add(headerPhrase);
            document.Add(tblFooter);

            document.Close();
            var vList = MySettings.GetListPrinter();
            //pdDoc.PrinterSettings.PrinterName = vList[0].Value;
            //FileInfo file_into = new FileInfo(filename);
//.........這裏部分代碼省略.........
開發者ID:gacaromar,項目名稱:Restaurant,代碼行數:101,代碼來源:ucSaleSlip.cs

示例7: EvenOddMerge

        /// <summary>
        /// Takes pages from two pdf files, and produces an output file
        /// whose odd pages are the contents of the first, and
        /// even pages are the contents of the second. Useful for
        /// merging front/back output from single sided scanners.
        /// </summary>
        /// <param name="oddPageFile">The file supplying odd numbered pages</param>
        /// <param name="evenPageFile">The file supplying even numbered pages</param>
        /// <param name="outputFile">The output file containing the merged pages</param>
        /// <param name="skipExtraPages">Set to true to skip any extra pages if
        ///                              one file is longer than the other</param>
        public void EvenOddMerge(String oddPageFile, String evenPageFile, 
                                 String outputFile, bool skipExtraPages)
        {
            if (!String.IsNullOrEmpty(oddPageFile) && !String.IsNullOrWhiteSpace(oddPageFile) &&
                !String.IsNullOrEmpty(evenPageFile) && !String.IsNullOrWhiteSpace(evenPageFile) &&
                !String.IsNullOrEmpty(outputFile) && !String.IsNullOrWhiteSpace(outputFile))
            {
                var oddPageDocument = new iTextSharpPDF.PdfReader(oddPageFile);
                var evenPageDocument = new iTextSharpPDF.PdfReader(evenPageFile);
                try
                {
                    iTextSharpText.Document mergedOutputDocument = null;
                    iTextSharpPDF.PdfCopy mergedOutputFile = null;

                    int lastPage = 0;
                    switch (skipExtraPages)
                    {
                        case (false):
                            lastPage = oddPageDocument.NumberOfPages;
                            if (evenPageDocument.NumberOfPages > oddPageDocument.NumberOfPages)
                                lastPage = evenPageDocument.NumberOfPages;
                            else
                                lastPage = oddPageDocument.NumberOfPages;
                            break;
                        case (true):
                            if (evenPageDocument.NumberOfPages < oddPageDocument.NumberOfPages)
                                lastPage = evenPageDocument.NumberOfPages;
                            else
                                lastPage = oddPageDocument.NumberOfPages;
                            break;
                    }

                    try
                    {
                        mergedOutputDocument = new iTextSharpText.Document();
                        mergedOutputFile = new iTextSharpPDF.PdfCopy(mergedOutputDocument, new FileStream(outputFile, FileMode.Create, FileAccess.ReadWrite));
                        mergedOutputDocument.Open();
                        for (int loop = 1; loop <= lastPage; loop++)
                        {
                            // Extract and merge odd page
                            if (loop <= oddPageDocument.NumberOfPages)
                            {
                                mergedOutputDocument.SetPageSize(oddPageDocument.GetPageSizeWithRotation(loop));
                                mergedOutputFile.AddPage(mergedOutputFile.GetImportedPage(oddPageDocument, loop));
                            }
                            // Extract and merge even page
                            if (loop <= evenPageDocument.NumberOfPages)
                            {
                                mergedOutputDocument.SetPageSize(evenPageDocument.GetPageSizeWithRotation(loop));
                                mergedOutputFile.AddPage(mergedOutputFile.GetImportedPage(evenPageDocument, loop));
                            }
                        }
                    }
                    finally
                    {
                        if (mergedOutputDocument != null && mergedOutputDocument.IsOpen()) mergedOutputDocument.Close();
                        if (mergedOutputFile != null)
                        {
                            mergedOutputFile.Close();
                            mergedOutputFile.FreeReader(oddPageDocument);
                            mergedOutputFile.FreeReader(evenPageDocument);
                        }
                    }
                }
                catch
                {
                    try
                    {
                        File.Delete(outputFile);
                    }
                    catch { }
                    throw;
                }
                finally
                {
                    try
                    {
                        if (oddPageDocument != null) oddPageDocument.Close();
                        oddPageDocument = null;
                    }
                    catch { }
                    try
                    {
                        if (evenPageDocument != null) evenPageDocument.Close();
                        evenPageDocument = null;
                    }
                    catch { }
                }
            }
//.........這裏部分代碼省略.........
開發者ID:stchan,項目名稱:PdfMiniTools,代碼行數:101,代碼來源:CoreTools.cs

示例8: SplitPDF

        /// <summary>
        /// 
        /// </summary>
        /// <param name="inputFile">The PDF file to split</param>
        /// <param name="splitStartPages"></param>
        public void SplitPDF(String inputFile, SortedList<int, String> splitStartPages)
        {
            if (!String.IsNullOrEmpty(inputFile) &&
                !String.IsNullOrWhiteSpace(inputFile) &&
                splitStartPages != null &&
                splitStartPages.Count >= 2)
            {
                var inputDocument = new iTextSharpPDF.PdfReader(inputFile);
                // First split must begin with page 1
                // Last split must not be higher than last page
                if (splitStartPages.Keys[0] == 1 &&
                    splitStartPages.Keys[splitStartPages.Count - 1] <= inputDocument.NumberOfPages)
                {
                    int currentPage = 1;
                    int firstPageOfSplit;
                    int lastPageOfSplit;
                    try
                    {
                        for (int splitPoint = 0; splitPoint <= (splitStartPages.Count - 1); splitPoint++)
                        {
                            firstPageOfSplit = currentPage;
                            if (splitPoint < (splitStartPages.Count - 1))
                            {
                                lastPageOfSplit = splitStartPages.Keys[splitPoint + 1] - 1;
                            }
                            else
                            {
                                lastPageOfSplit = inputDocument.NumberOfPages;
                            }
                            iTextSharpText.Document splitDocument = null;
                            iTextSharpPDF.PdfCopy splitOutputFile = null;
                            try
                            {
                                splitDocument = new iTextSharpText.Document();
                                splitOutputFile = new iTextSharpPDF.PdfCopy(splitDocument, new FileStream(splitStartPages.Values[splitPoint], FileMode.Create, FileAccess.ReadWrite));
                                splitDocument.Open();
                                for (int outputPage = firstPageOfSplit; outputPage <= lastPageOfSplit; outputPage++)
                                {
                                    splitDocument.SetPageSize(inputDocument.GetPageSizeWithRotation(currentPage));
                                    splitOutputFile.AddPage(splitOutputFile.GetImportedPage(inputDocument, currentPage));
                                    currentPage++;
                                }
                            }
                            finally
                            {
                                if (splitDocument != null && splitDocument.IsOpen()) splitDocument.Close();
                                if (splitOutputFile != null)
                                {
                                    splitOutputFile.Close();
                                    splitOutputFile.FreeReader(inputDocument);
                                }
                                splitDocument = null;
                                splitOutputFile = null;
                            }
                        }
                    }
                    catch
                    {
                        // Cleanup any files that may have
                        // been written
                        foreach (KeyValuePair<int, String> split in splitStartPages)
                        {
                            try
                            {
                                File.Delete(split.Value);
                            }
                            catch { }
                        }
                        throw;
                    }
                    finally
                    {
                        if (inputDocument != null) inputDocument.Close();
                    }

                }
                else
                {
                    if (splitStartPages.Keys[splitStartPages.Count - 1] > inputDocument.NumberOfPages) throw new ArgumentOutOfRangeException("splitStartPages", String.Format("Final page number must be less than the number of pages ({0}). Passed value is {1}.", inputDocument.NumberOfPages, splitStartPages.Keys[splitStartPages.Count - 1]));
                    throw new ArgumentOutOfRangeException("splitStartPages", "First page number must be 1.");
                }
            }
            else
            {
                if (inputFile == null) throw new ArgumentNullException("inputFile", exceptionArgumentNullOrEmptyString);
                if (splitStartPages == null) throw new ArgumentNullException("splitStartPages", exceptionArgumentNullOrEmptyString);
                throw new ArgumentOutOfRangeException("splitStartPages", "Must contain at least two KeyValue pairs.");
            }
        }
開發者ID:stchan,項目名稱:PdfMiniTools,代碼行數:94,代碼來源:CoreTools.cs

示例9: ConcatPDFs

        /// <summary>
        /// Concatenates multiple PDF files together.
        /// </summary>
        /// <param name="outputPDFTitle">The name of the temp file to write</param>
        /// <param name="args">list of files (paths) to concatentate</param>
        public bool ConcatPDFs(string outputPDFTitle, String[] args)
        {
            Document document = new Document();
            try
            {
                int f = 0;
                // we create a reader for a certain document
                PdfReader reader = new PdfReader(args[f]);
                // we retrieve the total number of pages
                int n = reader.NumberOfPages;

                // step 1: creation of a document-object
                document = new Document(reader.GetPageSizeWithRotation(1));

                // step 2: we create a writer that listens to the document
                PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(outputPDFTitle, FileMode.Create));

                // step 3: we open the document
                document.Open();

                PdfContentByte cb = writer.DirectContent;
                PdfImportedPage page;
                int rotation;

                // step 4: we add content
                while (f < args.Length)
                {
                    int i = 0;
                    while (i < n)
                    {
                        i++;
                        document.SetPageSize(reader.GetPageSizeWithRotation(i));
                        document.NewPage();
                        page = writer.GetImportedPage(reader, i);
                        rotation = reader.GetPageRotation(i);
                        if (rotation == 90 || rotation == 270)
                        {
                            cb.AddTemplate(page, 0, -1f, 1f, 0, 0, reader.GetPageSizeWithRotation(i).Height);
                        }
                        else
                        {
                            cb.AddTemplate(page, 1f, 0, 0, 1f, 0, 0);
                        }
                    }
                    f++;
                    if (f < args.Length)
                    {
                        reader = new PdfReader(args[f]);
                        // we retrieve the total number of pages
                        n = reader.NumberOfPages;
                    }
                }

                // step 5: we close the document
                document.Close();

                return true;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (document.IsOpen())
                {
                    document.Close();
                }
                return false;
            }
        }
開發者ID:machshevet,項目名稱:gdata-samples,代碼行數:73,代碼來源:MainForm.cs

示例10: TransferDetailPDF

    /// <summary>
    /// 創建轉賬明細表
    /// </summary>
    /// <param name="document"></param>
    /// <param name="client"></param>
    /// <param name="documentDate"></param>
    /// <param name="year"></param>
    /// <param name="month"></param>
    /// <returns></returns>
    private Document TransferDetailPDF(Document document, CM_Client client, string documentDate, DateTime dateBegin, DateTime dateEnd)
    {
        if (!document.IsOpen())
        {
            return null;
        }
        document = this.GetDocumentHeader(document, "轉賬明細表", documentDate, client);
        document.Add(Chunk.NEWLINE);

        string procName = "JD.AIS_YSL.dbo.STKD_DDFYREPORT02_CXCAI";//代墊費用餘額(讓利明細表)存儲過程名
        DataTable dt = new DataTable();
        while (DateTime.Compare(dateBegin, dateEnd) <= 0)
        {
            //文檔期間項
            int year = dateBegin.Year;
            int month = dateBegin.Month;
            DataTable dtTemp = new CM_ClientBLL().GetStatement(procName, year, month, client.Code);
            dt.Merge(dtTemp);

            dateBegin = dateBegin.AddMonths(1);
        }
        dt.Columns.RemoveAt(1);//去除“期間”列
        //dt.Columns[1].SetOrdinal(0);

        List<string> tableHeaders = new List<string>(5);
        //tableHeaders.Add("期間");
        tableHeaders.Add("日期");
        tableHeaders.Add("摘要");
        tableHeaders.Add("轉賬金額");
        tableHeaders.Add("市場費用投入");
        tableHeaders.Add("期末餘額");
        for (int i = 0; i < dt.Columns.Count; i++)
        {
            dt.Columns[i].ColumnName = tableHeaders[i];
        }

        PdfPTable ptable = TableToPDFTable(dt);
        //ptable.TotalWidth = 520f;
        //ptable.LockedWidth = true;
        float[] widths = new float[] { 1f, 2f, 1f, 1f, 1f };
        ptable.SetWidths(widths);

        document.Add(ptable);

        document = this.GetDocumentNotice(document);
        document.Add(Chunk.NEWLINE);
        this.GetDocumentSign(document);

        return document;
    }
開發者ID:fuhongliang,項目名稱:GraduateProject,代碼行數:59,代碼來源:DIStatementExport.aspx.cs

示例11: KTPrintPDF


//.........這裏部分代碼省略.........
                ptablefoot.AddCell(footcell);
                footcell = new PdfPCell(new Phrase(" ", new iTextSharp.text.Font(bf, 10)));
                footcell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居右
                // footcell.HorizontalAlignment = Element.ALIGN_LEFT;//水平居右
                footcell.Colspan = 1;
                footcell.DisableBorderSide(1);
                footcell.DisableBorderSide(2);
                footcell.DisableBorderSide(4);
                footcell.DisableBorderSide(8);
                ptablefoot.AddCell(footcell);

                footcell = new PdfPCell(new Phrase("印表人:" + (System.Web.HttpContext.Current.Session["caller"] as Caller).user_username, new iTextSharp.text.Font(bf, 10)));
                footcell.VerticalAlignment = Element.ALIGN_RIGHT;//水平居右
                footcell.Colspan = 2;
                footcell.DisableBorderSide(1);
                footcell.DisableBorderSide(2);
                footcell.DisableBorderSide(4);
                footcell.DisableBorderSide(8);
                ptablefoot.AddCell(footcell);
                footcell = new PdfPCell(new Phrase(" ", new iTextSharp.text.Font(bf, 10)));
                footcell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居右
                // footcell.HorizontalAlignment = Element.ALIGN_LEFT;//水平居右
                footcell.Colspan = 3;
                footcell.DisableBorderSide(1);
                footcell.DisableBorderSide(2);
                footcell.DisableBorderSide(4);
                footcell.DisableBorderSide(8);
                ptablefoot.AddCell(footcell);

                footcell = new PdfPCell(new Phrase("主管簽核:__________________", new iTextSharp.text.Font(bf, 10)));
                footcell.VerticalAlignment = Element.ALIGN_RIGHT;//字體水平居右
                footcell.Colspan = 2;
                footcell.DisableBorderSide(1);
                footcell.DisableBorderSide(2);
                footcell.DisableBorderSide(4);
                footcell.DisableBorderSide(8);
                ptablefoot.AddCell(footcell);


                #endregion
                if (store.Count == 0)
                {
                    document = new Document(PageSize.A4.Rotate());
                    if (!document.IsOpen())
                    {
                        document.Open();
                    }
                    cell = new PdfPCell(new Phrase(" ", font));
                    cell.Colspan = 4;
                    cell.VerticalAlignment = Element.ALIGN_CENTER;//字體水平居左
                    cell.DisableBorderSide(8);
                    ptable.AddCell(cell);

                    cell = new PdfPCell(new Phrase("此庫調單庫調數據不存在!", font));
                    cell.Colspan = 7;
                    cell.DisableBorderSide(4);
                    cell.VerticalAlignment = Element.ALIGN_CENTER;//字體水平居左
                    ptable.AddCell(cell);


                    // document.Add(ptable);
                    //document.Add(ptablefoot); 
                    newFileName = newPDFName + "_part" + index++ + "." + "pdf";
                    pdf.ExportDataTableToPDF(_dtBody, false, newFileName, arrColWidth, ptable, ptablefoot, "", "", 10, uint.Parse(store.Count.ToString()));/*第一7是列,第二個是行*/
                    pdfList.Add(newFileName);

                }
                else
                {
                    newFileName = newPDFName + "_part" + index++ + "." + "pdf";

                    pdf.ExportDataTableToPDF(_dtBody, false, newFileName, arrColWidth, ptable, ptablefoot, "", "", 10, uint.Parse(store.Count.ToString()));/*第一7是列,第二個是行*/
                    pdfList.Add(newFileName);

                }


                //newFileName = newPDFName + "_part" + index++ + "." + "pdf";
                //pdf.ExportDataTableToPDF(newFileName, ptable, "", "");
                //pdfList.Add(newFileName);

                //document.Add(ptable);
                //document.NewPage();
                newFileName = newPDFName + "." + "pdf";
                pdf.MergePDF(pdfList, newFileName);

                Response.Clear();
                Response.Charset = "gb2312";
                Response.ContentEncoding = System.Text.Encoding.UTF8;
                Response.AddHeader("Content-Disposition", "attach-ment;filename=" + filename + ".pdf");
                Response.WriteFile(newFileName);

            }
            catch (Exception)
            {

                throw;
            }

        }
開發者ID:lxh2014,項目名稱:gigade-net,代碼行數:101,代碼來源:WareHouseController.cs

示例12: CountBookPDF


//.........這裏部分代碼省略.........

                cell = new PdfPCell(new Phrase("", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.Colspan = 10;
                cell.DisableBorderSide(1);
                cell.DisableBorderSide(2);
                // cell.DisableBorderSide(4);
                //cell.DisableBorderSide(8);
                ptable.AddCell(cell);


                #endregion
                #region 表頭
                cell = new PdfPCell(new Phrase("編號", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);

                cell = new PdfPCell(new Phrase("條碼", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);



                cell = new PdfPCell(new Phrase("料位", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);

                cell = new PdfPCell(new Phrase("現有庫存", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);

                cell = new PdfPCell(new Phrase("盤點數量", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);
                cell = new PdfPCell(new Phrase("效期控製", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);
                cell = new PdfPCell(new Phrase("品名", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);

                cell = new PdfPCell(new Phrase("規格", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);
                cell = new PdfPCell(new Phrase("細項編號", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);
                cell = new PdfPCell(new Phrase("備註", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                ptable.AddCell(cell);
                #endregion
                #endregion
                document = new Document(PageSize.A4.Rotate());
                if (!document.IsOpen())
                {
                    document.Open();
                }
                cell = new PdfPCell(new Phrase(" ", font));
                cell.Colspan = 4;
                cell.VerticalAlignment = Element.ALIGN_CENTER;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);

                cell = new PdfPCell(new Phrase("此工作代號無數據!", font));
                cell.Colspan = 3;
                cell.DisableBorderSide(4);
                cell.VerticalAlignment = Element.ALIGN_CENTER;//字體水平居左
                ptable.AddCell(cell);
                cell = new PdfPCell(new Phrase(" ", font));
                cell.Colspan = 3;
                cell.VerticalAlignment = Element.ALIGN_CENTER;//字體水平居左
                //cell.DisableBorderSide(8);
                ptable.AddCell(cell);


                // document.Add(ptable);
                //document.Add(ptablefoot); 
                newFileName = newPDFName + "_part" + index++ + "." + "pdf";
                pdf.ExportDataTableToPDF(_dtBody, false, newFileName, arrColWidth, ptable, ptablefoot, "", "", 10, uint.Parse(_dtBody.Rows.Count.ToString()));/*第一7是列,第二個是行*/
                pdfList.Add(newFileName);

            }
            newFileName = newPDFName + "." + "pdf";
            pdf.MergePDF(pdfList, newFileName);

            Response.Clear();
            Response.Charset = "gb2312";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.AddHeader("Content-Disposition", "attach-ment;filename=" + filename + ".pdf");
            Response.WriteFile(newFileName);
        }
開發者ID:lxh2014,項目名稱:gigade-net,代碼行數:101,代碼來源:WareHouseController.cs

示例13: AseldPDFS


//.........這裏部分代碼省略.........
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);

                cell = new PdfPCell(new Phrase("本次撿貨量", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);
                cell = new PdfPCell(new Phrase("製造日期", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);
                //cell = new PdfPCell(new Phrase("撿貨料位編號", new iTextSharp.text.Font(bf, 8)));
                //cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                //cell.DisableBorderSide(8);
                //ptable.AddCell(cell);
                cell = new PdfPCell(new Phrase("有效日期", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);
                cell = new PdfPCell(new Phrase("條碼", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);
                
               
                cell = new PdfPCell(new Phrase("細項編號", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);

                cell = new PdfPCell(new Phrase("訂貨量", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);

                cell = new PdfPCell(new Phrase("已撿貨量", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);

                cell = new PdfPCell(new Phrase("待撿貨量", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);
                


                //cell = new PdfPCell(new Phrase("創建時間", new iTextSharp.text.Font(bf, 8)));
                //cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                //ptable.AddCell(cell);

                cell = new PdfPCell(new Phrase("備註", new iTextSharp.text.Font(bf, 12)));
                cell.VerticalAlignment = Element.ALIGN_LEFT;//字體水平居左
                ptable.AddCell(cell);
                #endregion
                document = new Document(PageSize.A4.Rotate());
                if (!document.IsOpen())
                {
                    document.Open();
                }
                cell = new PdfPCell(new Phrase(" ", font));
                cell.Colspan = 5;
                cell.VerticalAlignment = Element.ALIGN_CENTER;//字體水平居左
                cell.DisableBorderSide(8);
                ptable.AddCell(cell);

                cell = new PdfPCell(new Phrase("此工作代號無數據!", font));
                cell.Colspan = 9;
                cell.DisableBorderSide(4);
                cell.VerticalAlignment = Element.ALIGN_CENTER;//字體水平居左
                ptable.AddCell(cell);


                // document.Add(ptable);
                //document.Add(ptablefoot); 
                newFileName = newPDFName + "_part" + index++ + "." + "pdf";
                pdf.ExportDataTableToPDF(_dtBody, false, newFileName, arrColWidth, ptable, ptablefoot, "", "", 12, uint.Parse(_dtBody.Rows.Count.ToString()));/*第一7是列,第二個是行*/
                pdfList.Add(newFileName);

            }
            //else
            //{
            //    newFileName = newPDFName + "_part" + index++ + "." + "pdf";

            //    pdf.ExportDataTableToPDF(_dtBody, false, newFileName, arrColWidth, ptable, ptablefoot, "", "", 11, uint.Parse(_dtBody.Rows.Count.ToString()));/*第一7是列,第二個是行*/
            //    pdfList.Add(newFileName);

            //}

            newFileName = newPDFName + "." + "pdf";
            pdf.MergePDF(pdfList, newFileName);

            Response.Clear();
            Response.Charset = "gb2312";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.AddHeader("Content-Disposition", "attach-ment;filename=" + filename + ".pdf");
            Response.WriteFile(newFileName);

        }
開發者ID:lxh2014,項目名稱:gigade-net,代碼行數:101,代碼來源:WareHouseController.cs

示例14: GenerateInvoicePDF

        private void GenerateInvoicePDF()
        {
            Document document = new Document(PageSize.A4, 20f, 20f, 20f, 20f);
            try
            {
                if (!Directory.Exists(InvoiceFolderPath))
                {
                    Directory.CreateDirectory(InvoiceFolderPath);
                }

                PdfWriter.GetInstance(document, new FileStream(string.Format(InvoiceFolderPath + @"/Invoice{0}.pdf", txtInvoiceNumber.Text), FileMode.Create));
                document.Open();
                //Tables for Logo and Invoice Details
                PdfPTable outerHeader = new PdfPTable(2);
                outerHeader.DefaultCell.BorderWidth = 0;
                outerHeader.TotalWidth = 750f;
                outerHeader.WidthPercentage = 100;
                outerHeader.SpacingAfter = 20f;
                outerHeader.HorizontalAlignment = Element.ALIGN_LEFT;
                PdfPTable pdfCompanyTable = CreateCompanyGrid();
                PdfPTable pdfInvoiceTable = CreateInvoiceGrid();
                outerHeader.AddCell(pdfCompanyTable);
                outerHeader.AddCell(pdfInvoiceTable);

                //Tables for Billing and Shipping Address
                PdfPTable outerAddress = new PdfPTable(2);
                outerAddress.DefaultCell.BorderWidth = 0;
                outerAddress.TotalWidth = 750f;
                outerAddress.WidthPercentage = 100;
                outerAddress.SpacingAfter = 10f;
                outerAddress.HorizontalAlignment = Element.ALIGN_LEFT;
                PdfPTable pdfBillingAddressTable = CreateBillingAddressGrid();
                outerAddress.AddCell(pdfBillingAddressTable);
                PdfPTable pdfShippingAddressTable = CreateShippingAddressGrid();
                outerAddress.AddCell(pdfShippingAddressTable);

                //Product Table
                PdfPTable pdfProductTable = CreateProductsGrid();

                //Tables for Authorized Signatory and Invoice Amounts
                PdfPTable outerInvoiceDetails = new PdfPTable(2);
                outerInvoiceDetails.DefaultCell.BorderWidth = 0;
                outerInvoiceDetails.TotalWidth = 750f;
                outerInvoiceDetails.WidthPercentage = 100;
                outerInvoiceDetails.SpacingAfter = 20f;
                outerInvoiceDetails.HorizontalAlignment = Element.ALIGN_LEFT;
                PdfPTable pdfAuthorizedSignatoryTable = CreateAuthorizedSignatoryGrid();
                outerInvoiceDetails.AddCell(pdfAuthorizedSignatoryTable);
                PdfPTable pdfinvoiceAmountTable = CreateInvoiceAmountDetailsGrid();
                outerInvoiceDetails.AddCell(pdfinvoiceAmountTable);
                PdfPTable pdfNotes = CreateNotesGrid();
                //Adding all tables to the document
                document.Add(outerHeader);
                document.Add(outerAddress);
                document.Add(pdfProductTable);
                document.Add(outerInvoiceDetails);
                document.Add(pdfNotes);
                document.Close();
            }
            catch (Exception ex)
            {
                if (document.IsOpen())
                {
                    document.CloseDocument();
                }

                MessageBox.Show("Error previwing Invoice :" + ex.Message);
            }
        }
開發者ID:UmeshTayade,項目名稱:SleekBill,代碼行數:69,代碼來源:AddEditInvoice.cs

示例15: PopulateBarCode


//.........這裏部分代碼省略.........
            PdfWriter pdfWriter = PdfWriter.GetInstance(document, new FileStream(Server.MapPath("~") + "/Handler/BarCode_" + TimeStamp + ".pdf", FileMode.Create));
            document.Open();
            PdfContentByte pdfContentByte = pdfWriter.DirectContent;
            iTextSharp.text.Image img;

            if (objData != null)
            {
                int Kounter = 0;
                for (int i = 0; i < objData.Count; i++)
                {
                    int PurchaseQuantity = (int)objData[i].Quantity;

                    for (int ii = 0; ii < PurchaseQuantity; ii++)
                    {
                        if (Kounter > 0)
                            document.NewPage();

                        PdfPTable table = new PdfPTable(2);
                        //table.TotalWidth = 176f;
                        //fix the absolute width of the table
                        //table.LockedWidth = true;

                        //relative col widths in proportions
                        //float[] widths = new float[] { 1f, 1f };
                        //table.SetWidths(widths);
                        table.HorizontalAlignment = 1;
                        //leave a gap before and after the table
                        //table.SpacingBefore = 1f;
                        //table.SpacingAfter = 1f;
                        table.WidthPercentage = 95;

                        PdfPCell cell = new PdfPCell(new Phrase(objData[i].Brand, new Font(Font.FontFamily.HELVETICA, 3f, Font.BOLD)));
                        cell.Colspan = 2;
                        cell.Border = 0;
                        cell.Padding = 0f;
                        cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right
                        table.AddCell(cell);

                        cell = new PdfPCell(new Phrase(objData[i].ProductName, new Font(Font.FontFamily.HELVETICA, 2f, Font.NORMAL)));
                        cell.Colspan = 2;
                        cell.Border = 0;
                        cell.Padding = 0f;
                        cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right
                        table.AddCell(cell);

                        cell = new PdfPCell(AddSize(objData[i].SizeName));
                        cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right
                        cell.Border = 0;
                        cell.Padding = 0f;
                        table.AddCell(cell);

                        cell = new PdfPCell(new Phrase("€ " + string.Format("{0:0.00}", objData[i].Price), new Font(Font.FontFamily.HELVETICA, 4f, Font.BOLD)));
                        cell.HorizontalAlignment = 2; //0=Left, 1=Centre, 2=Right
                        cell.Border = 0;
                        cell.Padding = .5f;
                        table.AddCell(cell);

                        pdfContentByte = pdfWriter.DirectContent;
                        img = GetBarcode128(pdfContentByte, objData[i].BarCode, false, Barcode.CODE128);

                        cell = new PdfPCell(); //new Phrase(new Chunk(img, 0, 0)));
                        cell.AddElement(img);
                        cell.Colspan = 2;
                        cell.Border = 0;
                        cell.Padding = 0f;
                        //cell.FixedHeight = img.Height + 200;
                        cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right
                        table.AddCell(cell);

                        document.Add(table);

                        Kounter++;
                    }

                }
                document.Close();

            }

            HttpContext context = HttpContext.Current;
            Response.Clear();
            Response.ContentType = "application/pdf";
            Response.AppendHeader("Content-Disposition", "attachment; filename=Barcode_" + TimeStamp + ".pdf");
            Response.WriteFile(Server.MapPath("~/Handler/BarCode_" + TimeStamp + ".pdf"));
            Response.Flush();
            Response.Close();
            if (File.Exists(Server.MapPath("~/Handler/BarCode_" + TimeStamp + ".pdf")))
            {
                File.Delete(Server.MapPath("~/Handler/BarCode_" + TimeStamp + ".pdf"));
            }

        }
        catch (Exception ex)
        {
            if (document.IsOpen())
                document.Close();
            SendMail.MailMessage("CSWeb > Error > " + (new StackTrace()).GetFrame(0).GetMethod().Name, ex.ToString());
            Response.Write(ex.ToString());
        }
    }
開發者ID:xyzthought,項目名稱:iBeyondZ,代碼行數:101,代碼來源:BarcodePDF.aspx.cs


注:本文中的iTextSharp.text.Document.IsOpen方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。