Add() 공개 메소드

Adds a Chunk, Anchor or another Phrase to this Phrase.
public Add ( Object o ) : bool
o Object an object of type Chunk, Anchor or Phrase
리턴 bool
예제 #1
0
    private void Creo_Cabecera(iTextSharp.text.pdf.PdfWriter writer, iTextSharp.text.Document document)
    {
        PdfPTable t = new PdfPTable(2);

        Single[] arrAnchosC = { 20F, 80F };
        t.SetWidthPercentage(arrAnchosC, iTextSharpText.PageSize.A4);
        t.WidthPercentage = 100;

        iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance(AppDomain.CurrentDomain.BaseDirectory + "App_Themes\\imagenes\\logo_impresion.png");
        PdfPCell c = new PdfPCell(png);

        c.HorizontalAlignment = iTextSharpText.Element.ALIGN_LEFT;
        c.BorderWidth         = 0;

        iTextSharpText.Phrase texto = new iTextSharpText.Phrase();
        texto.Font = iTextSharpText.FontFactory.GetFont("Arial", 14, iTextSharpText.Element.ALIGN_CENTER);
        texto.Add(new iTextSharpText.Phrase("Reporte de Solicitudes de Prestamos a Liquidar\n\n"));

        texto.Font = iTextSharpText.FontFactory.GetFont("Arial", 8, iTextSharpText.Element.ALIGN_CENTER);
        texto.Add(new iTextSharpText.Phrase("Fecha Reporte: " + lst[0].Fecha_Informe.ToString("dd/MM/yyyy") + "   N° Reporte: " + lst[0].nroInforme));

        PdfPCell c1 = new PdfPCell(texto);

        c1.HorizontalAlignment = iTextSharpText.Element.ALIGN_CENTER;
        c1.BorderWidth         = 0;

        t.AddCell(c);
        t.AddCell(c1);

        iTextSharpText.Paragraph Cabecera = new iTextSharpText.Paragraph();
        Cabecera.Add(t);

        document.Add(Cabecera);
        document.Add(iTextSharpText.Chunk.NEWLINE);
    }
예제 #2
0
// ---------------------------------------------------------------------------    
    /**
     * Creates a Phrase containing information about a movie.
     * @param    movie    the movie for which you want to create a Paragraph
     */
    public Phrase CreateMovieInformation(Movie movie) {
      Phrase p = new Phrase();
      p.Font = FilmFonts.NORMAL;
      p.Add(new Phrase("Title: ", FilmFonts.BOLDITALIC));
      p.Add(PojoToElementFactory.GetMovieTitlePhrase(movie));
      p.Add(" ");
      if (!string.IsNullOrEmpty(movie.OriginalTitle)) {
        p.Add(new Phrase("Original title: ", FilmFonts.BOLDITALIC));
        p.Add(PojoToElementFactory.GetOriginalTitlePhrase(movie));
        p.Add(" ");
      }
      p.Add(new Phrase("Country: ", FilmFonts.BOLDITALIC));
      foreach (Country country in movie.Countries) {
        p.Add(PojoToElementFactory.GetCountryPhrase(country));
        p.Add(" ");
      }
      p.Add(new Phrase("Director: ", FilmFonts.BOLDITALIC));
      foreach (Director director in movie.Directors) {
        p.Add(PojoToElementFactory.GetDirectorPhrase(director));
        p.Add(" ");
      }
      p.Add(new Chunk("Year: ", FilmFonts.BOLDITALIC));
      p.Add(new Chunk(movie.Year.ToString(), FilmFonts.NORMAL));
      p.Add(new Chunk(" Duration: ", FilmFonts.BOLDITALIC));
      p.Add(new Chunk(movie.Duration.ToString(), FilmFonts.NORMAL));
      p.Add(new Chunk(" minutes", FilmFonts.NORMAL));
      p.Add(new LineSeparator(0.3f, 100, null, Element.ALIGN_CENTER, -2));
      return p;
    }    
예제 #3
0
// ---------------------------------------------------------------------------    
    /**
     * Creates a Phrase containing the name of a Director.
     * @param director a Director object
     * @return a Phrase object
     */
    public static Phrase GetDirectorPhrase(Director director) {
      Phrase phrase = new Phrase();
      phrase.Add(new Chunk(director.Name, FilmFonts.BOLD));
      phrase.Add(new Chunk(", ", FilmFonts.BOLD));
      phrase.Add(new Chunk(director.GivenName, FilmFonts.NORMAL));
      return phrase;
    }
예제 #4
0
 private iText.Phrase MakePhrase(string lead, string text)
 {
     iText.Chunk leadChunk = new iText.Chunk(lead);
     leadChunk.Font = iText.FontFactory.GetFont(baseFont, normalSize, iText.Font.BOLD);
     iText.Chunk  textChunck = new iText.Chunk(text);
     iText.Phrase phrase     = new iText.Phrase();
     phrase.Add(leadChunk);
     phrase.Add(textChunck);
     return(phrase);
 }
 public static Paragraph ParaCommonInfoAllBold(string field, string value)
 {
     Paragraph pr = new Paragraph();
     Phrase phr = new Phrase();
     Chunk chk1 = new Chunk(field, FontConfig.BoldFont);
     Chunk chk2 = new Chunk(value, FontConfig.BoldFont);
     phr.Add(chk1);
     phr.Add(chk2);
     pr.Add(phr);
     return pr;
 }
예제 #6
0
        public void AddRow(PdfPTable t, string fname, string lname, string phone, int pid)
        {
            var bc = new Barcode39();
            bc.X = 1.2f;
            bc.Font = null;
            bc.Code = pid.ToString();
            var img = bc.CreateImageWithBarcode(dc, null, null);
            var p1 = new Phrase();
            p1.Add(new Chunk(img, 0, 0));
            p1.Add(new Phrase("\n\n" + fname + " " + lname + " (" + pid + ")", smallfont));
            var c = new PdfPCell(p1);
            c.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
            c.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
            c.Border = PdfPCell.NO_BORDER;
            c.FixedHeight = H * 72f;

            var t2 = new PdfPTable(2);
            t2.WidthPercentage = 100f;
            t2.DefaultCell.Border = PdfPCell.NO_BORDER;

            var cc = new PdfPCell(new Phrase(fname, font));
            cc.Border = PdfPCell.NO_BORDER;
            cc.Colspan = 2;
            t2.AddCell(cc);

            cc = new PdfPCell(new Phrase(lname, font));
            cc.Border = PdfPCell.NO_BORDER;
            cc.Colspan = 2;
            t2.AddCell(cc);

            var pcell = new PdfPCell(new Phrase(pid.ToString(), smallfont));
            pcell.Border = PdfPCell.NO_BORDER;
            pcell.HorizontalAlignment = Element.ALIGN_LEFT;
            t2.AddCell(pcell);

            pcell = new PdfPCell(new Phrase(phone.FmtFone(), smallfont));
            pcell.Border = PdfPCell.NO_BORDER;
            pcell.HorizontalAlignment = Element.ALIGN_RIGHT;
            t2.AddCell(pcell);

            var cell = new PdfPCell(t2);
            cell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
            cell.PaddingLeft = 8f;
            cell.PaddingRight = 8f;
            cell.Border = PdfPCell.NO_BORDER;
            cell.FixedHeight = H * 72f;

            t.AddCell(c);
            t.AddCell("");
            t.AddCell(cell);
            t.AddCell("");
            t.AddCell(cell);
        }
예제 #7
0
 internal void AddItemLine(string item, string subItems)
 {
     iText.Chunk itemChunck = new iText.Chunk(item);
     itemChunck.Font = iText.FontFactory.GetFont(baseFont, leadSize, iText.Font.BOLD, iText.BaseColor.BLACK);
     iText.Chunk subItemsChunck = new iText.Chunk(subItems);
     subItemsChunck.Font = iText.FontFactory.GetFont(baseFont, normalSize, iText.Font.NORMAL, iText.BaseColor.BLACK);
     iText.Phrase phrase = new iText.Phrase();
     phrase.Add(itemChunck);
     phrase.Add(subItemsChunck);
     iText.Paragraph paragraph = new iText.Paragraph(phrase);
     document.Add(paragraph);
 }
예제 #8
0
// ---------------------------------------------------------------------------
    /**
     * Creates a Phrase with the name and given name of a director using different fonts.
     * @param r the DbDataReader containing director records.
     */
    protected virtual Phrase CreateDirectorPhrase(DbDataReader r) {
      Phrase director = new Phrase();
      director.Add(
        new Chunk(r["name"].ToString(), BOLD_UNDERLINED)
      );
      director.Add(new Chunk(",", BOLD_UNDERLINED));
      director.Add(new Chunk(" ", NORMAL));
      director.Add(
        new Chunk(r["given_name"].ToString(), NORMAL)
      );
      return director;
    }
예제 #9
0
// ---------------------------------------------------------------------------
    /**
     * Creates a Phrase with the name and given name of a director using different fonts.
     * @param    rs    the ResultSet containing director records.
     */
    protected override Phrase CreateDirectorPhrase(DbDataReader r) {
      Phrase director = new Phrase();
      Chunk name = new Chunk(r["name"].ToString(), BOLD);
      name.SetUnderline(0.2f, -2f);
      director.Add(name);
      director.Add(new Chunk(",", BOLD));
      director.Add(new Chunk(" ", NORMAL));
      director.Add(
        new Chunk(r["given_name"].ToString(), NORMAL)
      );
      director.Leading = 24;
      return director;
    }
    protected PdfPTable CreateSectionDetail()
    {
        Section section = GetCurrentSection();
        PdfPTable nestedTable = null;

        if (section.Type == WebConstants.SectionTypes.MULTIPLE_SELECT_LIST)
        {
            textCount++;
            nestedTable = new PdfPTable(section.RepeatColumns);
            nestedTable.DefaultCell.Border = Rectangle.NO_BORDER;
            nestedTable.WidthPercentage = 100;

            int index = 0;
            int limit = section.Details.Count/section.RepeatColumns;
            if(section.Details.Count%section.RepeatColumns != 0)
            {
                limit++;
            }
            for (int i = 0; i < section.RepeatColumns ; i++)
            {
                Phrase phrase = new Phrase();
                for(int j=0; j < limit && index < section.Details.Count;j++)
                {
                    if (j > 0)
                    {
                        phrase.Add(new Chunk("\n"));
                    }
                    if (section.Details[index].Selected)
                    {
                        phrase.Add(new Chunk(AddCheckedCheckBox(),0,0));
                    }
                    else
                    {
                        phrase.Add(new Chunk(AddCheckBox(), 0, 0));
                    }
                    //phrase.Add(new Chunk(" " + section.Details[index].Text));
                    phrase.Add(new Chunk(" " + section.Details[index].Text, FontFactory.GetFont("Arial", 9)));
                    index++;
                }
                nestedTable.AddCell(phrase);
            }
        }
        else
        {
            nestedTable = new PdfPTable(1);
        }
        return nestedTable;
    }
예제 #11
0
// ---------------------------------------------------------------------------    
    /**
     * Creates a PDF document.
     * @param stream Stream for the new PDF document
     */
    public void CreatePdf(Stream stream) {
      string RESOURCE = Utility.ResourcePosters;
      // step 1
      using (Document document = new Document()) {
        // step 2
        PdfWriter writer = PdfWriter.GetInstance(document, stream);
        // step 3
        document.Open();
        // step 4
        Phrase phrase;
        Chunk chunk;
        PdfAnnotation annotation;
        foreach (Movie movie in PojoFactory.GetMovies()) {
          phrase = new Phrase(movie.MovieTitle);
          chunk = new Chunk("\u00a0\u00a0");
          annotation = PdfAnnotation.CreateFileAttachment(
            writer, null,
            movie.MovieTitle, null,
            Path.Combine(RESOURCE, movie.Imdb + ".jpg"),
            string.Format("img_{0}.jpg", movie.Imdb)
          );
          annotation.Put(PdfName.NAME, new PdfString("Paperclip"));
          chunk.SetAnnotation(annotation);
          phrase.Add(chunk);
          document.Add(phrase);
          document.Add(PojoToElementFactory.GetDirectorList(movie));
          document.Add(PojoToElementFactory.GetCountryList(movie));
        }
      }
    }
예제 #12
0
        public void TextLeadingTest() {
            String file = "phrases.pdf";

            Document document = new Document();
            PdfWriter writer = PdfWriter.GetInstance(document, File.Create(OUTPUT_FOLDER + file));
            document.Open();

            Phrase p1 = new Phrase("first, leading of 150");
            p1.Leading = 150;
            document.Add(p1);
            document.Add(Chunk.NEWLINE);

            Phrase p2 = new Phrase("second, leading of 500");
            p2.Leading = 500;
            document.Add(p2);
            document.Add(Chunk.NEWLINE);

            Phrase p3 = new Phrase();
            p3.Add(new Chunk("third, leading of 20"));
            p3.Leading = 20;
            document.Add(p3);

            document.Close();

            // compare
            CompareTool compareTool = new CompareTool();
            String errorMessage = compareTool.CompareByContent(OUTPUT_FOLDER + file, TEST_RESOURCES_PATH + file, OUTPUT_FOLDER, "diff");
            if (errorMessage != null) {
                Assert.Fail(errorMessage);
            }
        }
        public void Go()
        {
            // GetClassOutputPath() implementation left out for brevity
            var outputFile = Helpers.IO.GetClassOutputPath(this);

            using (FileStream stream = new FileStream(
                outputFile, 
                FileMode.Create, 
                FileAccess.Write))
            {
                Random random = new Random();

                StreamUtil.AddToResourceSearch(("iTextAsian.dll"));
                string chunkText = " 你好世界 你好你好,";
                var font = new Font(BaseFont.CreateFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED), 12);

                using (Document document = new Document())
                {
                    PdfWriter.GetInstance(document, stream);
                    document.Open();
                    Phrase phrase = new Phrase();
                    Chunk chunk = new Chunk("", font);
                    for (var i = 0; i < 1000; ++i)
                    {
                        var asterisk = new String('*', random.Next(1, 20));
                        chunk.Append(
                            string.Format("[{0}] {1} ", asterisk, chunkText) 
                        );
                    }
                    chunk.SetSplitCharacter(new CustomSplitCharacter());
                    phrase.Add(chunk);
                    document.Add(phrase);
                }
            }
        }
예제 #14
0
 // ---------------------------------------------------------------------------          
 public void Write(Stream stream)
 {
     // step 1
     using (Document document = new Document())
     {
         // step 2
         PdfWriter writer = PdfWriter.GetInstance(document, stream);
         // step 3
         document.Open();
         // step 4
         Phrase phrase;
         Chunk chunk;
         foreach (Movie movie in PojoFactory.GetMovies())
         {
             phrase = new Phrase(movie.MovieTitle);
             chunk = new Chunk("\u00a0");
             chunk.SetAnnotation(PdfAnnotation.CreateText(
               writer, null, movie.MovieTitle,
               string.Format(INFO, movie.Year, movie.Duration),
               false, "Comment"
             ));
             phrase.Add(chunk);
             document.Add(phrase);
             document.Add(PojoToElementFactory.GetDirectorList(movie));
             document.Add(PojoToElementFactory.GetCountryList(movie));
         }
     }
 }
예제 #15
0
        private static PdfPCell CreateDetailTitleCell(String text)
        {
            PdfPCell cell = new PdfPCell(new Phrase(text));
            Phrase phrase = new Phrase();
            phrase.Font = FontFactory.GetFont(FontFactory.HELVETICA, 9f, Font.UNDERLINE);
            phrase.Add(new Phrase(text));
            cell.Phrase = phrase;
            cell.BorderWidth = 0;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.Colspan = 3;

            return cell;
        }
예제 #16
0
        public bool AddCell(PdfPTable t, string desc, int code)
        {
            var bc = new Barcode39();
            bc.X = 1.2f;
            bc.Font = null;
            bc.Code = code.ToString();
            var img = bc.CreateImageWithBarcode(dc, null, null);
            var p = new Phrase();
            p.Add(new Chunk(img, 0, 0));
            p.Add(new Phrase("\n" + code.ToString().Insert(3," "), font));
            p.Add(new Phrase("\n" + desc, smallfont));
            var c = new PdfPCell(p);
            c.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
            c.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
            c.Border = PdfPCell.NO_BORDER;
            c.FixedHeight = H * 72f;

            t.AddCell(c);
            n++;
            if (n % 3 > 0)
                t.AddCell("");
            return n % 3 == 0;
        }
예제 #17
0
        public PdfPCell GetLabelCell()
        {
            // Create a new Phrase and add the image to it
            var cellContent = new Phrase();

            foreach (var img in _images)
            {
                var pdfImg = iTextSharp.text.Image.GetInstance(img);
                cellContent.Add(new Chunk(pdfImg, 0, 0));
            }

            foreach (var txt in _textChunks)
            {
                var font = FontFactory.GetFont(txt.FontName, BaseFont.CP1250, txt.EmbedFont, txt.FontSize, txt.FontStyle);
                cellContent.Add(new Chunk("\n" + txt.Text, font));
            }

            //Create a new cell specifying the content
            var cell = new PdfPCell(cellContent);
            cell.HorizontalAlignment = (int)_hAlign;
            cell.VerticalAlignment = Element.ALIGN_TOP;

            return cell;
        }
예제 #18
0
        private void PrintDealers(int stateId, string[] bookIds)
        {
            DataTable dealers = TaxController.GetDealersForPdf(stateId, bookIds);

            foreach (DataRow row in dealers.Rows)
            {
                _dealerMachineCostAmount = 0.0m;
                _dealerTaxableAmount = 0.0m;
                _dealerTaxAmount = 0.0m;

                int dealerId = Convert.ToInt32(row[VwTax.Columns.DealerId]);
                String dealerName = Convert.ToString(row[VwTax.Columns.DealerName]).ToUpper();

                PdfPCell dealerCell = new PdfPCell();
                dealerCell.Colspan = COLUMN_COUNT;
                Phrase phrase = new Phrase();
                phrase.Font = FontFactory.GetFont(FontFactory.TIMES_BOLD, 10f, Font.NORMAL);
                phrase.Add(dealerName);
                dealerCell.Phrase = phrase;
                _table.AddCell(dealerCell);

                DataTable lineItems = TaxController.GetItemsToPay(stateId, bookIds, dealerId);

                foreach (DataRow lineItem in lineItems.Rows)
                    PrintSingleItem(lineItem);

                _table.AddCell(CreateCell("Totals", Element.ALIGN_LEFT));
                _table.AddCell(CreateBlankCell());
                _table.AddCell(CreateBlankCell());
                _table.AddCell(CreateSummaryCell(_dealerMachineCostAmount));
                _table.AddCell(CreateSummaryCell(_dealerTaxableAmount));
                _table.AddCell(CreateBlankCell());
                _table.AddCell(CreateSummaryCell(_dealerTaxAmount));
                _table.AddCell(CreateBlankRow());
            }
        }
예제 #19
0
        private void AddRow(PdfPTable t, MemberInfo p, BaseColor color)
        {
            t.DefaultCell.BackgroundColor = color;

            var ph = new Phrase();
            ph.Add(new Chunk(p.Name, font));
            ph.Add(new Chunk($"\n  ({p.PeopleId})", smallfont));
            t.AddCell(ph);

            var sb = new StringBuilder();
            AddLine(sb, p.Address);
            AddLine(sb, p.Address2);
            AddLine(sb, p.CityStateZip);
            AddPhone(sb, p.HomePhone, "h ");
            if ((p.Age ?? 0) <= 18 && p.Parents != null)
            {
                var a = p.Parents.Replace(", c ", "|c ").Split('|');
                foreach (var li in a)
                    AddLine(sb, li);
            }
            else
                AddPhone(sb, p.CellPhone, "c ");

            t.AddCell(new Phrase(sb.ToString(), font));

            sb = new StringBuilder();
            AddLine(sb, p.MemberStatus);
            AddLine(sb, p.FamMemberThis ? "Family member is member here" : "");
            AddLine(sb, p.ActiveOther ? "Active in another church" : "Not Active in another church");
            t.AddCell(new Phrase(sb.ToString(), font));
            t.AddCell(new Phrase(p.MemberType, font));
            t.AddCell(new Phrase(p.Medical, font));
        }
        private static Paragraph GiveHeaderParagraph(this DataSection ds)
        {
            var widths = ds.ColumnWidths.ToArray();
            var splitted = ds.ColumnHeaders.Select((s, i) =>
            {
                return s.Length > widths[i] ?
                    s.Split(new char[] { ' ' }, StringSplitOptions.None).ToList() :
                    (new[] { s }).ToList();
            }).ToList();

            int maxLength = splitted.Max(arr => arr.Count);

            splitted.ForEach(arr =>
            {
                while (arr.Count < maxLength)
                {
                    arr.Insert(0, "");
                }
            });

            Paragraph pg = new Paragraph();
            pg.SpacingBefore = TextSharpFonts.DataBoldFont.Size;
            pg.Leading = TextSharpFonts.DataBoldFont.Size;
            for (int i = 0; i < maxLength; i++)
            {
                Phrase p = new Phrase();
                for (int j = 0; j < splitted.Count; j++)
                {
                    p.Add(new Chunk(splitted[j][i].Center(widths[j]), TextSharpFonts.DataBoldFont));
                }
                p.Add(Chunk.NEWLINE);
                pg.Add(p);
            }
            return pg;
        }
        public static IEnumerable<IElement> GetElements(this DataSection ds)
        {
            var elems = new List<IElement>();

            // header, if needed
            if (ds.ColumnHeaders.Any())
            {
                elems.Add(ds.GiveHeaderParagraph());
            }

            // process rows
            foreach (IEnumerable<string> ies in ds.Rows)
            {
                // process items
                Phrase p = new Phrase();
                p.Leading = TextSharpFonts.DataFont.Size * 1.1f;
                int j = 0;
                foreach (string s in ies)
                {
                    p.Add(new Chunk(s.Center(ds.ColumnWidths.ToArray()[j]), TextSharpFonts.DataFont));
                    j++;
                }
                p.Add(Chunk.NEWLINE);
                elems.Add(p);
            }
            return elems;
        }
            public void OnStartPage(PdfWriter writer, Document document)
            {
                var pessoaJuridica = empresa.Pessoa as IPessoaJuridica;

                Chunk imagem;

                if (!string.IsNullOrEmpty(pessoaJuridica.Logomarca))
                {
                    var imghead = iTextSharp.text.Image.GetInstance(HttpContext.Current.Server.MapPath(pessoaJuridica.Logomarca));
                    imagem = new Chunk(imghead, 0, 0);
                }
                else
                    imagem = new Chunk("");

                var dadosEmpresa = new Phrase();

                dadosEmpresa.Add(pessoaJuridica.NomeFantasia + Environment.NewLine);

                if (pessoaJuridica.Enderecos.Count > 0)
                {
                    var endereco = pessoaJuridica.Enderecos[0];
                    dadosEmpresa.Add(endereco.ToString());
                }

                if (pessoaJuridica.Telefones.Count > 0)
                {
                    var telefone = pessoaJuridica.Telefones[0];
                    dadosEmpresa.Add("Telefone " + telefone);
                }

                var tabelaHeader = new Table(2);
                tabelaHeader.Border = 0;
                tabelaHeader.Width = 100;

                var cell = new Cell(new Phrase(imagem));
                cell.Border = 0;
                cell.Width = 30;

                tabelaHeader.AddCell(cell);

                var cell1 = new Cell(dadosEmpresa);
                cell1.Border = 0;
                cell1.Width = 70;
                tabelaHeader.AddCell(cell1);

                var linhaVazia = new Cell(new Phrase("\n", font2));
                linhaVazia.Colspan = 2;
                linhaVazia.DisableBorderSide(1);

                tabelaHeader.AddCell(linhaVazia);

                document.Add(tabelaHeader);

                // Adicionando linha que informa o número da revista

                var tabelaNumeroDaRevista = new Table(1);
                tabelaNumeroDaRevista.Border = 0;
                tabelaNumeroDaRevista.Width = 100;

                var celulaNumeroDaRevista = new Cell(new Phrase("Processos de clientes publicados na revista de marcas: " + _numeroDaRevistaSelecionada, font3));
                celulaNumeroDaRevista.Border = 0;
                celulaNumeroDaRevista.Width = 70;
                celulaNumeroDaRevista.Colspan = 1;

                tabelaNumeroDaRevista.AddCell(celulaNumeroDaRevista);

                var linhaVaziaNumeroRevista = new Cell(new Phrase("\n", font2));
                linhaVaziaNumeroRevista.Border = 0;
                linhaVaziaNumeroRevista.Width = 70;
                linhaVaziaNumeroRevista.Colspan = 1;
                linhaVaziaNumeroRevista.DisableBorderSide(1);

                tabelaNumeroDaRevista.AddCell(linhaVaziaNumeroRevista);

                document.Add(tabelaNumeroDaRevista);
            }
예제 #23
0
    private void GeneratePDF1()
    {
        log4net.ILog log = log4net.LogManager.GetLogger("ServiceRowDataBound");
        log4net.Config.XmlConfigurator.Configure();

        try
        {
            /*CustomSessionClass objCustomSessionClass = new CustomSessionClass();
            System.Web.UI.HtmlControls.HtmlTable objtbl = objCustomSessionClass._Session;
            */

            System.Web.UI.HtmlControls.HtmlTable objtbl = (System.Web.UI.HtmlControls.HtmlTable)Cache["table"];

            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "inline;filename=results.pdf");
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            StringWriter sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);
            //tblBusinessBankingOnline.RenderControl(hw);
            StringReader sr = new StringReader(sw.ToString());
        Document pdfDoc = new Document(PageSize.A4, 7f, 7f, 7f, 0f);
            HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
            PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
            pdfDoc.Open();
            //Set Header
            //iTextSharp.text.Image imgStlogo = iTextSharp.text.Image.GetInstance(iTextSharp.text.Image.GetInstance(Server.MapPath(@"StG_Master_Logo_RGBold.jpg")));
            //imgStlogo.SetAbsolutePosition(0, pdfDoc.PageSize.Height - imgStlogo.Height);
            //imgStlogo.ScaleToFit(200f, 90f);
                    //imgStlogo.SetAbsolutePosition(0, 750f);
           // pdfDoc.Add(imgStlogo);
            //

        iTextSharp.text.Image imgStlogo = iTextSharp.text.Image.GetInstance(iTextSharp.text.Image.GetInstance(Server.MapPath(@"StG_Master_Logo_RGBold.jpg")));
                PdfPTable pdfTable = new PdfPTable(1);
               // pdfTable.DefaultCell.Border = Rectangle.NO_BORDER;
              //  pdfTable.SplitRows = false;
                imgStlogo.ScaleToFit(183f, 66f);
                PdfPCell imageCell = new PdfPCell(imgStlogo);
                imageCell.Border = 0;
                pdfTable.AddCell(imageCell);
                pdfTable.HorizontalAlignment = Element.ALIGN_LEFT;
                pdfDoc.Add(pdfTable);
                pdfDoc.Add(new Paragraph(""));

           /*  pdfDoc.Add(new Paragraph(" "));
        pdfDoc.Add(new Paragraph(" "));
        pdfDoc.Add(new Paragraph(" "));*/

            iTextSharp.text.Font font18 = iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, 8);
            iTextSharp.text.Chunk bullet = new iTextSharp.text.Chunk("\u2022", font18);
            iTextSharp.text.List list = new iTextSharp.text.List(false, 4);  // true= ordered, false= unordered
            iTextSharp.text.List list1 = new iTextSharp.text.List(false, 4);  // true= ordered, false= unordered

            string amt = "8";
            string atm = "Freedom Business Account";
            var get = Request.QueryString["item"];
            var phrase = new Phrase();

            string strTextData = Environment.NewLine + "Thank you for completing the Business Account Selector tool. You’ll find your results below."
                               + Environment.NewLine + "We understand that no two businesses are the same and we want to help you make the right decisions for your business to be successful."
                               + Environment.NewLine + "Like every great relationship, it starts with a conversation. So if you have any questions or want to take the next steps:" + Environment.NewLine;

            iTextSharp.text.Font FontTypeBold = FontFactory.GetFont("Arial", 8f, iTextSharp.text.Font.BOLD);
            iTextSharp.text.Font FontTypeBoldlarge = FontFactory.GetFont("Arial", 10f, iTextSharp.text.Font.BOLD);
            iTextSharp.text.Font FontType = FontFactory.GetFont("Arial", 8f, iTextSharp.text.Font.NORMAL);
            iTextSharp.text.Font FontTypeSmall = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL);

            phrase = new Phrase();
            phrase.Add(new Chunk("Business Account and Product Selector Results", FontTypeBoldlarge));
            phrase.Add(new Chunk(Environment.NewLine + "Hello " + Request.QueryString["Name"], FontTypeBold));

            phrase.Add(new Chunk(strTextData, FontType));
            pdfDoc.Add(phrase);
            PdfPTable tblCall = new PdfPTable(1);
            tblCall.WidthPercentage = 30f;
            tblCall.HorizontalAlignment = Element.ALIGN_LEFT;
            tblCall.DefaultCell.Border = Rectangle.NO_BORDER;
            iTextSharp.text.Image imgCall = iTextSharp.text.Image.GetInstance(iTextSharp.text.Image.GetInstance(Server.MapPath(@"pdfCTA-1.png")));
            tblCall.AddCell(imgCall);
            pdfDoc.Add(tblCall);
            phrase = new Phrase();
            phrase.Add(new Chunk("To find out what information is needed to become a customer, visit ", FontType));
            pdfDoc.Add(phrase);
            Font link = FontFactory.GetFont("Arial", 8, Font.UNDERLINE, new Color(0, 0, 255));
            Anchor anchor = new Anchor("http://www.stgeorge.com.au/idchecklist", link);
            anchor.Reference = "http://www.stgeorge.com.au/idchecklist";
            pdfDoc.Add(anchor);
            pdfDoc.Add(new Phrase(Environment.NewLine + Environment.NewLine, FontType));

            #region CodeForLastFiveProduct
            PdfPTable pdfpTableAdditionalProduct = new PdfPTable(2);
            pdfpTableAdditionalProduct.WidthPercentage = 100f;
            int[] TableAdditionalProductwidth = { 30, 70 };
            pdfpTableAdditionalProduct.SetWidths(TableAdditionalProductwidth);

            phrase = new Phrase(" " + Environment.NewLine);
            phrase.Add(new Chunk("Business Products", FontTypeBold));
            phrase.Add(Environment.NewLine + " ");
            PdfPCell cellAdditionalProduct = new PdfPCell(phrase);
            cellAdditionalProduct.Colspan = 3;

            //Used to checked Last Five product is selected
            bool isLastFiveProductSelected = false;
            if (get.Contains("f"))
            {
                // pdfDoc.NewPage();
                pdfpTableAdditionalProduct.AddCell(cellAdditionalProduct);
                isLastFiveProductSelected = true;

                PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine + Environment.NewLine + "EFTPOS and merchant facilities", FontTypeBold));
                pdfpTableAdditionalProduct.AddCell(Cell1);
                phrase = new Phrase();
                phrase.Add(new Chunk("Customers being able to pay with a debit card?", FontTypeBold));
                phrase.Add(new Chunk("      and/or", FontType));
                phrase.Add(new Chunk(Environment.NewLine + "Customers being able to pay with a credit card?", FontTypeBold));

                list = new iTextSharp.text.List(false, 8);
                list.ListSymbol = bullet;
                ////////list.Add(new iTextSharp.text.ListItem(new Chunk("With this account, all day-to-day electronic transactions are fee-free",FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("To accept debit and credit cards from customers, whether it’s in person, over the phone or online, St.George has a range of EFTPOS and merchant solutions", FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Get same-day settlement (when the terminal is settled before 9pm Sydney time) on debit and credit card sales, 7 days a week, when linked to a St.George business transaction account", FontType)));

                PdfPCell objCell = new PdfPCell();
                objCell.AddElement(phrase);
                objCell.AddElement(list);
                objCell.AddElement(new Phrase(" "));

                objCell.Colspan = 2;
                pdfpTableAdditionalProduct.AddCell(objCell);

            }
            if (get.Contains("g"))
            {
                if (!isLastFiveProductSelected)
                {
                    //pdfDoc.NewPage();
                    pdfpTableAdditionalProduct.AddCell(cellAdditionalProduct);
                    isLastFiveProductSelected = true;
                }
                PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine + Environment.NewLine + "Equipment finance", FontTypeBold));
                pdfpTableAdditionalProduct.AddCell(Cell1);
                phrase = new Phrase();
                phrase.Add(new Chunk("Purchasing a vehicle?", FontTypeBold));
                phrase.Add(new Chunk("      and/or", FontType));
                phrase.Add(new Chunk(Environment.NewLine + "Purchasing equipment or machinery?", FontTypeBold));

                list = new iTextSharp.text.List(false, 8);
                list.ListSymbol = bullet;
                ////////list.Add(new iTextSharp.text.ListItem(new Chunk("With this account, all day-to-day electronic transactions are fee-free",FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Finance up to 100% of the purchase price for vehicles or equipment", FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Frees up money to run a business, rather than tying up working capital", FontType)));

                PdfPCell objCell = new PdfPCell();
                objCell.AddElement(phrase);
                objCell.AddElement(list);
                //  phrase.Add(new Chunk(Environment.NewLine + "Equipment Finance is offered by St.George Finance Limited ACL 387944."+Environment.NewLine+" Automotive Finance is offered by St.George Finance Limited ACL 387944 and St.George Motor Finance Limited ACL 387946.",FontType));
                //  objCell.AddElement(new Phrase("Equipment Finance by St.George Finance Limited Australian credit licence 387944.The Automotive Finance by St.George Finance Limited and St.George Motor Finance Limited Australian credit licence 387946"));

                var phBecauseText1 = new Phrase();
                phBecauseText1.Add(new Chunk(Environment.NewLine + "Equipment Finance by St.George Finance Limited Australian credit licence 387944.", FontType));
                //phBecauseText1.Add(new Chunk(Environment.NewLine + "Automotive Finance by St.George Finance Limited Australian credit licence 387944 and St.George Motor Finance Limited Australian credit licence 387946.", FontType));
                objCell.AddElement(phBecauseText1);

                objCell.AddElement(new Phrase(" "));

                objCell.Colspan = 3;
                pdfpTableAdditionalProduct.AddCell(objCell);

            }
            if (get.Contains("h"))
            {
                if (!isLastFiveProductSelected)
                {
                   // pdfDoc.NewPage();
                    pdfpTableAdditionalProduct.AddCell(cellAdditionalProduct);
                    isLastFiveProductSelected = true;
                }
                PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine + Environment.NewLine + "Lending for a Business", FontTypeBold));
                pdfpTableAdditionalProduct.AddCell(Cell1);
                phrase = new Phrase();
                phrase.Add(new Chunk("Purchasing a business?", FontTypeBold));
                phrase.Add(new Chunk("      and/or", FontType));
                phrase.Add(new Chunk(Environment.NewLine + "Expanding a business?", FontTypeBold));

                list = new iTextSharp.text.List(false, 8);
                list.ListSymbol = bullet;
                ////////list.Add(new iTextSharp.text.ListItem(new Chunk("With this account, all day-to-day electronic transactions are fee-free",FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("St.George has a number of lending options to give a business a cash injection", FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("This includes both residentially and commercially secured loans or a combination of these", FontType)));

                PdfPCell objCell = new PdfPCell();
                objCell.AddElement(phrase);
                objCell.AddElement(list);
                objCell.AddElement(new Phrase(" "));
                objCell.Colspan = 3;
                pdfpTableAdditionalProduct.AddCell(objCell);

            }
            if (get.Contains("i"))
            {
                if (!isLastFiveProductSelected)
                {
                   // pdfDoc.NewPage();
                    pdfpTableAdditionalProduct.AddCell(cellAdditionalProduct);
                    isLastFiveProductSelected = true;
                }
                PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine + Environment.NewLine + "Bank guarantee", FontTypeBold));
                pdfpTableAdditionalProduct.AddCell(Cell1);
                phrase = new Phrase();
                phrase.Add(new Chunk("Provide a landlord a guarantee of payment when renting premises?", FontTypeBold));
                phrase.Add(new Chunk("      and/or", FontType));
                phrase.Add(new Chunk(Environment.NewLine + "Provide customers or suppliers a guarantee of payment to secure a contract?", FontTypeBold));

                list = new iTextSharp.text.List(false, 8);
                list.ListSymbol = bullet;
                ////////list.Add(new iTextSharp.text.ListItem(new Chunk("With this account, all day-to-day electronic transactions are fee-free",FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Allows a business to offer customers and suppliers a surety of payment without having to provide them a cash deposit upfront", FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Where security other than cash is provided, this can free up money for other investment opportunities, and helps manage the highs and lows of cash flow", FontType)));

                PdfPCell objCell = new PdfPCell();
                objCell.AddElement(phrase);
                objCell.AddElement(list);
                objCell.AddElement(new Phrase(" "));
                objCell.Colspan = 3;
                pdfpTableAdditionalProduct.AddCell(objCell);
            }

            if (get.Contains("j"))
            {
                if (!isLastFiveProductSelected)
                {
                    // pdfDoc.NewPage();
                    pdfpTableAdditionalProduct.AddCell(cellAdditionalProduct);
                    isLastFiveProductSelected = true;
                }
                PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine + Environment.NewLine + "Online legal and tax advice", FontTypeBold));
                pdfpTableAdditionalProduct.AddCell(Cell1);
                phrase = new Phrase();
                phrase.Add(new Chunk("Legal and tax advice?", FontTypeBold));

                list = new iTextSharp.text.List(false, 8);
                list.ListSymbol = bullet;
                ////////list.Add(new iTextSharp.text.ListItem(new Chunk("With this account, all day-to-day electronic transactions are fee-free",FontType)));
                //list.Add(new iTextSharp.text.ListItem(new Chunk("St.George provides business customers with access to free online legal and taxation advice",FontType)));
                iTextSharp.text.ListItem LstItm = new iTextSharp.text.ListItem();
                LstItm.Add(new Chunk("St.George provides business customers with access to free online legal and taxation advice", FontType));
                LstItm.Add(new Chunk("3", FontFactory.GetFont(FontFactory.HELVETICA, 5)).SetTextRise(4));

                list.Add(LstItm);

                list.Add(new iTextSharp.text.ListItem(new Chunk("Access this service by sending a confidential email to the third party provider", FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("For more information, visit http://www.stgeorge.com.au/business/business-tools/legal-tax-advice", FontType)));

                PdfPCell objCell = new PdfPCell();
                objCell.AddElement(phrase);
                objCell.AddElement(list);
                objCell.AddElement(new Phrase(" "));
                objCell.Colspan = 3;
                pdfpTableAdditionalProduct.AddCell(objCell);
            }

            /*  if (freetax.Checked)
              {
                  if (!isLastFiveProductSelected)
                  {
                      pdfDoc.NewPage();
                      pdfpTableAdditionalProduct.AddCell(cellAdditionalProduct);
                      isLastFiveProductSelected = true;
                  }

                  PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine +Environment.NewLine +"Online legal and tax advice", FontTypeBold));
                  pdfpTableAdditionalProduct.AddCell(Cell1);
                  phrase = new Phrase();
                  phrase.Add(new Chunk("Legal and tax advice?", FontTypeBold));

                  phrase.Add(new Chunk(Environment.NewLine + "St.George provides customers with access to free online legal and taxation advice."
                                      + Environment.NewLine + "Accessing this service is easy, existing customers can access this service by sending a confidential email to Legal Access Services."
                                      + Environment.NewLine + "Legal and accountancy services are not provided by St.George. St.George accepts no responsibility for any advice provided by these third parties. Advice is available by email only.",FontType));

                  phrase.Add(Environment.NewLine + "For more information,");
                  link = FontFactory.GetFont("Arial", 12, Font.UNDERLINE, new Color(0, 0, 255));
                  anchor = new Anchor("http://www.stgeorge.com.au/business/business-tools/legal-tax-advice", link);
                  anchor.Reference = "http://www.stgeorge.com.au/business/business-tools/legal-tax-advice";
                  phrase.Add(anchor);

                  phrase.Add(Environment.NewLine + " ");
                  PdfPCell cell2 = new PdfPCell(phrase);
                  pdfpTableAdditionalProduct.AddCell(cell2);

                  list = new iTextSharp.text.List(false, 12);
                  list.ListSymbol = bullet;
                  list.Add(new iTextSharp.text.ListItem("St.George provides customers with access to free online legal and taxation advice"));
                  list.Add(new iTextSharp.text.ListItem("Accessing this service is easy, existing customers can access this service by sending a confidential email to Legal Access Services"));

                  PdfPCell objCell = new PdfPCell();
                  objCell.AddElement(phrase);
                  objCell.AddElement(list);

                  phrase = new Phrase();
                  phrase.Add(Environment.NewLine + "For more information,");
                  link = FontFactory.GetFont("Arial", 12, Font.UNDERLINE, new Color(0, 0, 255));
                  anchor = new Anchor("http://www.stgeorge.com.au/business/business-tools/legal-tax-advice", link);
                  anchor.Reference = "http://www.stgeorge.com.au/business/business-tools/legal-tax-advice";
                  phrase.Add(anchor);
                  objCell.AddElement(phrase);

                  objCell.AddElement(new Phrase(" "));
                  objCell.Colspan = 2;
                  pdfpTableAdditionalProduct.AddCell(objCell);

              }*/
            pdfDoc.Add(pdfpTableAdditionalProduct);

            #endregion CodeForLastFiveProduct

            var phraseTermAndConditionkalu = new Phrase();
            phraseTermAndConditionkalu.Add(new Chunk(Environment.NewLine + "", FontTypeBold));
            pdfDoc.Add(phraseTermAndConditionkalu);

            #region CodeForTopFiveProduct
            PdfPTable pdftblAllData = new PdfPTable(2);
            pdftblAllData.WidthPercentage = 100f;
            int[] firstTablecellwidth = { 30, 70 };
            pdftblAllData.SetWidths(firstTablecellwidth);

            phrase = new Phrase(" " + Environment.NewLine);
            phrase.Add(new Chunk("BizPack Essentials", FontTypeBold));
            phrase.Add(Environment.NewLine + " ");
            PdfPCell cellBizPack = new PdfPCell(phrase);
            cellBizPack.Colspan = 2;
            //Used to checked topfive product is selected
            bool IsTopFiveProductSelected = false;

            if (get.Contains("z"))
            {
                amt = "18";
                atm = "Business Cheque Account Plus";
                pdftblAllData.AddCell(cellBizPack);
                IsTopFiveProductSelected = true;

                PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine + Environment.NewLine + "Business Cheque Account Plus", FontTypeBold));
                pdftblAllData.AddCell(Cell1);

                phrase = new Phrase();
                phrase.Add(new Chunk(" An everyday account used to pay suppliers and have funds paid into?", FontTypeBold));

                list = new iTextSharp.text.List(false, 4);
                list.ListSymbol = bullet;

                /*
                phrase = new Phrase();
                phrase.Add(new Chunk("Day-to-day electronic transactions are fee-free"));
                phrase.Add(new Chunk("1", FontFactory.GetFont(FontFactory.HELVETICA, 6)).SetTextRise(4));
                phrase.Add(new Chunk(",TestTestTest"));
                */
                //list.Add(new iTextSharp.text.ListItem("With this account, all day-to-day electronic transactions are fee-free1"));

                iTextSharp.text.ListItem LstItm = new iTextSharp.text.ListItem();
                LstItm.Add(new Chunk("With this account, all day-to-day electronic transactions are fee-free", FontType));
                LstItm.Add(new Chunk("1", FontFactory.GetFont(FontFactory.HELVETICA, 5)).SetTextRise(4));
                list.Add(LstItm);
                list.Add(new iTextSharp.text.ListItem(new Chunk("Plus, get 55 free in-branch transactions (over the counter) or cheque withdrawals every month", FontType)));

                /*list.Add(new iTextSharp.text.ListItem(new Chunk("With this account, all day-to-day electronic transactions are fee-free",FontType)));
                 list.Add(new iTextSharp.text.ListItem(new Chunk("1",FontType).SetTextRise(4)));
                 list.Add(new iTextSharp.text.ListItem(new Chunk("Plus, get 50 free in-branch transactions (over the counter) or cheque withdrawals every month",FontType)));
                 */
                /*
               iTextSharp.text.ListItem LstItm =new iTextSharp.text.ListItem();
               LstItm.Add(new Chunk("With this account, the day-to-day electronic transactions are fee-free"));
               LstItm.Add(new Chunk("1", FontFactory.GetFont(FontFactory.HELVETICA, 6)).SetTextRise(4));
               list.Add(LstItm);
               list.Add(new iTextSharp.text.ListItem(new Chunk("no matter how many are made")));

                */

                //list.Add(new iTextSharp.text.ListItem("Plus, get 50 free in-branch transactions (over the counter) or cheque withdrawals every month"));

                PdfPCell objCell = new PdfPCell();
                objCell.AddElement(phrase);
                objCell.AddElement(list);
                objCell.AddElement(new Phrase(" "));

                objCell.Colspan = 3;
                pdftblAllData.AddCell(objCell);

            }
            if (get.Contains("a"))
            {
                if (!IsTopFiveProductSelected)
                {
                    pdftblAllData.AddCell(cellBizPack);
                    IsTopFiveProductSelected = true;
                }
                amt = "8";
                atm = "Freedom Business Account";
                PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine + Environment.NewLine + "Freedom Business Account", FontTypeBold));
                pdftblAllData.AddCell(Cell1);

                phrase = new Phrase();
                phrase.Add(new Chunk(" An everyday account used to pay suppliers and have funds paid into?", FontTypeBold));

                list = new iTextSharp.text.List(false, 8);
                list.ListSymbol = bullet;
                //list.Add(new iTextSharp.text.ListItem("With this account, all day-to-day electronic transactions are fee-free1"));
                //list.Add(new iTextSharp.text.ListItem("Plus, get 20 free in-branch transactions (over the counter) or cheque withdrawals every month"));
                /*list.Add(new iTextSharp.text.ListItem(new Chunk("With this account, all day-to-day electronic transactions are fee-free",FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("1",FontType).SetTextRise(4)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Plus, get 20 free in-branch transactions (over the counter) or cheque withdrawals every month",FontType)));
                */
                iTextSharp.text.ListItem LstItm = new iTextSharp.text.ListItem();
                LstItm.Add(new Chunk("With this account, all day-to-day electronic transactions are fee-free", FontType));
                LstItm.Add(new Chunk("1", FontFactory.GetFont(FontFactory.HELVETICA, 5)).SetTextRise(4));
                list.Add(LstItm);
                list.Add(new iTextSharp.text.ListItem(new Chunk("Plus, get 20 free in-branch transactions (over the counter) or cheque withdrawals every month", FontType)));

                PdfPCell objCell = new PdfPCell();

                objCell.AddElement(phrase);
                objCell.AddElement(list);
                objCell.AddElement(new Phrase(" "));

                objCell.Colspan = 3;
                pdftblAllData.AddCell(objCell);
            }

            if (get.Contains("b"))
            {
                if (!IsTopFiveProductSelected)
                {
                    pdftblAllData.AddCell(cellBizPack);
                    IsTopFiveProductSelected = true;
                }
                PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine + Environment.NewLine + "Business Visa Debit Card", FontTypeBold));
                pdftblAllData.AddCell(Cell1);

                phrase = new Phrase();
                //phrase.Add(new Chunk("Business Visa Debit Card", FontTypeBold));
                phrase.Add(new Chunk("Access cash from an ATM?", FontTypeBold));
                phrase.Add(new Chunk("      and/or", FontType));
                phrase.Add(new Chunk(Environment.NewLine + "Make purchases in person, over the phone or online?", FontTypeBold));

                list = new iTextSharp.text.List(false, 8);
                list.ListSymbol = bullet;

                //list.Add(new iTextSharp.text.ListItem(new Chunk("Plus, get 20 free in-branch transactions (over the counter) or cheque withdrawals every month",FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Access funds from the " + atm + " at ATMs", FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Make purchases in person, over the phone and online, wherever Visa is accepted (that's over 32 million locations worldwide)", FontType)));

                PdfPCell objCell = new PdfPCell();
                objCell.AddElement(phrase);
                objCell.AddElement(list);
                objCell.AddElement(new Phrase(" "));

                objCell.Colspan = 3;
                pdftblAllData.AddCell(objCell);

            }

            if (get.Contains("c"))
            {
                if (!IsTopFiveProductSelected)
                {
                    pdftblAllData.AddCell(cellBizPack);
                    IsTopFiveProductSelected = true;
                }
                PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine + Environment.NewLine + "Business Access Saver", FontTypeBold));
                pdftblAllData.AddCell(Cell1);

                phrase = new Phrase();
                phrase.Add(new Chunk("Put money away for tax and other future payments?", FontTypeBold));
                phrase.Add(new Chunk("      and/or", FontType));
                phrase.Add(new Chunk(Environment.NewLine + "Earn interest on this money?", FontTypeBold));

                list = new iTextSharp.text.List(false, 8);
                list.ListSymbol = bullet;
                //list.Add(new iTextSharp.text.ListItem(new Chunk("With this account, all day-to-day electronic transactions are fee-free",FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Enables money to be parked for future payments (like GST and regular bills), while also earning interest along the way", FontType)));

                iTextSharp.text.ListItem LstItm = new iTextSharp.text.ListItem();
                LstItm.Add(new Chunk("Day-to-day electronic transactions are fee-free", FontType));
                LstItm.Add(new Chunk("1", FontFactory.GetFont(FontFactory.HELVETICA, 5)).SetTextRise(4));
                LstItm.Add(new Chunk(", as are 4 in-branch deposits (over the counter) every month", FontType));
                list.Add(LstItm);

                // list.Add(new iTextSharp.text.ListItem(new Chunk("Day-to-day electronic transactions are fee-free1, as are 4 in-branch deposits (over the counter) every month",FontType)));

                PdfPCell objCell = new PdfPCell();
                objCell.AddElement(phrase);
                objCell.AddElement(list);
                objCell.AddElement(new Phrase(" "));

                objCell.Colspan = 3;
                pdftblAllData.AddCell(objCell);
            }

            if (get.Contains("d"))
            {
                if (!IsTopFiveProductSelected)
                {
                    pdftblAllData.AddCell(cellBizPack);
                    IsTopFiveProductSelected = true;
                }
                PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine + Environment.NewLine + "Business Banking Online", FontTypeBold));
                pdftblAllData.AddCell(Cell1);

                phrase = new Phrase();
                //phrase.Add(new Chunk("Business Visa Debit Card", FontTypeBold));
                phrase.Add(new Chunk("Manage money 24/7?", FontTypeBold));
                phrase.Add(new Chunk("      and/or", FontType));
                phrase.Add(new Chunk(Environment.NewLine + "Manage money when on the move?", FontTypeBold));

                /*phrase.Add(new Chunk(Environment.NewLine +"Business Banking Online won the 2013 Best Internet Business Bank, in the AB+F Corporate and Business Banking Awards.",FontType));
                phrase.Add(new Chunk(Environment.NewLine +"  Take control of business banking:",FontType));
                phrase.Add(new Chunk(Environment.NewLine +"  Ability to set daily payment limits",FontType));
                phrase.Add(new Chunk(Environment.NewLine +"  Allow multiple users to have access to business accounts",FontType));
                phrase.Add(new Chunk(Environment.NewLine +"  Nominate which users can authorise transactions using authentication device",FontType));
                phrase.Add(new Chunk(Environment.NewLine +"  Get ultimate portability with Business Banking Mobile",FontType));
                phrase.Add(Environment.NewLine + " ");
                PdfPCell cell2 = new PdfPCell(phrase);
                pdftblAllData.AddCell(cell2);
                */

                list = new iTextSharp.text.List(false, 8);
                list.ListSymbol = bullet;

                list1 = new iTextSharp.text.List(false, 8);
                list1.ListSymbol = bullet;
                ////list.Add(new iTextSharp.text.ListItem(new Chunk("With this account, all day-to-day electronic transactions are fee-free",FontType)));

                list.Add(new iTextSharp.text.ListItem(new Chunk("Business Banking Online won the 2013 Best Internet Business Bank, in the AB+F Corporate and Business Banking Awards", FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Take control of business banking:", FontType)));

                list1.Add(new iTextSharp.text.ListItem(new Chunk("Ability to set daily payment limits", FontType)));
                list1.Add(new iTextSharp.text.ListItem(new Chunk("Allow multiple users to have access to business accounts", FontType)));
                list1.Add(new iTextSharp.text.ListItem(new Chunk("Nominate which users can authorise transactions using authentication device", FontType)));
                list1.Add(new iTextSharp.text.ListItem(new Chunk("Get ultimate portability with Business Banking Mobile", FontType)));

                list.Add(list1);

                PdfPCell objCell = new PdfPCell();
                objCell.AddElement(phrase);
                objCell.AddElement(list);
                objCell.AddElement(new Phrase(" "));

                objCell.Colspan = 3;
                pdftblAllData.AddCell(objCell);

            }

            if (get.Contains("e"))
            {
                if (!IsTopFiveProductSelected)
                {
                    pdftblAllData.AddCell(cellBizPack);
                    IsTopFiveProductSelected = true;
                }
                PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine + Environment.NewLine + "BusinessVantage Visa Credit Card", FontTypeBold));
                pdftblAllData.AddCell(Cell1);

                phrase = new Phrase();
                //phrase.Add(new Chunk("Business Visa Debit Card", FontTypeBold));
                phrase.Add(new Chunk("A credit card to help manage business expenses and cash flow?", FontTypeBold));
                phrase.Add(new Chunk("      and/or", FontType));
                phrase.Add(new Chunk(Environment.NewLine + "Separate business and personal expenses?", FontTypeBold));

                /*phrase.Add(new Chunk(Environment.NewLine +"Low variable purchase rate (currently 9.99% p.a.) and up to 55 days interest free on purchases when closing balance paid by the due date",FontType));
                phrase.Add(new Chunk(Environment.NewLine +"A dedicated business credit card keeps business and personal expenses separate",FontType));
                phrase.Add(new Chunk(Environment.NewLine +"Provides peace of mind knowing extra working capital is at hand to help manage the highs and lows of cash flow",FontType));
                phrase.Add(Environment.NewLine + " ");
                PdfPCell cell2 = new PdfPCell(phrase);
                pdftblAllData.AddCell(cell2);*/

                list = new iTextSharp.text.List(false, 8);
                list.ListSymbol = bullet;

                //////list.Add(new iTextSharp.text.ListItem(new Chunk("With this account, all day-to-day electronic transactions are fee-free",FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Low variable purchase rate (currently 9.99% p.a.) and up to 55 days interest free on purchases when closing balance paid by the due date", FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("A dedicated business credit card keeps business and personal expenses separate", FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Provides peace of mind knowing extra working capital is at hand to help manage the highs and lows of cash flow", FontType)));

                PdfPCell objCell = new PdfPCell();
                objCell.AddElement(phrase);
                objCell.AddElement(list);
                objCell.AddElement(new Phrase(" "));

                objCell.Colspan = 3;
                pdftblAllData.AddCell(objCell);

            }

            if ((get.Contains("z") || get.Contains("a")) && get.Contains("c") && get.Contains("d") )
            {

                var phBecauseText = new Phrase();
                phBecauseText.Add(new Chunk("All the BizPack Essentials for only $" + amt + " per month in account keeping fees*."
                                      + Environment.NewLine + Environment.NewLine + "BizPack-ed full of savings:", FontTypeBold));

                list = new iTextSharp.text.List(false, 8);
                list.ListSymbol = bullet;
                ////////list.Add(new iTextSharp.text.ListItem(new Chunk("With this account, all day-to-day electronic transactions are fee-free",FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Business Banking Online monthly access fee (currently $30 a month) waived, saving $360 annually", FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("BusinessVantage Visa Credit Card annual fee (currently $55 per card) waived for up to 3 cards, saving up to $165 annually", FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Establishment fee for each new EFTPOS and merchant terminal waived, current saving of $77 per terminal", FontType)));

                PdfPCell objCell = new PdfPCell();
                objCell.AddElement(phBecauseText);
                objCell.AddElement(list);

                var phBecauseText1 = new Phrase();
                phBecauseText1.Add(new Chunk(Environment.NewLine + "*Transaction fees and special service fees may also apply.", FontType));
                objCell.AddElement(phBecauseText1);
                // objCell.AddElement(new Phrase("*Transaction fees and special service fees may also apply."));
                objCell.AddElement(new Phrase(" "));

                objCell.Colspan = 3;
                pdftblAllData.AddCell(objCell);
                //pdfDoc.Add(pdftblAllData);

            }
            else
            {
                //Business%20Access%20Saver
                var biznt =  Request.QueryString["bizpacknameneshat"];

                Phrase phBecauseText = new Phrase();
                phBecauseText.Add(new Chunk("Because the following have not been selected, BizPack has not been unlocked:", FontType));

                Phrase phBecauseText2 = new Phrase();
                phBecauseText2.Add(new Chunk(Environment.NewLine + "BizPack", FontTypeBold));
                phBecauseText2.Add(new Chunk(Environment.NewLine + "Pay only $" + amt + " per month in account keeping fees* for the BizPack Essentials.", FontType));

                phBecauseText2.Add(new Chunk(Environment.NewLine + "BizPack-ed full of savings:", FontType));

                list1 = new iTextSharp.text.List(false, 8);
                list1.ListSymbol = bullet;

                if(biznt.Contains("Freedom Business Account")){
                     list1.Add(new iTextSharp.text.ListItem(new Chunk("Freedom Business Account", FontType)));
                }
                if(biznt.Contains("Business Access Saver")){
                     list1.Add(new iTextSharp.text.ListItem(new Chunk("Business Access Saver", FontType)));
                }
                if(biznt.Contains("Business Banking Online")){
                    list1.Add(new iTextSharp.text.ListItem(new Chunk("Business Banking Online", FontType)));
                }

                list = new iTextSharp.text.List(false, 8);
                list.ListSymbol = bullet;
                ////////list.Add(new iTextSharp.text.ListItem(new Chunk("With this account, all day-to-day electronic transactions are fee-free",FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Business Banking Online monthly access fee (currently $30 a month) waived, saving $360 annually", FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("BusinessVantage Visa Credit Card annual fee (currently $55 per card) waived for up to 3 cards, saving up to $165 annually", FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Establishment fee for each new EFTPOS and merchant terminal waived, current saving of $77 per terminal", FontType)));

                PdfPCell objCell = new PdfPCell();
                objCell.AddElement(phBecauseText);
                objCell.AddElement(list1);
                objCell.AddElement(phBecauseText2);
                objCell.AddElement(list);
                var phBecauseText1 = new Phrase();
                phBecauseText1.Add(new Chunk(Environment.NewLine + "*Transaction fees and special service fees may also apply.", FontType));
                objCell.AddElement(phBecauseText1);
                objCell.AddElement(new Phrase(" "));

                objCell.Colspan = 3;
                pdftblAllData.AddCell(objCell);
                //pdfDoc.Add(pdftblAllData);
            }

            pdfDoc.Add(pdftblAllData);
            #endregion CodeForTopFiveProduct

                        #region TermAndCondition
            // pdfDoc.NewPage();
            FontTypeBold = FontFactory.GetFont("Arial", 8f, iTextSharp.text.Font.BOLD);
            FontType = FontFactory.GetFont("Arial", 8f, iTextSharp.text.Font.NORMAL);
            var phraseTermAndCondition = new Phrase();
            phraseTermAndCondition.Add(new Chunk(Environment.NewLine + "Things you should know", FontTypeBold));
            phraseTermAndCondition.Add(new Chunk(Environment.NewLine + "Information is current as at 31 March 2014 This offer may be withdrawn at any time, visit stgeorge.com.au for up-to-date information.", FontType));
            phraseTermAndCondition.Add(new Chunk(Environment.NewLine + "No personal information is stored by using this tool. This tool does not take into account your objectives, financial situation or needs. Before making any decision, consider its appropriateness having regard to your objectives, financial situation and needs. Before you acquire a product, read the Product Disclosure Statement or other disclosure document available at stgeorge.com.au and consider whether the product is appropriate for you. Credit criteria applies to all credit, lending, merchant and bank guarantee products and services selected. Terms and Conditions, fees and charges apply.", FontType));

            phraseTermAndCondition.Add(new Chunk(Environment.NewLine + "1. Electronic transactions are phone and internet banking deposits, withdrawals and transfers, direct debits and credits, St.George/BankSA/Bank of Melbourne/ Westpac ATM withdrawals in Australia, St.George/BankSA/Bank of Melbourne ATM deposits and mini transaction history and EFTPOS withdrawals and Business Visa Debit Card transactions. Daily limits apply.", FontType));
            phraseTermAndCondition.Add(new Chunk(Environment.NewLine + "2. The account keeping fee for the Transaction Account selected in BizPack is payable monthly. The monthly online access fee, annual card fee (for up to 3 cards) and facility establishment fee applicable to the other eligible products in BizPack are waived for as long as  customer holds a Transaction Account, Savings Account, and online banking facility in the same name. Internet Banking may replace Business Banking Online as the online banking facility held in BizPack. Transaction fees may also apply if you exceed the monthly fee-free transaction allowance on eligible products in the BizPack Essentials. Other transactions and special service fees may also apply.", FontType));

            //phraseTermAndCondition.Add(new Chunk(Environment.NewLine + "3. Customers can access the online legal and accountancy services by sending an email to Legal Access Services. These services are not provided by St.George and St.George accepts no responsibility for any advice provided by the third party. Advice is available by email only. All products and services in this tool (other than equipment finance and automotive finance) are issued by St.George Bank – A Division of Westpac Banking Corporation ABN 33 007 457 141 AFSL and Australian credit licence 233714. ", FontType));

            phraseTermAndCondition.Add(new Chunk(Environment.NewLine + "Equipment Finance by St.George Finance Limited ABN 99 001 094 471 Australian credit licence 387944.", FontType));

           // phraseTermAndCondition.Add(new Chunk(Environment.NewLine + "Automotive Finance by St.George Finance Limited ABN 99 001 094 471.", FontType));
           // phraseTermAndCondition.Add(new Chunk(" Australian credit licence 387944 and St.George Motor Finance Limited ABN 53 007 656 555 Australian credit licence 387946.", FontType));
            // phraseTermAndCondition.Add(new Chunk(Environment.NewLine + "St.George Bank – A Division of Westpac Banking Corporation. ABN 33 007 457 141 AFSL and Australian credit licence 233714", FontType));
            pdfDoc.Add(phraseTermAndCondition);
            #endregion TermAndCondition
            //Image and Text for Call
            //PdfPTable pdfTable = new PdfPTable(2);
            //pdfTable.HorizontalAlignment = Element.ALIGN_LEFT;
            //pdfTable.DefaultCell.Border = Rectangle.NO_BORDER;
            //pdfTable.SplitRows = false;
            //iTextSharp.text.Image image1 = iTextSharp.text.Image.GetInstance(iTextSharp.text.Image.GetInstance(Server.MapPath("~/george.JPG")));
            //image1.ScaleToFit(750f, 750f);
            //Chunk imageChunk1 = new Chunk(image1, 0, -30);
            //phrase = new Phrase(new Chunk(image1, 0, -30));
            //PdfPCell imageCell = new PdfPCell(phrase);

            //imageCell.Border = 0;
            //imageCell.HorizontalAlignment = Element.ALIGN_LEFT; ;
            //PdfPCell fcell1 = new PdfPCell(new Phrase((": Call 13000"), FontFactory.GetFont("Arial", 10, iTextSharp.text.Font.NORMAL)));
            //fcell1.Border = 0;
            //fcell1.HorizontalAlignment = Element.ALIGN_LEFT;
            //pdfTable.AddCell(imageCell);
            //pdfTable.AddCell(fcell1);
            //pdfTable.SetWidthPercentage(new float[2] { 20f, 10f }, PageSize.LETTER);
            //pdfTable.HorizontalAlignment = Element.ALIGN_LEFT;
            //pdfDoc.Add(pdfTable);

            //Header Part
            //iTextSharp.text.Image logoHeader = iTextSharp.text.Image.GetInstance(Server.MapPath("~/PDF.jpg"));
            //logoHeader.ScaleAbsolute(500, 300);
            //pdfDoc.Add(logoHeader);

            //PdfPCell cell = new PdfPCell(phrase);
            //tblFirstData.AddCell(cell);

            //pdfDoc.Add(tblFirstData);
            //AddDataInPDFTable objAddDataInPDFTable = new AddDataInPDFTable();
            //objAddDataInPDFTable.AddTableInDoc(pdfDoc);

            htmlparser.Parse(sr);
            pdfDoc.Close();
            Response.Write(pdfDoc);
            Response.End();
        }
        catch (Exception ex)
        {
            log.Fatal("Error in Submitbtn_Click() function." + ex.Message, ex);
        }
    }
예제 #24
0
 /**
 * Process the text so that it will render with a combination of fonts
 * if needed.
 * @param text the text
 * @return a <CODE>Phrase</CODE> with one or more chunks
 */
 public Phrase Process(String text)
 {
     int fsize = fonts.Count;
     if (fsize == 0)
         throw new ArgumentException("No font is defined.");
     char[] cc = text.ToCharArray();
     int len = cc.Length;
     StringBuilder sb = new StringBuilder();
     Font font = null;
     int lastidx = -1;
     Phrase ret = new Phrase();
     for (int k = 0; k < len; ++k) {
         char c = cc[k];
         if (c == '\n' || c == '\r') {
             sb.Append(c);
             continue;
         }
         for (int f = 0; f < fsize; ++f) {
             font = (Font)fonts[f];
             if (font.BaseFont.CharExists(c)) {
                 if (lastidx == f)
                     sb.Append(c);
                 else {
                     if (sb.Length > 0 && lastidx != -1) {
                         Chunk ck = new Chunk(sb.ToString(), (Font)fonts[lastidx]);
                         ret.Add(ck);
                         sb.Length = 0;
                     }
                     sb.Append(c);
                     lastidx = f;
                 }
                 break;
             }
         }
     }
     if (sb.Length > 0) {
         Chunk ck = new Chunk(sb.ToString(), (Font)fonts[lastidx == -1 ? 0 : lastidx]);
         ret.Add(ck);
     }
     return ret;
 }
        private void CreateReport(string filePath)
        {
            AppFileTemplate f = (AppFileTemplate)DataContext;

            // margins
            float left   = 30;
            float right  = 10;
            float top    = 10;
            float bottom = 10;
            float headH  = 20;
            float indent = 5;

            //string fontName = "C:\\WINDOWS\\FONTS\\CALIBRI.TTF";
            string fontName = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "CALIBRI.TTF");

            iText.Font     NormalSatirFont  = iText.FontFactory.GetFont(fontName, "CP1254", 10, iText.Font.NORMAL);
            iText.Font     BoldSatirFont    = iText.FontFactory.GetFont(fontName, "CP1254", 10, iText.Font.BOLD);
            iText.Font     NormalRiseFont   = iText.FontFactory.GetFont(fontName, "CP1254", 8, iText.Font.NORMAL);
            iText.Font     NormalSymbolFont = iText.FontFactory.GetFont(iText.FontFactory.SYMBOL, 10, iText.Font.NORMAL);
            iText.Document doc = new iText.Document(iText.PageSize.A4, left, right, top, bottom);

            float xLL = doc.GetLeft(left);
            float yLL = doc.GetBottom(bottom);
            float xUR = doc.GetRight(right);
            float yUR = doc.GetTop(top);
            float w   = xUR - xLL;
            float h   = yUR - yLL;
            float xUL = xLL;
            float yUL = yUR;
            float xLR = xUR;
            float yLR = yLL;
            //float graphW = w - 10;
            //float graphH = graphW * 2 / 3;


            float graphH = 3 * h / 5;
            float graphW = w - 10;


            PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(filePath, FileMode.Create));

            doc.Open();

            // direct content
            PdfContentByte cb = writer.DirectContent;

            // çizgiler
            DrawLine(cb, xUR - w, yUR, xUR, yUR);
            DrawLine(cb, xUR - w, yUR, xLL, yLL);
            DrawLine(cb, xLL, yLL, xLL + w, yLL);
            DrawLine(cb, xLL + w, yLL, xUR, yUR);
            DrawLine(cb, xUL, yUL - headH, xUR, yUR - headH);
            DrawLine(cb, xUL, yUL - headH - graphH, xUR, yUR - headH - graphH);

            // başlık
            ColumnText ct = new ColumnText(cb);

            ct.Indent = indent;
            iText.Phrase txt = new iText.Phrase();
            txt.Add(new iText.Chunk(f.ReportTitle, NormalSatirFont));
            ct.SetSimpleColumn(txt, xUL, yUL - headH, xUR, yUR, headH / 1.5f, iText.Element.ALIGN_LEFT | iText.Element.ALIGN_MIDDLE);
            ct.Go();

            var stream      = new MemoryStream();
            var pngExporter = new PngExporter {
                Width = (int)graphW, Height = (int)graphH, Background = OxyColors.White
            };

            pngExporter.Export(PlotView.Model, stream);

            iText.Image png = iText.Image.GetInstance(stream.GetBuffer());
            png.Alignment = iText.Element.ALIGN_CENTER | iText.Element.ALIGN_MIDDLE;
            png.SetAbsolutePosition(xUL, yUL - headH - graphH);
            doc.Add(png);

            float      kstW    = w / 2;
            float      kstH    = (h - headH - graphH) / 1.5f;
            ColumnText ctKesit = new ColumnText(cb);

            ctKesit.Indent = indent;
            txt            = new iText.Phrase();
            txt.Add(new iText.Chunk("Kesit\n", BoldSatirFont));
            txt.Add(new iText.Chunk(String.Format("Genişlik, b = {0:0} cm\n", f.b), NormalSatirFont));
            txt.Add(new iText.Chunk(String.Format("Yükseklik, h = {0:0} cm\n", f.h), NormalSatirFont));
            txt.Add(new iText.Chunk(String.Format("Alan, bxh = {0:0} cm²\n", f.b * f.h), NormalSatirFont));
            txt.Add(new iText.Chunk("\nMalzeme\n", BoldSatirFont));
            txt.Add(new iText.Chunk("f", NormalSatirFont));
            txt.Add(new iText.Chunk("c", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa   ", f.Beton().fc.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));
            txt.Add(new iText.Chunk("f", NormalSatirFont));
            txt.Add(new iText.Chunk("y", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa\n", f.DonatiCeligi().fy.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));

            txt.Add(new iText.Chunk("f", NormalSatirFont));
            txt.Add(new iText.Chunk("cd", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa   ", f.Beton().fcd.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));

            txt.Add(new iText.Chunk("f", NormalSatirFont));
            txt.Add(new iText.Chunk("yd", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa\n", f.DonatiCeligi().fyd.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));

            txt.Add(new iText.Chunk("E", NormalSatirFont));
            txt.Add(new iText.Chunk("c", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa   ", f.Beton().E.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));
            txt.Add(new iText.Chunk("E", NormalSatirFont));
            txt.Add(new iText.Chunk("s", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa\n", f.DonatiCeligi().E.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));
            txt.Add(new iText.Chunk("e", NormalSymbolFont));
            txt.Add(new iText.Chunk("cu", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0.0000} m/m   ", f.Beton().Ecu), NormalSatirFont));
            txt.Add(new iText.Chunk("e", NormalSymbolFont));
            txt.Add(new iText.Chunk("yd", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0.00000} m/m\n", f.DonatiCeligi().Eyd), NormalSatirFont));
            txt.Add(new iText.Chunk("k", NormalSatirFont));
            txt.Add(new iText.Chunk("1", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0.000}\n", f.Beton().k1), NormalSatirFont));

            ctKesit.SetSimpleColumn(txt, xUL, yUL - headH - graphH - kstH, xUL + kstW, yUL - headH - graphH, 15, iText.Element.ALIGN_LEFT);
            ctKesit.Go();

            ColumnText ctDonati = new ColumnText(cb);

            txt = new iText.Phrase();
            txt.Add(new iText.Chunk("Donatı\n", BoldSatirFont));
            int j = 1;

            foreach (var rb in f.ReinforcingBars)
            {
                txt.Add(new iText.Chunk("A", NormalSatirFont));
                txt.Add(new iText.Chunk(string.Format("s{0}", j), NormalRiseFont).SetTextRise(-1.0f));
                txt.Add(new iText.Chunk(string.Format("={0:0.00} cm², ", rb.As), NormalSatirFont));
                txt.Add(new iText.Chunk("d", NormalSatirFont));
                txt.Add(new iText.Chunk(string.Format("{0}", j), NormalRiseFont).SetTextRise(-1.0f));
                txt.Add(new iText.Chunk(string.Format("={0:0.00} cm\n", rb.di), NormalSatirFont));
                j++;
            }
            txt.Add(new iText.Chunk("r", NormalSymbolFont));
            txt.Add(new iText.Chunk(string.Format("=%{0:0.00}\n", 100.0 * f.ReinforcingBars.Sum(i => i.As) / (f.b * f.h)), NormalSatirFont));
            txt.Add(new iText.Chunk("(d", NormalSatirFont));
            txt.Add(new iText.Chunk("i", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(":Kesit basınç yüzeyinin donatı eksenine uzaklığı)\n", NormalSatirFont));
            txt.Add(new iText.Chunk("\nDayanım Azaltma Katsayıları\n", BoldSatirFont));
            txt.Add(new iText.Chunk("f", NormalSymbolFont));
            txt.Add(new iText.Chunk("a", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(string.Format(" = {0:0.00}, ", f.PhiA), NormalSatirFont));
            txt.Add(new iText.Chunk("f", NormalSymbolFont));
            txt.Add(new iText.Chunk("b", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(string.Format(" = {0:0.00}, ", f.PhiB), NormalSatirFont));
            txt.Add(new iText.Chunk("f", NormalSymbolFont));
            txt.Add(new iText.Chunk("c", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(string.Format(" = {0:0.00}", f.PhiC), NormalSatirFont));
            //txt.Add(new iText.Chunk("\n\nTasarım:\n", BoldSatirFont));
            //txt.Add(new iText.Chunk(f.Code.ToString(), NormalSatirFont));
            ctDonati.SetSimpleColumn(txt, xUL + kstW, yUL - headH - graphH - kstH, xUL + 2 * kstW, yUL - headH - graphH, 15, iText.Element.ALIGN_LEFT);
            ctDonati.Go();

            ColumnText ctTesir = new ColumnText(cb);

            ctTesir.Indent = indent;
            txt            = new iText.Phrase();
            txt.Add(new iText.Chunk("Maksimum eksenel basınç, N", NormalSatirFont));
            txt.Add(new iText.Chunk("max", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(string.Format(" = {0:0.00} t\n", f.Pmax), NormalSatirFont));
            txt.Add(new iText.Chunk("Maksimum eksenel çekme, N", NormalSatirFont));
            txt.Add(new iText.Chunk("min", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(string.Format(" = {0:0.00} t\n\n", f.Pmin), NormalSatirFont));

            txt.Add(new iText.Chunk("Yönetmelik maksimum eksenel basınç sınırı, N", NormalSatirFont));
            txt.Add(new iText.Chunk("max", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(string.Format(" = {0:0.00} t", f.ActualPmax), NormalSatirFont));
            ctTesir.SetSimpleColumn(txt, xUL, yUL - headH - graphH - 1.5f * kstH, xUL + kstW, yUL - headH - graphH - kstH, 15, iText.Element.ALIGN_LEFT);
            ctTesir.Go();

            doc.Close();
        }
 // ---------------------------------------------------------------------------
 /**
  * Creates a phrase with the production year of a movie.
  * @param movie a Movie object
  * @return a Phrase object
  */
 // public static Element GetYearPhrase(Movie movie) {
 public static Phrase GetYearPhrase(Movie movie)
 {
     Phrase p = new Phrase();
     p.Add(new Chunk("Year: ", FilmFonts.BOLD));
     p.Add(new Chunk(movie.Year.ToString(), FilmFonts.NORMAL));
     return p;
 }
 // ---------------------------------------------------------------------------
 /**
  * Creates a phrase with the run length of a movie.
  * @param movie a Movie object
  * @return a Phrase object
  */
 // public static Element getDurationPhrase(Movie movie) {
 public static Phrase GetDurationPhrase(Movie movie)
 {
     Phrase p = new Phrase();
     p.Add(new Chunk("Duration: ", FilmFonts.BOLD));
     p.Add(new Chunk(movie.Duration.ToString(), FilmFonts.NORMAL));
     return p;
 }
예제 #28
0
        private void AddRow(PdfPTable t, RollsheetModel.PersonMemberInfo p, BaseColor color)
        {
            t.DefaultCell.BackgroundColor = color;

            var c = new Phrase();
            c.Add(new Chunk(p.Name, boldfont));
            c.Add(new Chunk($"  ({p.PeopleId})\n", smallfont));
            var sb = new StringBuilder();
            AddLine(sb, p.Address);
            AddLine(sb, p.Address2);
            AddLine(sb, p.CityStateZip);
            c.Add(new Chunk(sb.ToString(), font));
            t.AddCell(c);

            sb = new StringBuilder();
            AddPhone(sb, p.HomePhone, "h ");
            AddPhone(sb, p.CellPhone, "c ");
            AddPhone(sb, p.WorkPhone, "w ");
            AddLine(sb, p.Email);
            t.AddCell(new Phrase(sb.ToString(), font));

            t.AddCell(new Phrase(p.MemberType));
        }
    public byte[] PrintAppointmentInvoice(string invoiceId, string appointmentToken, string doctorName, 
        string appointmentDate, string appointmentTime)
    {
        Document document = new Document(PageSize.A4);
        Font NormalFont = FontFactory.GetFont("Arial", 12, Font.NORMAL, Color.BLACK);
        using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())
        {
            PdfWriter writer = PdfWriter.GetInstance(document, memoryStream);
            PdfPTable table = null;
            Phrase phrase = null;
            PdfPCell cell = null;
            Paragraph paragraph = null;
            Color color = null;

            document.Open();

            table = new PdfPTable(2);
            float[] widths = new float[] { 5f, 10f };
            table.SetWidths(widths);

            iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(System.Web.HttpContext.Current.Server.MapPath("../images/logo.png"));
            image.ScaleAbsolute(80, 80);
            cell = new PdfPCell(image);
            cell.Border = Rectangle.NO_BORDER;
            table.AddCell(cell);

            phrase = new Phrase();
            phrase.Add(new Chunk("ABC Hospital\n\n", FontFactory.GetFont("Arial", 18, Font.BOLD, Color.RED)));
            phrase.Add(new Chunk("123, Bodakdev\n", FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
            phrase.Add(new Chunk("Ahmedabad 380015\n", FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
            phrase.Add(new Chunk("INDIA\n", FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
            phrase.Add(new Chunk("Ph:- 9543289345\n", FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
            phrase.Add(new Chunk("Website:- http://www.abchospital.com\n", FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));

            cell = new PdfPCell(phrase);
            cell.Border = Rectangle.NO_BORDER;
            table.AddCell(cell);

            color = new Color(System.Drawing.ColorTranslator.FromHtml("#000000"));
            DrawLine(writer, 25f, document.Top - 110f, document.PageSize.Width - 25f, document.Top - 110f, color);
            DrawLine(writer, 25f, document.Top - 110f, document.PageSize.Width - 25f, document.Top - 110f, color);

            phrase = new Phrase();
            phrase.Add(new Chunk("APPOINTMENT INVOICE\n\n", FontFactory.GetFont("Arial", 16, Font.BOLD, Color.BLACK)));

            paragraph = new Paragraph();
            paragraph.Add(phrase);
            paragraph.Alignment = Element.ALIGN_CENTER;
            paragraph.SpacingBefore = 50;
            paragraph.SpacingAfter = 30;

            document.Add(table);
            document.Add(paragraph);

            table = new PdfPTable(2);
            phrase = new Phrase();
            phrase.Add(new Chunk("Invoice ID", FontFactory.GetFont("Arial", 11, Font.NORMAL, Color.BLACK)));
            cell = new PdfPCell(phrase);
            cell.PaddingBottom = 20;
            table.AddCell(cell);
            phrase = new Phrase();
            phrase.Add(new Chunk(invoiceId, FontFactory.GetFont("Arial", 11, Font.NORMAL, Color.BLACK)));
            cell = new PdfPCell(phrase);
            table.AddCell(cell);
            phrase = new Phrase();
            phrase.Add(new Chunk("Invoice Date", FontFactory.GetFont("Arial", 11, Font.NORMAL, Color.BLACK)));
            cell = new PdfPCell(phrase);
            cell.PaddingBottom = 20;
            table.AddCell(cell);
            phrase = new Phrase();
            phrase.Add(new Chunk(DateTime.Now.ToString(), FontFactory.GetFont("Arial", 11, Font.NORMAL, Color.BLACK)));
            cell = new PdfPCell(phrase);
            table.AddCell(cell);
            phrase = new Phrase();
            phrase.Add(new Chunk("Appointment Token", FontFactory.GetFont("Arial", 11, Font.NORMAL, Color.BLACK)));
            cell = new PdfPCell(phrase);
            cell.PaddingBottom = 20;
            table.AddCell(cell);
            phrase = new Phrase();
            phrase.Add(new Chunk(appointmentToken, FontFactory.GetFont("Arial", 11, Font.NORMAL, Color.BLACK)));
            cell = new PdfPCell(phrase);
            table.AddCell(cell);
            phrase = new Phrase();
            phrase.Add(new Chunk("Doctor", FontFactory.GetFont("Arial", 11, Font.NORMAL, Color.BLACK)));
            cell = new PdfPCell(phrase);
            cell.PaddingBottom = 20;
            table.AddCell(cell);
            phrase = new Phrase();
            phrase.Add(new Chunk(doctorName, FontFactory.GetFont("Arial", 11, Font.NORMAL, Color.BLACK)));
            cell = new PdfPCell(phrase);
            table.AddCell(cell);
            phrase = new Phrase();
            phrase.Add(new Chunk("Appointment Date", FontFactory.GetFont("Arial", 11, Font.NORMAL, Color.BLACK)));
            cell = new PdfPCell(phrase);
            cell.PaddingBottom = 20;
            table.AddCell(cell);
            phrase = new Phrase();
            phrase.Add(new Chunk(appointmentDate, FontFactory.GetFont("Arial", 11, Font.NORMAL, Color.BLACK)));
            cell = new PdfPCell(phrase);
            table.AddCell(cell);
            phrase = new Phrase();
            phrase.Add(new Chunk("Appointment Time", FontFactory.GetFont("Arial", 11, Font.NORMAL, Color.BLACK)));
            cell = new PdfPCell(phrase);
            cell.PaddingBottom = 20;
            table.AddCell(cell);
            phrase = new Phrase();
            phrase.Add(new Chunk(appointmentTime, FontFactory.GetFont("Arial", 11, Font.NORMAL, Color.BLACK)));
            cell = new PdfPCell(phrase);
            table.AddCell(cell);
            table.HorizontalAlignment = Element.ALIGN_CENTER;

            document.Add(table);

            DrawLine(writer, 25f, document.Top - 750f, document.PageSize.Width - 25f, document.Top - 750f, color);
            DrawLine(writer, 25f, document.Top - 750f, document.PageSize.Width - 25f, document.Top - 750f, color);

            document.Close();
            byte[] bytes = memoryStream.ToArray();
            using (FileStream fs = File.Create(System.Web.HttpContext.Current.Server.MapPath("../Invoice/Appointments/" + invoiceId + ".pdf")))
            {
                fs.Write(bytes, 0, (int)bytes.Length);
            }
            memoryStream.Close();
            return bytes;
        }
    }
예제 #30
0
        private PdfPTable AddRow(string Code, string name, int pid, string dob, string highlight, Font font)
        {
            var t = new PdfPTable(4);
            //t.SplitRows = false;
            t.WidthPercentage = 100;
            t.SetWidths(new int[] { 30, 4, 6, 30 });
            t.DefaultCell.Border = PdfPCell.NO_BORDER;

            var bc = new Barcode39();
            bc.X = 1.2f;
            bc.Font = null;
            bc.Code = pid.ToString();
            var img = bc.CreateImageWithBarcode(dc, null, null);
            var c = new PdfPCell(img, false);
            c.PaddingTop = 3f;
            c.Border = PdfPCell.NO_BORDER;
            c.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
            t.AddCell(c);

            t.AddCell("");
            t.AddCell(box);

            DateTime bd;
            DateTime.TryParse(dob, out bd);

            var p = new Phrase(name, font);
            p.Add("\n");
            p.Add(new Chunk(" ", medfont));
            p.Add(new Chunk("({0}) {1:MMM d}".Fmt(Code, bd), smallfont));
            if (highlight.HasValue())
                p.Add("\n" + highlight);
            t.AddCell(p);
            hasRows = true;
            return t;
        }
예제 #31
0
        public virtual void SpaceTrimColumnTextTest() {
            Document doc = new Document(PageSize.A4, 50, 30, 50, 30);
            PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(OUTSPTRIMCT, FileMode.Create));
            doc.Open();

            Phrase under = new Phrase();
            under.Font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.UNDERLINE);
            under.Add(new Chunk(" 1                                                      1                                                                                                                             9      "));

            Paragraph underlineTest = new Paragraph(under);
            underlineTest.KeepTogether = true;
            doc.Add(underlineTest);

            doc.Close();
            writer.Close();

            PdfReader reader = new PdfReader(OUTSPTRIMCT);
            MyTextRenderListener listener = new MyTextRenderListener();
            PdfContentStreamProcessor processor = new PdfContentStreamProcessor(listener);
            PdfDictionary pageDic = reader.GetPageN(1);
            PdfDictionary resourcesDic = pageDic.GetAsDict(PdfName.RESOURCES);
            processor.ProcessContent(ContentByteUtils.GetContentBytesForPage(reader, 1), resourcesDic);
            Assert.IsTrue(listener.GetText().Length == 60, "Unexpected text length");
        }
예제 #32
0
 public static Phrase GetPhrase(Properties attributes)
 {
     Phrase phrase = new Phrase();
     phrase.Font = FontFactory.GetFont(attributes);
     String value;
     value = attributes[ElementTags.LEADING];
     if (value != null) {
         phrase.Leading = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
     value = attributes[Markup.CSS_KEY_LINEHEIGHT];
     if (value != null) {
         phrase.Leading = Markup.ParseLength(value, Markup.DEFAULT_FONT_SIZE);
     }
     value = attributes[ElementTags.ITEXT];
     if (value != null) {
         Chunk chunk = new Chunk(value);
         if ((value = attributes[ElementTags.GENERICTAG]) != null) {
             chunk.SetGenericTag(value);
         }
         phrase.Add(chunk);
     }
     return phrase;
 }
예제 #33
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public void GeneraPDF(object sender, EventArgs e)
        {
            Document doc = new Document(PageSize.LETTER, 0f, 0f, 0f, 0f);

            Font NormalFont = FontFactory.GetFont("Arial", 12, Font.NORMAL, Color.BLACK);
            using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())
            {
                PdfWriter writer = PdfWriter.GetInstance(doc, memoryStream);
                Phrase phrase = null;
                PdfPCell cell = null;
                PdfPCell b = new PdfPCell(new Phrase(" "));
                PdfPTable table = null;
                //Color color = null;
                //PdfPCell imageCell = new PdfPCell(Check);
                PdfPCell uncheck = ImageCell("~/Images/uncheck4.png", 2f, PdfPCell.ALIGN_CENTER);
                PdfPCell check = ImageCell("~/Images/Check4.png", 2f, PdfPCell.ALIGN_CENTER);
                PdfPCell cbox = check;
                DateTime datevalue = (Convert.ToDateTime(Fecha.ToString()));
                Fecha = datevalue.ToString("MM/dd/yyyy");

                String[] mes = { "ENERO", "FEBRERO", "MARZO", "ABRIL", "MAYO", "JUNIO", "JULIO", "AGOSTO", "SEPTIEMBRE", "OCTUBRE", "NOVIEMBRE", "DICIEMBRE" };
                String FechaLetras = datevalue.Day.ToString() + " DE " + mes[datevalue.Month - 1] + " DE " + datevalue.Year.ToString();

                doc.Open();

                Paragraph p = new Paragraph("DTOP-          09/15                                              \n\n", FontFactory.GetFont("Arial", 8, Font.NORMAL, Color.BLACK));
                p.Alignment = Element.ALIGN_RIGHT;
                doc.Add(p);

                //Header Table
                table = new PdfPTable(3);

                //Header Data
                cell = ImageCell("~/images/EscudoPR.png", 40f, PdfPCell.ALIGN_LEFT);
                cell.Border = 0;
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(" "));
                cell.Border = 0;
                table.AddCell(cell);
                phrase = new Phrase();
                phrase.Add(new Chunk("\n\nNÚMERO DE AVISO:\n", FontFactory.GetFont("Arial", 8, Font.NORMAL, Color.BLACK)));
                phrase.Add(new Chunk("DEDT-" + NumControl, FontFactory.GetFont("Arial", 16, Font.BOLD, Color.RED)));

                cell = PhraseCell(phrase, PdfPCell.ALIGN_CENTER);
                cell.BorderColorLeft = Color.BLACK;
                cell.BorderColorRight = Color.BLACK;
                cell.BorderColorTop = Color.BLACK;
                cell.BorderColorBottom = Color.BLACK;
                cell.BorderWidthLeft = 1f;
                cell.BorderWidthRight = 1f;
                cell.BorderWidthTop = 1f;
                cell.BorderWidthBottom = 1f;
                cell.Border = Rectangle.BOX;
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(" "));
                cell.Colspan = 3;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                doc.Add(table);

                p = new Paragraph("DIRECTORÍA DE EXCAVACIONES, DEMOLICIONES Y TUBERÍAS", FontFactory.GetFont("Arial", 14, Font.NORMAL, Color.BLACK));
                p.Alignment = Element.ALIGN_CENTER;
                doc.Add(p);

                p = new Paragraph("CENTRO DE COORDINACIÓN DE EXCAVACIONES Y DEMOLICIONES", FontFactory.GetFont("Arial", 14, Font.NORMAL, Color.BLACK));
                p.Alignment = Element.ALIGN_CENTER;
                doc.Add(p);

                p = new Paragraph("CERTIFICACIÓN DE TRÁMITE DE AVISO DE EXCAVACIÓN Y/O DEMOLICIÓN\n\n", FontFactory.GetFont("Arial", 14, Font.BOLD, Color.BLACK));
                p.Alignment = Element.ALIGN_CENTER;
                doc.Add(p);

                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                table = new PdfPTable(7);
                table.SetWidths(new float[] { 1.0f, 0.5f, 3.5f, 1.5f, 0.2f, 0.4f, 0.1f });

                cell = new PdfPCell(new Phrase(""));
                cell.Colspan = 7;
                SetBorder(cell, true, true, true, false);
                table.AddCell(cell);
                ////////////////////
                cell = new PdfPCell(new Phrase("EMERGENCIA", FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                SetBorder(cell, true, false, false, false);
                table.AddCell(cell);

                cbox = uncheck;
                if (Emergencia)
                    cbox = check;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cbox);

                cell = new PdfPCell(new Phrase("FECHA DE PRESENTACIÓN:", FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase("AVISO INICIAL", FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(""));
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                cbox = uncheck;
                if (Aviso.Equals("0"))
                    cbox = check;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cbox);

                cell = new PdfPCell(new Phrase(""));
                SetBorder(cell, false, false, true, false);
                table.AddCell(cell);

                //////////////////////////////////////////

                cell = new PdfPCell(new Phrase("EXCAVACIÓN", FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                SetBorder(cell, true, false, false, false);
                table.AddCell(cell);

                cbox = uncheck;
                if (TipoExcavacion)
                    cbox = check;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cbox);

                cell = new PdfPCell(new Phrase(FechaLetras, FontFactory.GetFont("Arial", 12, Font.BOLD, Color.BLACK)));
                cell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase("1RA EXTENSIÓN", FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(""));
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                cbox = uncheck;
                if (Aviso.Equals("1"))
                    cbox = check;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cbox);

                cell = new PdfPCell(new Phrase(""));
                SetBorder(cell, false, false, true, false);
                table.AddCell(cell);

                ///////////////////

                cell = new PdfPCell(new Phrase("DEMOLICIÓN", FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                SetBorder(cell, true, false, false, false);
                table.AddCell(cell);

                cbox = uncheck;
                if (!TipoExcavacion)
                    cbox = check;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cbox);

                cell = new PdfPCell(new Phrase(" "));
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase("2RA EXTENSIÓN", FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(" "));
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                cbox = uncheck;
                if (Aviso.Equals("2"))
                    cbox = check;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cbox);

                cell = new PdfPCell(new Phrase(" "));
                SetBorder(cell, false, false, true, false);
                table.AddCell(cell);

                //////////////////

                cell = new PdfPCell(new Phrase(""));
                cell.Colspan = 7;
                SetBorder(cell, true, false, true, true);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(""));
                cell.Colspan = 7;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                doc.Add(table);

                //Información del Solicitante----------------------------------------------------------------------------------------------------------
                table = new PdfPTable(20);

                cell = new PdfPCell(new Phrase("INFORMACIÓN DEL SOLICITANTE:", FontFactory.GetFont("Arial", 11, Font.BOLD, Color.BLACK)));
                cell.Colspan = 20;
                SetBorder(cell, true, true, true, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(""));
                cell.Colspan = 20;
                SetBorder(cell, true, false, true, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase("NOMBRE DE LA ENTIDAD:", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 6;
                SetBorder(cell, true, false, false, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(NombreEmpresa, FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.Colspan = 14;
                SetBorder(cell, false, false, true, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase("PERSONA CONTACTO:", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 5;
                SetBorder(cell, true, false, false, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(NombreContacto, FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.Colspan = 8;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase("TEL / CELULAR:", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 4;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(CelularContacto, FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                cell.Colspan = 3;
                SetBorder(cell, false, false, true, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(""));
                cell.Colspan = 20;
                SetBorder(cell, true, false, true, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase("DIRECCIÓN DONDE SE REALIZARÁ LA EXCAVACIÓN Y/O DEMOLICIÓN:", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 20;
                SetBorder(cell, true, false, true, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(BoUrb + ", " + SectorCalle + ", " + Carretera + ", " + Municipio, FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.Colspan = 20;
                SetBorder(cell, true, false, true, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(" "));
                cell.Colspan = 20;
                SetBorder(cell, true, false, true, false);
                table.AddCell(cell);
                cell.Colspan = 20;
                SetBorder(cell, true, false, true, true);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(""));
                cell.Colspan = 20;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                doc.Add(table);

                //----Información del Subcontratista---------------------------------------------------------------------------------------------------------------------------------------------------
                table = new PdfPTable(20);

                cell = new PdfPCell(new Phrase("INFORMACIÓN DEL SUBCONTRATISTA:", FontFactory.GetFont("Arial", 11, Font.BOLD, Color.BLACK)));
                cell.Colspan = 20;
                SetBorder(cell, true, true, true, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(""));
                cell.Colspan = 20;
                SetBorder(cell, true, false, true, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase("NOMBRE DE LA ENTIDAD:", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 6;
                SetBorder(cell, true, false, false, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(Subcontratista, FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.Colspan = 14;
                SetBorder(cell, false, false, true, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase("PERSONA CONTACTO:", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 5;
                SetBorder(cell, true, false, false, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(NombreContacto, FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.Colspan = 8;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase("TEL / CELULAR:", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 4;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(TelCelularSub, FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                cell.Colspan = 3;
                SetBorder(cell, false, false, true, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(" "));
                cell.Colspan = 20;
                SetBorder(cell, true, false, true, true);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(""));
                cell.Colspan = 20;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                doc.Add(table);

                //Información de los Trabajos a Realizar//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                table = new PdfPTable(20);
                cell = new PdfPCell(new Phrase("INFORMACIÓN DE LOS TRABAJOS A REALIZAR:", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 20;
                SetBorder(cell, true, true, true, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(""));
                cell.Colspan = 20;
                SetBorder(cell, true, false, true, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase("FECHA DE COMIENZO:", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 5;
                SetBorder(cell, true, false, false, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(FechaCom, FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                cell.Colspan = 3;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(" "));
                cell.Colspan = 4;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase("FECHA DE EXPIRACIÓN:", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 5;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(FechaExp, FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                cell.Colspan = 3;
                SetBorder(cell, false, false, true, false);

                table.AddCell(cell);

                cell = new PdfPCell(new Phrase("HORARIO EN QUE SE REALIZARÁ LA(S) EXCAVACIÓN Y/O DEMOLICIÓN", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 6;
                SetBorder(cell, true, false, false, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(Horario, FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.Colspan = 14;
                SetBorder(cell, false, false, true, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase(""));
                cell.Colspan = 20;
                SetBorder(cell, true, false, true, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase("MAQUINARIA", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 3;
                SetBorder(cell, true, false, false, false);
                table.AddCell(cell);

                cell.Colspan = 1;
                cbox = uncheck;
                if (Maquinaria)
                    cbox = check;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cbox);

                cell = new PdfPCell(new Phrase("SI", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 1;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                cell.Colspan = 1;
                cbox = uncheck;
                if (!Maquinaria)
                    cbox = check;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cbox);

                cell = new PdfPCell(new Phrase("NO", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 1;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase("DESCRIPCIÓN MAQUINARIA:", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 6;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(TipoMaquinaria, FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.Colspan = 7;
                SetBorder(cell, false, false, true, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase("EXPLOSIVOS", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 3;
                SetBorder(cell, true, false, false, false);
                table.AddCell(cell);

                cbox = uncheck;
                if (Explosivos)
                    cbox = check;
                cell.Colspan = 1;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cbox);

                cell = new PdfPCell(new Phrase("SI", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 1;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                cbox = uncheck;
                if (!Explosivos)
                    cbox = check;
                cell.Colspan = 1;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cbox);

                cell = new PdfPCell(new Phrase("NO", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 1;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase("NÚMERO LICENCIA EXPLOSIVOS:", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 7;
                SetBorder(cell, false, false, false, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(LicenciaExplosivos, FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.Colspan = 6;
                SetBorder(cell, false, false, true, false);
                table.AddCell(cell);
                ///////////////////////////////////////////
                cell = new PdfPCell(new Phrase(""));
                cell.Colspan = 20;
                SetBorder(cell, true, false, true, false);
                table.AddCell(cell);

                cell = new PdfPCell(new Phrase("DESCRIPCIÓN DE LOS TRABAJOS A REALIZAR:", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 20;
                SetBorder(cell, true, false, true, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(RazonTrabajos, FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.Colspan = 20;
                SetBorder(cell, true, false, true, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase("COMENTARIOS:", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK)));
                cell.Colspan = 4;
                SetBorder(cell, true, false, false, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(" ", FontFactory.GetFont("Arial", 9, Font.NORMAL, Color.BLACK)));
                cell.Colspan = 17;
                SetBorder(cell, false, false, true, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(" "));
                cell.Colspan = 20;
                SetBorder(cell, true, false, true, false);
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(" "));
                cell.Colspan = 20;
                SetBorder(cell, true, false, true, true);
                table.AddCell(cell);

                doc.Add(table);


                table = new PdfPTable(6);

                p = new Paragraph("\n\n" + NombreCoordinador + "\n___________________________________________________\n" +
                "  NOMBRE DEL COORDINADOR QUE AUTORIZÓ EL AVISO\n\n" +
                "                             FECHA: " + Fecha + "\n\n", FontFactory.GetFont("Arial", 9, Font.BOLD, Color.BLACK));
                p.Alignment = Element.ALIGN_LEFT;
                cell = new PdfPCell(new Phrase(p));
                cell.Colspan = 4;
                cell.Border = 0;
                table.AddCell(cell);
                cell = ImageCell("~/images/SelloOficialCertificacion.png", 10f, PdfPCell.ALIGN_RIGHT);
                cell.Colspan = 2;
                cell.Border = 0;
                table.AddCell(cell);

                p = new Paragraph("Advertencia: Esta certificación no constituye un permiso para excavar o demoler dentro de la jurisdicción del \n" +
                "Estado Libre Asociado de Puerto Rico. La misma deberá  ser mostrada a solicitud de la Policía de Puerto Rico,\n" +
                "Policía Municipal, Cuerpo de Bomberos, Oficiales del COT, Inspectores de DTOP y CSP y cualquier funcionario\n" +
                "del DTOP que asi lo solicite.", FontFactory.GetFont("Arial", 6, Font.NORMAL, Color.BLACK));
                p.Alignment = Element.ALIGN_JUSTIFIED;
                cell = new PdfPCell(new Phrase(p));
                cell.Border = 0;
                cell.Colspan = 4;
                table.AddCell(cell);
                p = new Paragraph("                     SELLO          OFICIAL", FontFactory.GetFont("Arial", 10, Font.NORMAL, Color.BLACK));
                p.Alignment = Element.ALIGN_RIGHT;
                cell = new PdfPCell(new Phrase(p));
                cell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                cell.Border = 0;
                cell.Colspan = 2;
                table.AddCell(cell);


                doc.Add(table);

                doc.Close();
                byte[] bytes = memoryStream.ToArray();
                memoryStream.Close();
                Response.Clear();
                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-Disposition", "attachment; filename=" + NumeroControl + ".pdf");
                Response.ContentType = "application/pdf";
                Response.Buffer = true;
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.BinaryWrite(bytes);
                Response.End();
                Response.Close();
            }
        }
        public void Go()
        {
            // GetClassOutputPath() implementation left out for brevity
            var outputFile = Helpers.IO.GetClassOutputPath(this);

            using (FileStream stream = new FileStream(
                outputFile, 
                FileMode.Create, 
                FileAccess.Write))
            {
                string chunkText = "FirstName LastName (2016-01-13 11:13)";
                Random random = new Random();
                var font = new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD); 
                using (Document document = new Document())
                {
                    PdfWriter.GetInstance(document, stream);
                    document.Open();
                    Phrase phrase = new Phrase();
                    for (var i = 0; i < 1000; ++i)
                    {
                        var asterisk = new String('*', random.Next(1, 20));
                        Chunk chunk = new Chunk(
                            string.Format("[{0}] {1}", asterisk, chunkText), 
                            font
                        );
                        chunk.SetSplitCharacter(new CustomSplitCharacter());
                        phrase.Add(chunk);
                    }
 
                    document.Add(phrase);
                }
            }
        }