A ListItem is a Paragraph that can be added to a List.
Inheritance: Paragraph
Example #1
1
        public void Write(string outputPath, FlowDocument doc)
        {
            Document pdfDoc = new Document(PageSize.A4, 50, 50, 50, 50);
            Font textFont = new Font(baseFont, DEFAULT_FONTSIZE, Font.NORMAL, BaseColor.BLACK);
            Font headingFont = new Font(baseFont, DEFAULT_HEADINGSIZE, Font.BOLD, BaseColor.BLACK);
            using (FileStream stream = new FileStream(outputPath, FileMode.Create))
            {
                PdfWriter writer = PdfWriter.GetInstance(pdfDoc, stream);
                pdfDoc.Open();
                foreach (Block i in doc.Blocks) {
                    if (i is System.Windows.Documents.Paragraph)
                    {
                        TextRange range = new TextRange(i.ContentStart, i.ContentEnd);
                        Console.WriteLine(i.Tag);
                        switch (i.Tag as string)
                        {
                            case "Paragraph": iTextSharp.text.Paragraph par = new iTextSharp.text.Paragraph(range.Text, textFont);
                                par.Alignment = Element.ALIGN_JUSTIFIED;
                                              pdfDoc.Add(par);
                                              break;
                            case "Heading": iTextSharp.text.Paragraph head = new iTextSharp.text.Paragraph(range.Text, headingFont);
                                              head.Alignment = Element.ALIGN_CENTER;
                                              head.SpacingAfter = 10;
                                              pdfDoc.Add(head);
                                              break;
                            default:          iTextSharp.text.Paragraph def = new iTextSharp.text.Paragraph(range.Text, textFont);
                                              def.Alignment = Element.ALIGN_JUSTIFIED;
                                              pdfDoc.Add(def);
                                              break;

                        }
                    }
                    else if (i is System.Windows.Documents.List)
                    {
                        iTextSharp.text.List list = new iTextSharp.text.List(iTextSharp.text.List.UNORDERED, 10f);
                        list.SetListSymbol("\u2022");
                        list.IndentationLeft = 15f;
                        foreach (var li in (i as System.Windows.Documents.List).ListItems)
                        {
                            iTextSharp.text.ListItem listitem = new iTextSharp.text.ListItem();
                            TextRange range = new TextRange(li.Blocks.ElementAt(0).ContentStart, li.Blocks.ElementAt(0).ContentEnd);
                            string text = range.Text.Substring(1);
                            iTextSharp.text.Paragraph par = new iTextSharp.text.Paragraph(text, textFont);
                            listitem.SpacingAfter = 10;
                            listitem.Add(par);
                            list.Add(listitem);
                        }
                        pdfDoc.Add(list);
                    }

               }
                if (pdfDoc.PageNumber == 0)
                {
                    iTextSharp.text.Paragraph par = new iTextSharp.text.Paragraph(" ");
                    par.Alignment = Element.ALIGN_JUSTIFIED;
                    pdfDoc.Add(par);
                }
               pdfDoc.Close();
            }
        }
Example #2
0
// ---------------------------------------------------------------------------
    /**
     * Creates the PDF.
     * @return the bytes of a PDF file.
     */
    public byte[] CreatePdf() {
      using (MemoryStream ms = new MemoryStream()) {
        using (Document document = new Document()) {
          PdfWriter writer = PdfWriter.GetInstance(document, ms);
          document.Open();
          document.Add(new Paragraph(
            "This is a list of Kubrick movies available in DVD stores."
          ));
          IEnumerable<Movie> movies = PojoFactory.GetMovies(1)
            .Concat(PojoFactory.GetMovies(4))
          ;          
          List list = new List();
          string RESOURCE = Utility.ResourcePosters;
          foreach (Movie movie in movies) {
            PdfAnnotation annot = PdfAnnotation.CreateFileAttachment(
              writer, null, 
              movie.GetMovieTitle(false), null,
              Path.Combine(RESOURCE, movie.Imdb + ".jpg"),
              string.Format("{0}.jpg", movie.Imdb)              
            );
            ListItem item = new ListItem(movie.GetMovieTitle(false));
            item.Add("\u00a0\u00a0");
            Chunk chunk = new Chunk("\u00a0\u00a0\u00a0\u00a0");
            chunk.SetAnnotation(annot);
            item.Add(chunk);
            list.Add(item);
          }
          document.Add(list);
        }
        return ms.ToArray();
      }
    }    
Example #3
0
 /* (non-Javadoc)
  * @see com.itextpdf.tool.xml.ITagProcessor#endElement(com.itextpdf.tool.xml.Tag, java.util.List)
  */
 public override IList<IElement> End(IWorkerContext ctx, Tag tag, IList<IElement> currentContent) {
     IList<IElement> l = new List<IElement>(1);
     ListItem li = new ListItem();
     foreach (IElement e in currentContent) {
             li.Add(e);
     }
     l.Add(li); // css applying is handled in the OrderedUnorderedList Class.
     return l;
 }
Example #4
0
// ===========================================================================
    public void Write(Stream stream) {
      // step 1
      using (Document document = new Document()) {
        // step 2
        PdfWriter.GetInstance(document, stream);
        // step 3
        document.Open();
        // step 4
        var SQL = 
@"SELECT DISTINCT mc.country_id, c.country, count(*) AS c
FROM film_country c, film_movie_country mc
WHERE c.id = mc.country_id
GROUP BY mc.country_id, country ORDER BY c DESC";  
        // Create a list for the countries
        List list = new RomanList();
        // loop over the countries
        using (var c =  AdoDB.Provider.CreateConnection()) {
          c.ConnectionString = AdoDB.CS;
          using (DbCommand cmd = c.CreateCommand()) {
            cmd.CommandText = SQL;        
            c.Open();            
            using (var r = cmd.ExecuteReader()) {
              while (r.Read()) {
              // create a list item for the country
                ListItem item = new ListItem(
                  string.Format("{0}: {1} movies",
                    r["country"].ToString(), r["c"].ToString()
                  )
                );
                // Create a list for the movies
                List movielist = new GreekList();
                movielist.Lowercase = List.LOWERCASE;
                // Loop over the movies
                foreach (Movie movie in 
                    PojoFactory.GetMovies(r["country_id"].ToString())
                ) {
                  ListItem movieitem = new ListItem(movie.MovieTitle);
                  // Create a list for the directors
                  List directorlist = new ZapfDingbatsNumberList(0); 
                  // Loop over the directors                 
                  foreach (Director director in movie.Directors) {
                    directorlist.Add(String.Format("{0}, {1}",
                      director.Name, director.GivenName
                    ));
                  }
                  movieitem.Add(directorlist);
                  movielist.Add(movieitem);
                }
                item.Add(movielist);
                list.Add(item);
              }
              document.Add(list);
            }
          }
        }
      }
    }
 // ---------------------------------------------------------------------------
 /**
  * Creates the PDF.
  * @return the bytes of a PDF file.
  */
 public byte[] CreatePdf()
 {
     IEnumerable<Movie> movies = PojoFactory.GetMovies(1);
       using (MemoryStream ms = new MemoryStream()) {
     using (Document document = new Document()) {
       PdfWriter writer = PdfWriter.GetInstance(document, ms);
       document.Open();
       document.Add(new Paragraph(
     "'Stanley Kubrick: A Life in Pictures'"
     + " is a documentary about Stanley Kubrick and his films:"
       ));
       StringBuilder sb = new StringBuilder();
       sb.AppendLine("<movies>");
       List list = new List(List.UNORDERED, 20);
       foreach (Movie movie in movies) {
     sb.AppendLine("<movie>");
     sb.AppendLine(String.Format(
       "<title>{0}</title>",
       XMLUtil.EscapeXML(movie.MovieTitle, true)
     ));
     sb.AppendLine(String.Format("<year>{0}</year>", movie.Year));
     sb.AppendLine(String.Format(
       "<duration>{0}</duration>", movie.Duration
     ));
     sb.AppendLine("</movie>");
     ListItem item = new ListItem(movie.MovieTitle);
     list.Add(item);
       }
       document.Add(list);
       sb.Append("</movies>");
       PdfFileSpecification fs = PdfFileSpecification.FileEmbedded(
     writer, null, "kubrick.xml", Encoding.UTF8.GetBytes(sb.ToString())
     //txt.toByteArray()
       );
       writer.AddFileAttachment(fs);
     }
     return ms.ToArray();
       }
 }
 /* (non-Javadoc)
  * @see com.itextpdf.tool.xml.ITagProcessor#endElement(com.itextpdf.tool.xml.Tag, java.util.List)
  */
 public override IList<IElement> End(IWorkerContext ctx, Tag tag, IList<IElement> currentContent) {
     IList<IElement> l = new List<IElement>(1);
     ListItem li = new ListItem();
     float maxSize = -1;
     foreach (IElement e in currentContent) {
         li.Add(e);
         //finding max leading among list item elements
         foreach (Chunk chunk in e.Chunks) {
             // here we use 4f/3 multiplied leading value to simulate leading which is used with default font size
             float currFontSize = chunk.Font.GetCalculatedLeading(4f/3);
             if (maxSize < currFontSize) {
                 maxSize = currFontSize;
             }
         }
     }
     if (li.Leading < maxSize)
         li.Leading = maxSize;
     if (li.Trim()) {
         l.Add(li); // css applying is handled in the OrderedUnorderedList Class.
     }
     return l;
 }
Example #7
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
        Image img = Image.GetInstance(IMG_BOX);
        document.Add(img);
        List list = new List(List.UNORDERED, 20);
        PdfDestination dest = new PdfDestination(PdfDestination.FIT);
        dest.AddFirst(new PdfNumber(1));
        IEnumerable<Movie> box = PojoFactory.GetMovies(1)
          .Concat(PojoFactory.GetMovies(4))
        ;
        foreach (Movie movie in box) {
          if (movie.Year > 1960) {
            PdfFileSpecification fs = PdfFileSpecification.FileEmbedded(
              writer, null,
              String.Format("kubrick_{0}.pdf", movie.Imdb),
              CreateMoviePage(movie)
            );
            fs.AddDescription(movie.Title, false);
            writer.AddFileAttachment(fs);
            ListItem item = new ListItem(movie.MovieTitle);
            PdfTargetDictionary target = new PdfTargetDictionary(true);
            target.EmbeddedFileName = movie.Title;
            PdfAction action = PdfAction.GotoEmbedded(null, target, dest, true);
            Chunk chunk = new Chunk(" (see info)");
            chunk.SetAction(action);
            item.Add(chunk);
            list.Add(item);
          }
        }
        document.Add(list);
      }
    }
        virtual public void SetUp() {
            LoggerFactory.GetInstance().SetLogger(new SysoLogger(3));
            root = new Tag("body");
            p = new Tag("p");
            ul = new Tag("ul");
            first = new Tag("li");
            last = new Tag("li");

            single = new ListItem("Single");
            start = new ListItem("Start");
            end = new ListItem("End");

            listWithOne = new List<IElement>();
            listWithTwo = new List<IElement>();
            orderedUnorderedList = new OrderedUnorderedList();
            CssAppliersImpl cssAppliers = new CssAppliersImpl();
            orderedUnorderedList.SetCssAppliers(cssAppliers);
            workerContextImpl = new WorkerContextImpl();
            HtmlPipelineContext context2 = new HtmlPipelineContext(cssAppliers);
            workerContextImpl.Put(typeof (HtmlPipeline).FullName, context2);
            root.AddChild(p);
            root.AddChild(ul);
            ul.AddChild(first);
            ul.AddChild(last);
            p.CSS["font-size"] = "12pt";
            p.CSS["margin-top"] = "12pt";
            p.CSS["margin-bottom"] = "12pt";
            new ParagraphCssApplier(cssAppliers).Apply(new Paragraph("paragraph"), p, context2);
            first.CSS["margin-top"] = "50pt";
            first.CSS["padding-top"] = "25pt";
            first.CSS["margin-bottom"] = "50pt";
            first.CSS["padding-bottom"] = "25pt";
            last.CSS["margin-bottom"] = "50pt";
            last.CSS["padding-bottom"] = "25pt";
            listWithOne.Add(single);
            listWithTwo.Add(start);
            listWithTwo.Add(end);
        }
Example #9
0
 public ListBody(ListItem parentItem, float indentation) : this(parentItem) {
     this.indentation = indentation;
 }
Example #10
0
 protected internal ListBody(ListItem parentItem) {
     this.parentItem = parentItem;
 }
Example #11
0
        // methods

        public override Paragraph CloneShallow(bool spacingBefore) {
            ListItem copy = new ListItem();
            PopulateProperties(copy, spacingBefore);
            return copy;
        }
Example #12
0
        /**
         * Breaks this Paragraph up in different parts, separating paragraphs, lists and tables from each other.
         * @return
         */
        public IList <IElement> breakUp()
        {
            IList <IElement> list = new List <IElement>();
            Paragraph        tmp  = null;

            foreach (IElement e in this)
            {
                if (e.Type == Element.LIST || e.Type == Element.PTABLE || e.Type == Element.PARAGRAPH)
                {
                    if (tmp != null && tmp.Count > 0)
                    {
                        tmp.SpacingAfter = 0;
                        list.Add(tmp);
                        tmp = cloneShallow(false);
                    }
                    if (list.Count == 0)
                    {
                        switch (e.Type)
                        {
                        case Element.PTABLE:
                            ((PdfPTable)e).SpacingBefore = SpacingBefore;
                            break;

                        case Element.PARAGRAPH:
                            ((Paragraph)e).SpacingBefore = SpacingBefore;
                            break;

                        case Element.LIST:
                            ListItem firstItem = ((List)e).GetFirstItem();
                            if (firstItem != null)
                            {
                                firstItem.SpacingBefore = SpacingBefore;
                            }
                            break;

                        default:
                            break;
                        }
                    }
                    list.Add(e);
                }
                else
                {
                    if (tmp == null)
                    {
                        tmp = cloneShallow(list.Count == 0);
                    }
                    tmp.Add(e);
                }
            }
            if (tmp != null && tmp.Count > 0)
            {
                list.Add(tmp);
            }
            if (list.Count != 0)
            {
                IElement lastElement = list[list.Count - 1];
                switch (lastElement.Type)
                {
                case Element.PTABLE:
                    ((PdfPTable)lastElement).SpacingAfter = SpacingAfter;
                    break;

                case Element.PARAGRAPH:
                    ((Paragraph)lastElement).SpacingAfter = SpacingAfter;
                    break;

                case Element.LIST:
                    ListItem lastItem = ((List)lastElement).GetLastItem();
                    if (lastItem != null)
                    {
                        lastItem.SpacingAfter = SpacingAfter;
                    }
                    break;

                default:
                    break;
                }
            }
            return(list);
        }
Example #13
0
 /**
 * Constructs a RtfListItem for a ListItem belonging to a RtfDocument.
 *
 * @param doc The RtfDocument this RtfListItem belongs to.
 * @param listItem The ListItem this RtfListItem is based on.
 */
 public RtfListItem(RtfDocument doc, ListItem listItem)
     : base(doc, listItem)
 {
 }
Example #14
0
 public static ListItem GetListItem(Properties attributes)
 {
     ListItem item = new ListItem(GetParagraph(attributes));
     return item;
 }
Example #15
0
 /**
  * Creates an iText Paragraph object using the properties
  * of the different tags and properties in the hierarchy chain.
  * @param   chain   the hierarchy chain
  * @return  a ListItem without any content
  */
 public ListItem CreateListItem(ChainedProperties chain) {
     ListItem item = new ListItem();
     UpdateElement(item, chain);
     return item;
 }
Example #16
0
        public void CreateTaggedPdf7() {
            InitializeDocument("7");
            List list = new List(true);
            try {
                list = new List(true);
                ListItem listItem =
                    new ListItem(
                        new Chunk(
                            "Quick brown fox jumped over a lazy dog. A very long line appears here because we need new line."));
                list.Add(listItem);
                Image i = Image.GetInstance(RESOURCES + "img\\fox.bmp");
                Chunk c = new Chunk(i, 0, 0);
                c.SetAccessibleAttribute(PdfName.ALT, new PdfString("Fox image"));
                listItem = new ListItem(c);
                list.Add(listItem);
                listItem = new ListItem(new Chunk("jumped over a lazy"));
                list.Add(listItem);
                i = Image.GetInstance(RESOURCES + "img\\dog.bmp");
                c = new Chunk(i, 0, 0);
                c.SetAccessibleAttribute(PdfName.ALT, new PdfString("Dog image"));
                listItem = new ListItem(c);
                list.Add(listItem);
                listItem = new ListItem(new Paragraph(text));
                list.Add(listItem);
            }
            catch (Exception) {
            }
            document.Add(h1);
            document.Add(list);
            document.Close();

            int[] nums = new int[] {63, 14};
            CheckNums(nums);
            CompareResults("7");
        }
Example #17
0
    private void GeneratePDFAndMail()
    {
        log4net.ILog log = log4net.LogManager.GetLogger("ServiceRowDataBound");
           log4net.Config.XmlConfigurator.Configure();

        StringWriter sw = new StringWriter();
        HtmlTextWriter hw = new HtmlTextWriter(sw);

        StringReader sr = new StringReader(sw.ToString());
        Document pdfDoc = new Document(PageSize.A4, 7f, 7f, 7f, 0f);
        HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
        MemoryStream memoryStream = new MemoryStream();
        PdfWriter writer = PdfWriter.GetInstance(pdfDoc, memoryStream);
        pdfDoc.Open();

           /* iTextSharp.text.Image imgStlogo = iTextSharp.text.Image.GetInstance(iTextSharp.text.Image.GetInstance(Server.MapPath(@"StG_Master_Logo_RGB.jpg")));
        imgStlogo.SetAbsolutePosition(0, pdfDoc.PageSize.Height - imgStlogo.Height);
        pdfDoc.Add(imgStlogo);
        pdfDoc.Add(new Paragraph(" "));
        pdfDoc.Add(new Paragraph(" "));
        pdfDoc.Add(new Paragraph(" "));*/

        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(""));

        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 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", 8f, 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 " + txtName.Text, 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 CodeFonewFourProduct
        PdfPTable pdfpTableAdditionalProductnew = new PdfPTable(2);
        pdfpTableAdditionalProductnew.WidthPercentage = 100f;
        int[] TableAdditionalProductwidthnew = { 30, 70 };
        pdfpTableAdditionalProductnew.SetWidths(TableAdditionalProductwidthnew);

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

        //Used to checked Last Five product is selected
        bool isLastFourProductSelected = false;
        if (fifteenid.Checked)
        {
           // pdfDoc.NewPage();
            pdfpTableAdditionalProductnew.AddCell(cellAdditionalProductnew);
            isLastFourProductSelected = true;

            PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine +Environment.NewLine +"Planning and Setup", FontTypeBold));
            pdfpTableAdditionalProductnew.AddCell(Cell1);
            phrase = new Phrase();
            phrase.Add(new Chunk("Make a business plan?", 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("Follow the PlanHQ business plan wizard to produce a personalised business plan",FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Understand and manage the tasks associated with setting up a business",FontType)));

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

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

        }
        if (sixteenid.Checked)
        {
            if (!isLastFourProductSelected)
            {
               // pdfDoc.NewPage();
                pdfpTableAdditionalProductnew.AddCell(cellAdditionalProductnew);
                isLastFourProductSelected = true;
            }
            PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine +Environment.NewLine +"Manage Finances", FontTypeBold));
            pdfpTableAdditionalProductnew.AddCell(Cell1);
            phrase = new Phrase();
            phrase.Add(new Chunk("Track money coming in and out of the business?", FontTypeBold));
           phrase.Add(new Chunk("      and/or",FontType));
            phrase.Add(new Chunk(Environment.NewLine + "Keep track of receipts without the data entry?", 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("Saasu helps make managing and monitoring business cash flow and finances simpler and more straightforward",FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Receipt Bank is the quick and easy way of recording receipts and invoices. No more entering data manually – just take a photo of a receipt and send it for processing in the click of a button",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;
                pdfpTableAdditionalProductnew.AddCell(objCell);

        }
        if (seventeenid.Checked)
        {
            if (!isLastFourProductSelected)
            {
                //pdfDoc.NewPage();
                pdfpTableAdditionalProductnew.AddCell(cellAdditionalProductnew);
                isLastFourProductSelected = true;
            }
            PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine +Environment.NewLine +"Grow Online", FontTypeBold));
            pdfpTableAdditionalProductnew.AddCell(Cell1);
            phrase = new Phrase();
            phrase.Add(new Chunk("Create a mobile friendly website to promote online?", FontTypeBold));
            phrase.Add(new Chunk("      and/or",FontType));
            phrase.Add(new Chunk(Environment.NewLine + "Create email campaigns to engage customers?", 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("Online includes an easy to use website builder, ongoing hosting, an e-commerce shop and a business domain name",FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Act! Cloud helps businesses manage their customer data and build professional e-marketing campaigns to turn opportunities into sales",FontType)));

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

        }
        if (eighteenid.Checked)
        {
            if (!isLastFourProductSelected)
            {
               // pdfDoc.NewPage();
                pdfpTableAdditionalProductnew.AddCell(cellAdditionalProductnew);
                isLastFourProductSelected = true;
            }
            PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine +Environment.NewLine +"Business Protection", FontTypeBold));
            pdfpTableAdditionalProductnew.AddCell(Cell1);
            phrase = new Phrase();
            phrase.Add(new Chunk("Protect the business from data loss?", FontTypeBold));
            phrase.Add(new Chunk("      and/or",FontType));
            phrase.Add(new Chunk(Environment.NewLine + "Create legal documents and 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("MozyPro helps safeguard business data by providing secure, automated, highly encrypted data backup. Lost, damaged or stolen files can be restored from MozyPro on demand",FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Law Central helps businesses to create the legal documents they need using a simple question-and-answer system. All documents are written and maintained by an Australian lawyer",FontType)));

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

        if (eighteenid.Checked && seventeenid.Checked  && sixteenid.Checked )
            {

            }
            else
            {
                //Business%20Access%20Saver
                var bizntu =  bizpacknameneshatnewproduct.Text;

                Phrase phBecauseTextu = new Phrase();
                phBecauseTextu.Add(new Chunk("Because the following have not been selected, 'My Business Connect' savings have not been unlocked:", FontType));

                Phrase phBecauseText21 = new Phrase();
                phBecauseText21.Add(new Chunk(Environment.NewLine + "My Business Connect", FontTypeBold));
                phBecauseText21.Add(new Chunk(Environment.NewLine + "Choose from four packages with market leading applications geared towards managing finances growing online, protecting business against risk and planning and setup"+bizntu, FontType));

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

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

                if(bizntu.Contains("Manage Finances")){
                     list.Add(new iTextSharp.text.ListItem(new Chunk("Manage Finances",FontType)));
                }
                if(bizntu.Contains("Grow Online")){
                     list.Add(new iTextSharp.text.ListItem(new Chunk("Grow Online",FontType)));
                }
                if(bizntu.Contains("Business Protection")){
                    list.Add(new iTextSharp.text.ListItem(new Chunk("Business Protection",FontType)));
                }

        list1 = new iTextSharp.text.List(false, 8);
                list1.ListSymbol = bullet;
        list1.Add(new iTextSharp.text.ListItem(new Chunk("Apps are accessible from any device with an internet connection.",FontType)));
                list1.Add(new iTextSharp.text.ListItem(new Chunk("Only one username and password is required to access all purchased applications.",FontType)));
                list1.Add(new iTextSharp.text.ListItem(new Chunk("Get one simple monthly bill for all applications.",FontType)));
        list1.Add(new iTextSharp.text.ListItem(new Chunk("Customer support is available to help with questions on how to use the apps.",FontType)));

                PdfPCell objCell = new PdfPCell();
                objCell.AddElement(phBecauseTextu);
                objCell.AddElement(list);
        objCell.AddElement(phBecauseText21);
                objCell.AddElement(list1);
            objCell.AddElement(new Phrase(" "));
                objCell.Colspan = 3;
                pdfpTableAdditionalProductnew.AddCell(objCell);

                //pdfDoc.Add(pdftblAllData);
            }

        pdfDoc.Add(pdfpTableAdditionalProductnew);
        #endregion CodeFornewFourProduct

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

         #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 (Eftposandmerchantfacilities.Checked)
        {
           // 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 (EquipmentFinance.Checked)
        {
            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 (LendingfortheBusiness.Checked)
        {
            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 (BankGuarantee.Checked)
        {
            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 (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));

        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 (BusinessChequeAccountPlus.Checked)
        {
             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 (FreedomBusinessAccount.Checked)
        {
           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 (BusinessVisaDebitCard.Checked)
        {
            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.PaddingTop = -5;
        //objCell1.PaddingBottom = 1;
        //objCell1.PaddingTop = 1;
                objCell.AddElement(phrase);
                objCell.AddElement(list);
                objCell.AddElement(new Phrase(" "));

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

        }

          if (BusinessAccessSaver.Checked)

        {
            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 (BusinessBankingOnline.Checked)
        {
            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);

        }
        var v1 =  cardintwo.Text;
        if (v1.Contains("Vantage"))
        {
            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);

        }

        var v2 =  cardintwo.Text;
        if (v2.Contains("Amplify"))
            {
                if (!IsTopFiveProductSelected)
                {
                    pdftblAllData.AddCell(cellBizPack);
                    IsTopFiveProductSelected = true;
                }
                PdfPCell Cell1 = new PdfPCell(new Phrase(Environment.NewLine + Environment.NewLine + "Amplify Business 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("Earn uncapped rewards points", FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Choose between two great reward programs - Amplify Rewards or Amplify Qantas", FontType)));
                list.Add(new iTextSharp.text.ListItem(new Chunk("Enjoy a range of complimentary insurance covers", FontType)));

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

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

            }

        if(BusinessAccessSaver.Checked && BusinessBankingOnline.Checked && (FreedomBusinessAccount.Checked || BusinessChequeAccountPlus.Checked)){
        var v3 =  cardintwo.Text;

        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)));
                //new product
                if (v3.Contains("Vantage")){
                   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)));
                }else{
                    list.Add(new iTextSharp.text.ListItem(new Chunk("Business Credit Card annual fee waived for up to 3 cards, saving up to $165 annually", FontType)));
                }
                //end new product
                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{

        var biznt =  bizpacknameneshat.Text;
             var v4 =  cardintwo.Text;

                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)));
                //new product
                if (v4.Contains("Vantage")){
                   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)));
                }else{
                    list.Add(new iTextSharp.text.ListItem(new Chunk("Business Credit Card annual fee waived for up to 3 cards, saving up to $165 annually", FontType)));
                }
                //end new product
                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);
        #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 13 November 2014. This offer may be withdrawn at any time, visit stgeorge.com.au and mybusinessconnect.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 mybusinessconnect.com.au and consider whether the product is appropriate for you. Credit criteria apply 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.	Equipment Finance by St.George Finance Limited ABN 99 001 094 471 Australian credit licence 387944.", 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 + "4.	MyBusinessConnect Planning and Setup, Manage Finances, Grow Online and Business Protection packages are managed by Business Centric Services Group (BCSG) Australia Pty Ltd ACN 160 840 899. MyBusinessConnect subscription fees are payable monthly in advance directly to BCSG. The amount payable will depend on the choice of products that you select from within MyBusinessConnect.  The payment due may increase if any additional products are ordered at a later date. You may terminate your subscription to MyBusinessConnect at any time by providing at least 30 days prior notice of termination.", 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);
        writer.CloseStream = false; //set the closestream property
        pdfDoc.Close(); //close the document without closing the underlying stream
        memoryStream.Position = 0;

           MailAddress to = new MailAddress (txtemail.Text);
        MailAddress from = new MailAddress (ConfigurationManager.AppSettings ["smtpUser"]);

        System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage(from, to);
           // mail.Attachments.Add(new Attachment(memoryStream, to + DateTime.Now.ToString("MMM-dd HH:mm") + ".pdf"));
        mail.Attachments.Add(new Attachment(memoryStream, "results.pdf"));
        mail.IsBodyHtml = true;

        mail.Subject = "St.George Business Account Selector results";

           // mail.Body = "Here are your Business Account Selector results. " + "<a href='" + txturl.Text + "'>Please click here to see your result on Stgeorge Website</a>";

        mail.Body = "<div style='width:50%;margin:auto;border:20px solid #f8f6e9;'><div style='width:100%;top:0px;height: 66px;background: #f8f6e9;margin-bottom: 0.12px;'></div><div style='border-top:0px;padding:20px;padding-top:40px;border-bottom:0px;padding-bottom:0px;'><p style='font-weight:bold;'>Hello&nbsp;" + txtName.Text + " </p><p>Thank you for completing the Business Account Selector tool.  You'll find your results attached to this email.</p><p>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. </p><p>Like every great relationship, it starts with a conversation. So if you have any questions or want to take the next steps, drop into your local St.George branch or call us on 133 800.</p><p>Thanks,<br />St.George</p></div></div>";

        SmtpClient client = new SmtpClient();
        var smtpSection = (SmtpSection)ConfigurationManager.GetSection("system.net/mailSettings/smtp");
        client.Credentials = new System.Net.NetworkCredential(smtpSection.Network.UserName, smtpSection.Network.Password);
        client.Port = smtpSection.Network.Port;
        client.Host = smtpSection.Network.Host;

        //if (mainFunctions.Production() == true)
        //{
            //client.EnableSsl = true;
        //}
        client.EnableSsl = true;
        try
        {
            client.Send(mail);
            lblFirst.Text="Mail sent..";
            txtName.Text="";
            txtemail.Text="";
        }
        catch (Exception ex)
        {
            lblFirst.Text="Error : Server down";
            txtName.Text="";
            txtemail.Text="";
            log.Fatal("Error in Submitbtn_Click() function." + ex.Message, ex);
        }
    }
Example #18
0
 protected internal ListLabel(ListItem parentItem) : base(parentItem)
 {
     role = PdfName.LBL;
     indentation = 0;
 }
Example #19
0
        /**
        * Constructs a new RtfList for the specified List.
        *
        * @param doc The RtfDocument this RtfList belongs to
        * @param list The List this RtfList is based on
        */
        public RtfList(RtfDocument doc, List list)
            : base(doc)
        {
            this.listNumber = document.GetDocumentHeader().GetListNumber(this);

            this.items = new ArrayList();
            if (list.SymbolIndent > 0 && list.IndentationLeft > 0) {
                this.firstIndent = (int) (list.SymbolIndent * RtfElement.TWIPS_FACTOR * -1);
                this.leftIndent = (int) ((list.IndentationLeft + list.SymbolIndent) * RtfElement.TWIPS_FACTOR);
            } else if (list.SymbolIndent > 0) {
                this.firstIndent = (int) (list.SymbolIndent * RtfElement.TWIPS_FACTOR * -1);
                this.leftIndent = (int) (list.SymbolIndent * RtfElement.TWIPS_FACTOR);
            } else if (list.IndentationLeft > 0) {
                this.firstIndent = 0;
                this.leftIndent = (int) (list.IndentationLeft * RtfElement.TWIPS_FACTOR);
            } else {
                this.firstIndent = 0;
                this.leftIndent = 0;
            }
            this.rightIndent = (int) (list.IndentationRight * RtfElement.TWIPS_FACTOR);
            this.symbolIndent = (int) ((list.SymbolIndent + list.IndentationLeft) * RtfElement.TWIPS_FACTOR);
            this.numbered = list.IsNumbered();

            for (int i = 0; i < list.Items.Count; i++) {
                try {
                    IElement element = (IElement) list.Items[i];
                    if (element.Type == Element.CHUNK) {
                        element = new ListItem((Chunk) element);
                    }
                    if (element is ListItem) {
                        this.alignment = ((ListItem) element).Alignment;
                    }
                    IRtfBasicElement rtfElement = doc.GetMapper().MapElement(element);
                    if (rtfElement is RtfList) {
                        ((RtfList) rtfElement).SetListNumber(listNumber);
                        ((RtfList) rtfElement).SetListLevel(listLevel + 1);
                        ((RtfList) rtfElement).SetParent(this);
                    } else if (rtfElement is RtfListItem) {
                        ((RtfListItem) rtfElement).SetParent(this);
                        ((RtfListItem) rtfElement).InheritListSettings(listNumber, listLevel + 1);
                    }
                    items.Add(rtfElement);
                } catch (DocumentException ) {
                }
            }
            if (this.listLevel == 0) {
                CorrectIndentation();
            }

            fontNumber = new ST.RtfFont(document, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL, new Color(0, 0, 0)));
            fontBullet = new ST.RtfFont(document, new Font(Font.SYMBOL, 10, Font.NORMAL, new Color(0, 0, 0)));
        }
Example #20
0
// ---------------------------------------------------------------------------
    /**
     * Creates a PDF with information about the movies
     * @param    filename the name of the PDF file that will be created.
     */
    public byte[] CreatePdf(int compression) {
      using (MemoryStream ms = new MemoryStream()) {
      // step 1
        using (Document document = new Document()) {
        // step 2
          PdfWriter writer = PdfWriter.GetInstance(document, ms);
          switch(compression) {
            case -1:
              Document.Compress = false;
              break;
            case 0:
              writer.CompressionLevel = 0;
              break;
            case 2:
              writer.CompressionLevel = 9;
              break;
            case 3:
              writer.SetFullCompression();
              break;
          }
          // step 3
          document.Open();
        // step 4
        // Create database connection and statement
          var SQL = 
@"SELECT DISTINCT mc.country_id, c.country, count(*) AS c 
FROM film_country c, film_movie_country mc 
  WHERE c.id = mc.country_id
GROUP BY mc.country_id, country ORDER BY c DESC";
        // Create a new list
          List list = new List(List.ORDERED);
          DbProviderFactory dbp = AdoDB.Provider;
          using (var c = dbp.CreateConnection()) {
            c.ConnectionString = AdoDB.CS;
            using (DbCommand cmd = c.CreateCommand()) {
              cmd.CommandText = SQL;
              c.Open();            
              using (var r = cmd.ExecuteReader()) {
                while (r.Read()) {
                // create a list item for the country
                  ListItem item = new ListItem(
                    String.Format("{0}: {1} movies", r["country"], r["c"]),
                    FilmFonts.BOLDITALIC
                  );
                  // create a movie list for each country
                  List movielist = new List(List.ORDERED, List.ALPHABETICAL);
                  movielist.Lowercase = List.LOWERCASE;
                  foreach (Movie movie in 
                      PojoFactory.GetMovies(r["country_id"].ToString())) 
                  {
                    ListItem movieitem = new ListItem(movie.MovieTitle);
                    List directorlist = new List(List.UNORDERED);
                    foreach (Director director in movie.Directors) {
                      directorlist.Add(String.Format(
                        "{0}, {1}", director.Name, director.GivenName
                      ));
                    }
                    movieitem.Add(directorlist);
                    movielist.Add(movieitem);
                  }
                  item.Add(movielist);
                  list.Add(item);
                }
              }
            }
          }
          document.Add(list);
        }
        Document.Compress = true; 
        return ms.ToArray();
      }     
    }
Example #21
0
        private float AddList(string[] chunks, iTextSharp.text.Font font, float spacingBefore, float spacingAfter, float spacingBetween, int alignment, float lineHightMultiplier, string listSymbol, int padding, float indentationLeft, Document doc)
        {
            int count = 0;
            float height = 0;
            float fontSize = font.Size * lineHightMultiplier;
            var paragraph = new Paragraph();

            var list = new List(List.UNORDERED);
            list.SetListSymbol(listSymbol.PadRight(padding));
            list.IndentationLeft = indentationLeft;

            foreach (string item in chunks)
            {
                if (string.IsNullOrEmpty(item)) continue;
                var chunk = new Chunk(item, font);
                chunk.setLineHeight(font.Size * lineHightMultiplier);
                var listItem = new ListItem(chunk);
                listItem.SpacingBefore = spacingBetween;
                list.Add(listItem);
                count++;
            }

            if (count > 0)
            {
                paragraph.Add(list);
                paragraph.Alignment = alignment;
                paragraph.SpacingBefore = spacingBefore;
                paragraph.SpacingAfter = spacingAfter;
                doc.Add(paragraph);
                height = spacingBefore + spacingAfter + count * (fontSize + spacingBetween) - spacingBetween;
            }

            return height;
        }
        /// <summary>
        /// Creates the document.
        /// </summary>
        /// <param name="reservationSummaryList"></param>
        /// <param name="logoFileUrl"></param>
        /// <param name="font"></param>
        /// <param name="filterStartDate"></param>
        /// <param name="filterEndDate"></param>
        /// <returns></returns>
        public override byte[] GenerateReport(List <ReservationService.ReservationSummary> reservationSummaryList, string logoFileUrl, string font, DateTime?filterStartDate, DateTime?filterEndDate, string lavaTemplate = "")
        {
            //Fonts
            var titleFont              = FontFactory.GetFont(font, 16, Font.BOLD);
            var listHeaderFont         = FontFactory.GetFont(font, 12, Font.BOLD, Color.DARK_GRAY);
            var listSubHeaderFont      = FontFactory.GetFont(font, 10, Font.BOLD, Color.DARK_GRAY);
            var listItemFontNormal     = FontFactory.GetFont(font, 8, Font.NORMAL);
            var listItemFontUnapproved = FontFactory.GetFont(font, 8, Font.ITALIC, Color.MAGENTA);
            var noteFont = FontFactory.GetFont(font, 8, Font.NORMAL, Color.GRAY);

            // Bind to Grid
            var reservationSummaries = reservationSummaryList.Select(r => new
            {
                Id = r.Id,
                ReservationName                = r.ReservationName,
                ApprovalState                  = r.ApprovalState.ConvertToString(),
                Locations                      = r.ReservationLocations.ToList(),
                Resources                      = r.ReservationResources.ToList(),
                CalendarDate                   = r.EventStartDateTime.ToLongDateString(),
                EventStartDateTime             = r.EventStartDateTime,
                EventEndDateTime               = r.EventEndDateTime,
                ReservationStartDateTime       = r.ReservationStartDateTime,
                ReservationEndDateTime         = r.ReservationEndDateTime,
                EventDateTimeDescription       = r.EventTimeDescription,
                ReservationDateTimeDescription = r.ReservationTimeDescription,
                Ministry     = r.ReservationMinistry,
                ContactInfo  = String.Format("{0} {1}", r.EventContactPersonAlias.Person.FullName, r.EventContactPhoneNumber),
                SetupPhotoId = r.SetupPhotoId,
                Note         = r.Note
            })
                                       .OrderBy(r => r.EventStartDateTime)
                                       .GroupBy(r => r.EventStartDateTime.Date)
                                       .Select(r => r.ToList())
                                       .ToList();


            //Setup the document
            var document = new Document(PageSize.A4.Rotate(), 25, 25, 25, 25);

            var outputStream = new MemoryStream();
            var writer       = PdfWriter.GetInstance(document, outputStream);

            // Our custom Header and Footer is done using Event Handler
            SPACTwoColumnHeaderFooter PageEventHandler = new SPACTwoColumnHeaderFooter();

            writer.PageEvent = PageEventHandler;

            // Define the page header
            PageEventHandler.HeaderFont    = listHeaderFont;
            PageEventHandler.SubHeaderFont = listSubHeaderFont;
            PageEventHandler.HeaderLeft    = "Group";
            PageEventHandler.HeaderRight   = "1";
            document.Open();

            // Add logo
            try
            {
                iTextSharp.text.Image logo = iTextSharp.text.Image.GetInstance(logoFileUrl);

                logo.Alignment = iTextSharp.text.Image.RIGHT_ALIGN;
                logo.ScaleToFit(300, 55);
                document.Add(logo);
            }
            catch { }

            // Write the document
            var    today = RockDateTime.Today;
            var    filterStartDateTime = filterStartDate.HasValue ? filterStartDate.Value : today;
            var    filterEndDateTime   = filterEndDate.HasValue ? filterEndDate.Value : today.AddMonths(1);
            String title = String.Format("Reservations for: {0} - {1}", filterStartDateTime.ToString("MMMM d"), filterEndDateTime.ToString("MMMM d"));

            document.Add(new Paragraph(title, titleFont));

            Font zapfdingbats = new Font(Font.ZAPFDINGBATS);

            // Populate the Lists
            foreach (var reservationDay in reservationSummaries)
            {
                var firstReservation = reservationDay.FirstOrDefault();
                if (firstReservation != null)
                {
                    //Build Header
                    document.Add(Chunk.NEWLINE);
                    String listHeader = PageEventHandler.CalendarDate = firstReservation.CalendarDate;
                    document.Add(new Paragraph(listHeader, listHeaderFont));

                    //Build Subheaders
                    var listSubHeaderTable = new PdfPTable(8);
                    listSubHeaderTable.LockedWidth                   = true;
                    listSubHeaderTable.TotalWidth                    = PageSize.A4.Rotate().Width - document.LeftMargin - document.RightMargin;
                    listSubHeaderTable.HorizontalAlignment           = 0;
                    listSubHeaderTable.SpacingBefore                 = 10;
                    listSubHeaderTable.SpacingAfter                  = 0;
                    listSubHeaderTable.DefaultCell.BorderWidth       = 0;
                    listSubHeaderTable.DefaultCell.BorderWidthBottom = 1;
                    listSubHeaderTable.DefaultCell.BorderColorBottom = Color.DARK_GRAY;

                    listSubHeaderTable.AddCell(new Phrase("Name", listSubHeaderFont));
                    listSubHeaderTable.AddCell(new Phrase("Event Time", listSubHeaderFont));
                    listSubHeaderTable.AddCell(new Phrase("Reservation Time", listSubHeaderFont));
                    listSubHeaderTable.AddCell(new Phrase("Locations: NC, Unlock", listSubHeaderFont));
                    listSubHeaderTable.AddCell(new Phrase("Resources", listSubHeaderFont));
                    listSubHeaderTable.AddCell(new Phrase("Has Layout", listSubHeaderFont));
                    listSubHeaderTable.AddCell(new Phrase("Status", listSubHeaderFont));
                    listSubHeaderTable.AddCell(new Phrase("Contact Info", listSubHeaderFont));
                    PageEventHandler.IsHeaderShown = true;
                    document.Add(listSubHeaderTable);

                    foreach (var reservationSummary in reservationDay)
                    {
                        if (reservationSummary == reservationDay.Last())
                        {
                            PageEventHandler.IsHeaderShown = false;
                        }

                        //Build the list item table
                        var listItemTable = new PdfPTable(8);
                        listItemTable.LockedWidth             = true;
                        listItemTable.TotalWidth              = PageSize.A4.Rotate().Width - document.LeftMargin - document.RightMargin;
                        listItemTable.HorizontalAlignment     = 0;
                        listItemTable.SpacingBefore           = 0;
                        listItemTable.SpacingAfter            = 1;
                        listItemTable.DefaultCell.BorderWidth = 0;
                        //if ( string.IsNullOrWhiteSpace( reservationSummary.Note ) ||
                        //    reservationLocation != reservationSummary.Locations.First() )
                        //{
                        //    listItemTable.DefaultCell.BorderWidthBottom = 1;
                        //    listItemTable.DefaultCell.BorderColorBottom = Color.DARK_GRAY;
                        //}


                        //Add the list items
                        listItemTable.AddCell(new Phrase(reservationSummary.ReservationName, listItemFontNormal));

                        listItemTable.AddCell(new Phrase(reservationSummary.EventDateTimeDescription, listItemFontNormal));
                        listItemTable.AddCell(new Phrase(reservationSummary.ReservationDateTimeDescription, listItemFontNormal));

                        List locationList = new List(List.UNORDERED, 8f);
                        locationList.SetListSymbol("\u2022");
                        foreach (var reservationLocation in reservationSummary.Locations)
                        {
                            var listItem = new iTextSharp.text.ListItem(reservationLocation.Location.Name, listItemFontNormal);
                            if (reservationLocation.ApprovalState == ReservationLocationApprovalState.Approved)
                            {
                                listItem.Add(new Phrase("\u0034", zapfdingbats));
                            }
                            locationList.Add(listItem);
                        }

                        PdfPCell locationCell = new PdfPCell();
                        locationCell.Border        = 0;
                        locationCell.PaddingTop    = -2;
                        locationCell.PaddingBottom = 2;
                        locationCell.AddElement(locationList);
                        locationCell.BorderWidth = 0;
                        //if ( string.IsNullOrWhiteSpace( reservationSummary.Note ) ||
                        //    reservationLocation != reservationSummary.Locations.First() )
                        //{
                        //    locationCell.BorderWidthBottom = 1;
                        //    locationCell.BorderColorBottom = Color.DARK_GRAY;
                        //}
                        listItemTable.AddCell(locationCell);

                        List resourceList = new List(List.UNORDERED, 8f);
                        resourceList.SetListSymbol("\u2022");
                        foreach (var reservationResource in reservationSummary.Resources)
                        {
                            reservationResource.LoadReservationResourceAttributes();
                            var resourceListItem = new iTextSharp.text.ListItem(string.Format("{0} ({1})", reservationResource.Resource.Name, reservationResource.Resource.Quantity), listItemFontNormal);
                            resourceList.Add(resourceListItem);
                        }

                        PdfPCell resourceCell = new PdfPCell();
                        resourceCell.Border        = 0;
                        resourceCell.PaddingTop    = -2;
                        resourceCell.PaddingBottom = 2;
                        resourceCell.AddElement(resourceList);
                        resourceCell.BorderWidth = 0;
                        // resources
                        listItemTable.AddCell(resourceCell);

                        // Has Layout
                        listItemTable.AddCell(new Phrase((reservationSummary.SetupPhotoId.HasValue) ? "Yes" : "No", listItemFontNormal));

                        // approval status
                        listItemTable.AddCell(new Phrase(reservationSummary.ApprovalState, listItemFontNormal));

                        PdfPCell contactCell = new PdfPCell();
                        contactCell.Border        = 0;
                        contactCell.PaddingTop    = -2;
                        contactCell.PaddingBottom = 2;
                        contactCell.AddElement(new Phrase(reservationSummary.Ministry != null ? reservationSummary.Ministry.Name : string.Empty, listItemFontNormal));
                        contactCell.AddElement(new Phrase(reservationSummary.ContactInfo, listItemFontNormal));
                        contactCell.BorderWidth = 0;
                        //if ( string.IsNullOrWhiteSpace( reservationSummary.Note ) ||
                        //    reservationLocation != reservationSummary.Locations.First() )
                        //{
                        //    contactCell.BorderWidthBottom = 1;
                        //    contactCell.BorderColorBottom = Color.DARK_GRAY;
                        //}
                        listItemTable.AddCell(contactCell);

                        document.Add(listItemTable);

                        if (!string.IsNullOrWhiteSpace(reservationSummary.Note))
                        {
                            //document.Add( Chunk.NEWLINE );
                            var listNoteTable = new PdfPTable(8);
                            listNoteTable.LockedWidth                   = true;
                            listNoteTable.TotalWidth                    = PageSize.A4.Rotate().Width - document.LeftMargin - document.RightMargin;
                            listNoteTable.HorizontalAlignment           = 1;
                            listNoteTable.SpacingBefore                 = 0;
                            listNoteTable.SpacingAfter                  = 1;
                            listNoteTable.DefaultCell.BorderWidth       = 0;
                            listNoteTable.DefaultCell.BorderWidthBottom = 1;
                            listNoteTable.DefaultCell.BorderColorBottom = Color.DARK_GRAY;
                            listNoteTable.AddCell(new Phrase(string.Empty, noteFont));
                            var noteCell = new PdfPCell(new Phrase(reservationSummary.Note, noteFont));
                            noteCell.Border  = 0;
                            noteCell.Colspan = 7;
                            listNoteTable.AddCell(noteCell);

                            document.Add(listNoteTable);
                        }
                    }
                }
                document.NewPage();
            }

            document.Close();

            return(outputStream.ToArray());
        }
Example #23
0
 protected internal ListLabel(ListItem parentItem) : base(parentItem)
 {}
 // ---------------------------------------------------------------------------
 public void Write(Stream stream)
 {
     // step 1
     using (Document document = new Document())
     {
         // step 2
         PdfWriter.GetInstance(document, stream);
         // step 3
         document.Open();
         // step 4
         Director director;
         using (var c = AdoDB.Provider.CreateConnection())
         {
             c.ConnectionString = AdoDB.CS;
             using (DbCommand cmd = c.CreateCommand())
             {
                 cmd.CommandText = SQL;
                 c.Open();
                 using (var r = cmd.ExecuteReader())
                 {
                     while (r.Read())
                     {
                         // create a paragraph for the director
                         director = PojoFactory.GetDirector(r);
                         Paragraph p = new Paragraph(
                             PojoToElementFactory.GetDirectorPhrase(director));
                         // add a dotted line separator
                         p.Add(new Chunk(new DottedLineSeparator()));
                         // adds the number of movies of this director
                         p.Add(string.Format("movies: {0}", Convert.ToInt32(r["c"])));
                         document.Add(p);
                         // Creates a list
                         List list = new List(List.ORDERED);
                         list.IndentationLeft = 36;
                         list.IndentationRight = 36;
                         // Gets the movies of the current director
                         var director_id = Convert.ToInt32(r["id"]);
                         ListItem movieitem;
                         // LINQ allows us to on sort any movie object property inline;
                         // let's sort by Movie.Year, Movie.Title
                         var by_year = from m in PojoFactory.GetMovies(director_id)
                                       orderby m.Year, m.Title
                                       select m;
                         // loops over the movies
                         foreach (Movie movie in by_year)
                         {
                             // creates a list item with a movie title
                             movieitem = new ListItem(movie.MovieTitle);
                             // adds a vertical position mark as a separator
                             movieitem.Add(new Chunk(new VerticalPositionMark()));
                             var yr = movie.Year;
                             // adds the year the movie was produced
                             movieitem.Add(new Chunk(yr.ToString()));
                             // add an arrow to the right if the movie dates from 2000 or later
                             if (yr > 1999)
                             {
                                 movieitem.Add(PositionedArrow.RIGHT);
                             }
                             // add the list item to the list
                             list.Add(movieitem);
                         }
                         // add the list to the document
                         document.Add(list);
                     }
                 }
             }
         }
     }
 }
Example #25
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
        PdfCollection collection = new PdfCollection(PdfCollection.HIDDEN);
        PdfCollectionSchema schema = _collectionSchema();
        collection.Schema = schema;
        PdfCollectionSort sort = new PdfCollectionSort(KEYS);
        collection.Sort = sort;
        writer.Collection = collection;

        PdfCollectionItem collectionitem = new PdfCollectionItem(schema);
        PdfFileSpecification fs = PdfFileSpecification.FileEmbedded(
          writer, IMG_KUBRICK, "kubrick.jpg", null
        );
        fs.AddDescription("Stanley Kubrick", false);
        collectionitem.AddItem(TYPE_FIELD, "JPEG");
        fs.AddCollectionItem(collectionitem);
        writer.AddFileAttachment(fs);
        
        Image img = Image.GetInstance(IMG_BOX);
        document.Add(img);
        List list = new List(List.UNORDERED, 20);
        PdfDestination dest = new PdfDestination(PdfDestination.FIT);
        dest.AddFirst(new PdfNumber(1));
        PdfTargetDictionary intermediate;
        PdfTargetDictionary target;
        Chunk chunk;
        ListItem item;
        PdfAction action = null;

        IEnumerable<Movie> box = PojoFactory.GetMovies(1)
          .Concat(PojoFactory.GetMovies(4))
        ;
        StringBuilder sb = new StringBuilder();
        foreach (Movie movie in box) {
          if (movie.Year > 1960) {
            sb.AppendLine(String.Format(
              "{0};{1};{2}", movie.MovieTitle, movie.Year, movie.Duration
            ));
            item = new ListItem(movie.MovieTitle);
            if (!"0278736".Equals(movie.Imdb)) {
              target = new PdfTargetDictionary(true);
              target.EmbeddedFileName = movie.Title;
              intermediate = new PdfTargetDictionary(true);
              intermediate.FileAttachmentPage = 1;
              intermediate.FileAttachmentIndex = 1;
              intermediate.AdditionalPath = target;
              action = PdfAction.GotoEmbedded(null, intermediate, dest, true);
              chunk = new Chunk(" (see info)");
              chunk.SetAction(action);
              item.Add(chunk);
            }
            list.Add(item);
          }
        }
        document.Add(list);
        
        fs = PdfFileSpecification.FileEmbedded(
          writer, null, "kubrick.txt", 
          Encoding.UTF8.GetBytes(sb.ToString())
        );
        fs.AddDescription("Kubrick box: the movies", false);
        collectionitem.AddItem(TYPE_FIELD, "TXT");
        fs.AddCollectionItem(collectionitem);
        writer.AddFileAttachment(fs);

        PdfPTable table = new PdfPTable(1);
        table.SpacingAfter = 10;
        PdfPCell cell = new PdfPCell(new Phrase("All movies by Kubrick"));
        cell.Border = PdfPCell.NO_BORDER;
        fs = PdfFileSpecification.FileEmbedded(
          writer, null, KubrickMovies.FILENAME, 
          Utility.PdfBytes(new KubrickMovies())
          //new KubrickMovies().createPdf()
        );
        collectionitem.AddItem(TYPE_FIELD, "PDF");
        fs.AddCollectionItem(collectionitem);
        target = new PdfTargetDictionary(true);
        target.FileAttachmentPagename = "movies";
        target.FileAttachmentName = "The movies of Stanley Kubrick";
        cell.CellEvent = new PdfActionEvent(
          writer, PdfAction.GotoEmbedded(null, target, dest, true)
        );
        cell.CellEvent = new FileAttachmentEvent(
          writer, fs, "The movies of Stanley Kubrick"
        );
        cell.CellEvent = new LocalDestinationEvent(writer, "movies");
        table.AddCell(cell);
        writer.AddFileAttachment(fs);

        cell = new PdfPCell(new Phrase("Kubrick DVDs"));
        cell.Border = PdfPCell.NO_BORDER;
        fs = PdfFileSpecification.FileEmbedded(
          writer, null, 
          KubrickDvds.RESULT, new KubrickDvds().CreatePdf()
        );
        collectionitem.AddItem(TYPE_FIELD, "PDF");
        fs.AddCollectionItem(collectionitem);
        cell.CellEvent = new FileAttachmentEvent(writer, fs, "Kubrick DVDs");
        table.AddCell(cell);
        writer.AddFileAttachment(fs);
        
        cell = new PdfPCell(new Phrase("Kubrick documentary"));
        cell.Border = PdfPCell.NO_BORDER;
        fs = PdfFileSpecification.FileEmbedded(
          writer, null, 
          KubrickDocumentary.RESULT, new KubrickDocumentary().CreatePdf()
        );
        collectionitem.AddItem(TYPE_FIELD, "PDF");
        fs.AddCollectionItem(collectionitem);
        cell.CellEvent = new FileAttachmentEvent(
          writer, fs, "Kubrick Documentary"
        );
        table.AddCell(cell);
        writer.AddFileAttachment(fs);

        document.NewPage();
        document.Add(table);
      }
    }
Example #26
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);
        }
    }
Example #27
0
// ===========================================================================
    public void Write(Stream stream) {
      // step 1
      using (Document document = new Document()) {
        // step 2
        PdfWriter.GetInstance(document, stream);
        // step 3
        document.Open();
        // step 4
        var SQL = 
@"SELECT DISTINCT mc.country_id, c.country, count(*) AS c
FROM film_country c, film_movie_country mc
WHERE c.id = mc.country_id
GROUP BY mc.country_id, country ORDER BY c DESC";
        // Create a new list
        List list = new List(List.ORDERED);
        list.Autoindent = false;
        list.SymbolIndent = 36;
        // loop over the countries
        using (var c =  AdoDB.Provider.CreateConnection()) {
          c.ConnectionString = AdoDB.CS;
          using (DbCommand cmd = c.CreateCommand()) {
            cmd.CommandText = SQL;        
            c.Open();            
            using (var r = cmd.ExecuteReader()) {
              while (r.Read()) {
              // create a list item for the country
                ListItem item = new ListItem(
                  string.Format("{0}: {1} movies",
                    r["country"].ToString(), r["c"].ToString()
                  )
                );
                item.ListSymbol = new Chunk(r["country_id"].ToString());
                // Create a list for the movies produced in the current country
                List movielist = new List(List.ORDERED, List.ALPHABETICAL);
                movielist.Alignindent = false;

                foreach (Movie movie in 
                    PojoFactory.GetMovies(r["country_id"].ToString())
                ) {
                  ListItem movieitem = new ListItem(movie.MovieTitle);
                  List directorlist = new List(List.ORDERED);
                  directorlist.PreSymbol = "Director ";
                  directorlist.PostSymbol = ": ";
                  foreach (Director director in movie.Directors) {
                    directorlist.Add(String.Format("{0}, {1}",
                      director.Name, director.GivenName
                    ));
                  }


                  movieitem.Add(directorlist);
                  movielist.Add(movieitem);
                }
                item.Add(movielist);
                list.Add(item);
              }
              document.Add(list);
            }
          }
        }
      }
    }
Example #28
0
        private void AddAssumptions(Project project, Document document)
        {
            if (project.Assumptions == null || project.Assumptions.Count < 1)
                return;

            var element = new Paragraph("Assumptions", TitleFont());
            element.SpacingBefore = 5f;
            document.Add(element);

            var list = new List(false, false, 10);
            list.SetListSymbol("\u2022");
            list.IndentationLeft = 10f;

            foreach (var assumption in project.Assumptions)
            {
                var item = new ListItem(assumption);
                list.Add(item);
            }

            document.Add(list);
        }
        protected void lbPrint_Click(object sender, EventArgs e)
        {
            //Fonts
            String font                   = GetAttributeValue("ReportFont");
            var    titleFont              = FontFactory.GetFont(font, 16, Font.BOLD);
            var    listHeaderFont         = FontFactory.GetFont(font, 12, Font.BOLD, Color.DARK_GRAY);
            var    listSubHeaderFont      = FontFactory.GetFont(font, 10, Font.BOLD, Color.DARK_GRAY);
            var    listItemFontNormal     = FontFactory.GetFont(font, 8, Font.NORMAL);
            var    listItemFontUnapproved = FontFactory.GetFont(font, 8, Font.ITALIC, Color.MAGENTA);
            var    noteFont               = FontFactory.GetFont(font, 8, Font.NORMAL, Color.GRAY);

            List <ReservationService.ReservationSummary> reservationSummaryList = GetReservationSummaries();

            // Bind to Grid
            var reservationSummaries = reservationSummaryList.Select(r => new
            {
                Id = r.Id,
                ReservationName                = r.ReservationName,
                ApprovalState                  = r.ApprovalState.ConvertToString(),
                Locations                      = r.ReservationLocations.ToList(),
                Resources                      = r.ReservationResources.ToList(),
                CalendarDate                   = r.EventStartDateTime.ToLongDateString(),
                EventStartDateTime             = r.EventStartDateTime,
                EventEndDateTime               = r.EventEndDateTime,
                ReservationStartDateTime       = r.ReservationStartDateTime,
                ReservationEndDateTime         = r.ReservationEndDateTime,
                EventDateTimeDescription       = r.EventTimeDescription,
                ReservationDateTimeDescription = r.ReservationTimeDescription,
                SetupPhotoId                   = r.SetupPhotoId,
                Note = r.Note
            })
                                       .OrderBy(r => r.EventStartDateTime)
                                       .GroupBy(r => r.EventStartDateTime.Date)
                                       .Select(r => r.ToList())
                                       .ToList();

            //Setup the document
            var document = new Document(PageSize.A4, 25, 50, 0, 0);
            {
                document.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());;
            }

            var output = new MemoryStream();
            var writer = PdfWriter.GetInstance(document, output);

            document.Open();

            // Add logo
            try
            {
                string logoUri = GetAttributeValue("ReportLogo");
                string fileUrl = string.Empty;
                iTextSharp.text.Image logo;
                if (logoUri.ToLower().StartsWith("http"))
                {
                    logo = iTextSharp.text.Image.GetInstance(new Uri(logoUri));
                }
                else
                {
                    fileUrl = Server.MapPath(ResolveRockUrl(logoUri));
                    logo    = iTextSharp.text.Image.GetInstance(fileUrl);
                }

                logo.Alignment = iTextSharp.text.Image.RIGHT_ALIGN;
                logo.ScaleToFit(100, 55);
                document.Add(logo);
            }
            catch { }

            // Write the document
            var    today = RockDateTime.Today;
            var    filterStartDateTime = FilterStartDate.HasValue ? FilterStartDate.Value : today;
            var    filterEndDateTime   = FilterEndDate.HasValue ? FilterEndDate.Value : today.AddMonths(1);
            String title = String.Format("Reservations for: {0} - {1}", filterStartDateTime.ToString("MMMM d"), filterEndDateTime.ToString("MMMM d"));

            document.Add(new Paragraph(title, titleFont));

            var  fontAwesomeUrl = Server.MapPath(ResolveRockUrl(GetAttributeValue("FontAwesomeTtf")));
            var  fontAwesome    = BaseFont.CreateFont(fontAwesomeUrl, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
            Font fontAwe        = new Font(fontAwesome, 8);

            // Populate the Lists
            foreach (var reservationDay in reservationSummaries)
            {
                var firstReservation = reservationDay.FirstOrDefault();
                if (firstReservation != null)
                {
                    //Build Header
                    document.Add(Chunk.NEWLINE);
                    String listHeader = firstReservation.CalendarDate;
                    document.Add(new Paragraph(listHeader, listHeaderFont));

                    //Build Subheaders
                    var listSubHeaderTable = new PdfPTable(7);
                    listSubHeaderTable.LockedWidth                   = true;
                    listSubHeaderTable.TotalWidth                    = PageSize.A4.Width - document.LeftMargin - document.RightMargin;
                    listSubHeaderTable.HorizontalAlignment           = 0;
                    listSubHeaderTable.SpacingBefore                 = 10;
                    listSubHeaderTable.SpacingAfter                  = 0;
                    listSubHeaderTable.DefaultCell.BorderWidth       = 0;
                    listSubHeaderTable.DefaultCell.BorderWidthBottom = 1;
                    listSubHeaderTable.DefaultCell.BorderColorBottom = Color.DARK_GRAY;

                    listSubHeaderTable.AddCell(new Phrase("Name", listSubHeaderFont));
                    listSubHeaderTable.AddCell(new Phrase("Event Time", listSubHeaderFont));
                    listSubHeaderTable.AddCell(new Phrase("Reservation Time", listSubHeaderFont));
                    listSubHeaderTable.AddCell(new Phrase("Locations", listSubHeaderFont));
                    listSubHeaderTable.AddCell(new Phrase("Resources", listSubHeaderFont));
                    listSubHeaderTable.AddCell(new Phrase("Has Layout?", listSubHeaderFont));
                    listSubHeaderTable.AddCell(new Phrase("Status", listSubHeaderFont));

                    document.Add(listSubHeaderTable);

                    foreach (var reservationSummary in reservationDay)
                    {
                        //Build the list item table
                        var listItemTable = new PdfPTable(7);
                        listItemTable.LockedWidth             = true;
                        listItemTable.TotalWidth              = PageSize.A4.Width - document.LeftMargin - document.RightMargin;
                        listItemTable.HorizontalAlignment     = 0;
                        listItemTable.SpacingBefore           = 0;
                        listItemTable.SpacingAfter            = 1;
                        listItemTable.DefaultCell.BorderWidth = 0;

                        //Add the list items
                        listItemTable.AddCell(new Phrase(reservationSummary.ReservationName, listItemFontNormal));

                        listItemTable.AddCell(new Phrase(reservationSummary.EventDateTimeDescription, listItemFontNormal));

                        listItemTable.AddCell(new Phrase(reservationSummary.ReservationDateTimeDescription, listItemFontNormal));

                        List locationList = new List(List.UNORDERED, 8f);
                        locationList.SetListSymbol("\u2022");

                        foreach (var reservationLocation in reservationSummary.Locations)
                        {
                            var listItem = new iTextSharp.text.ListItem(reservationLocation.Location.Name, listItemFontNormal);
                            if (reservationLocation.ApprovalState == ReservationLocationApprovalState.Approved)
                            {
                                listItem.Add(new Phrase("\uf00c", fontAwe));
                            }
                            locationList.Add(listItem);
                        }

                        PdfPCell locationCell = new PdfPCell();
                        locationCell.Border     = 0;
                        locationCell.PaddingTop = -2;
                        locationCell.AddElement(locationList);
                        listItemTable.AddCell(locationCell);

                        List resourceList = new List(List.UNORDERED, 8f);
                        resourceList.SetListSymbol("\u2022");

                        foreach (var reservationResource in reservationSummary.Resources)
                        {
                            var listItem = new iTextSharp.text.ListItem(String.Format("{0}({1})", reservationResource.Resource.Name, reservationResource.Quantity), listItemFontNormal);
                            if (reservationResource.ApprovalState == ReservationResourceApprovalState.Approved)
                            {
                                listItem.Add(new Phrase("\uf00c", fontAwe));
                            }
                            resourceList.Add(listItem);
                        }

                        PdfPCell resourceCell = new PdfPCell();
                        resourceCell.Border     = 0;
                        resourceCell.PaddingTop = -2;
                        resourceCell.AddElement(resourceList);
                        listItemTable.AddCell(resourceCell);

                        listItemTable.AddCell(new Phrase(reservationSummary.SetupPhotoId.HasValue.ToYesNo(), listItemFontNormal));

                        var listItemFont = (reservationSummary.ApprovalState == "Unapproved") ? listItemFontUnapproved : listItemFontNormal;
                        listItemTable.AddCell(new Phrase(reservationSummary.ApprovalState, listItemFont));

                        document.Add(listItemTable);

                        if (!string.IsNullOrWhiteSpace(reservationSummary.Note))
                        {
                            //document.Add( Chunk.NEWLINE );
                            var listNoteTable = new PdfPTable(1);
                            listNoteTable.LockedWidth             = true;
                            listNoteTable.TotalWidth              = PageSize.A4.Width - document.LeftMargin - document.RightMargin - 50;
                            listNoteTable.HorizontalAlignment     = 1;
                            listNoteTable.SpacingBefore           = 0;
                            listNoteTable.SpacingAfter            = 1;
                            listNoteTable.DefaultCell.BorderWidth = 0;
                            listNoteTable.AddCell(new Phrase(reservationSummary.Note, noteFont));
                            document.Add(listNoteTable);
                        }
                    }
                }
            }

            document.Close();

            Response.ClearHeaders();
            Response.ClearContent();
            Response.Clear();
            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", string.Format("attachment;filename=Reservation Schedule for {0} - {1}.pdf", filterStartDateTime.ToString("MMMM d"), filterEndDateTime.ToString("MMMM d")));
            Response.BinaryWrite(output.ToArray());
            Response.Flush();
            Response.End();
            return;
        }
Example #30
0
 /**
  * Fills a java.util.List with all elements found in currentContent. Places elements that are not a {@link ListItem} or {@link com.itextpdf.text.List} in a new ListItem object.
  *
  * @param currentContent
  * @return java.util.List with only {@link ListItem}s or {@link com.itextpdf.text.List}s in it.
  */
 private IList<IElement> PopulateList(IList<IElement> currentContent)
 {
     IList<IElement> listElements = new List<IElement>();
     foreach (IElement e in currentContent) {
         if (e is ListItem || e is List) {
             listElements.Add(e);
         } else {
             ListItem listItem = new ListItem();
             listItem.Add(e);
             listElements.Add(listItem);
         }
     }
     return listElements;
 }
Example #31
0
 public static ListItem CreateListItem(ChainedProperties props) {
     ListItem p = new ListItem();
     CreateParagraph(p, props);
     return p;
 }
Example #32
0
        public void CreateTaggedPdf8() {
            InitializeDocument("8");

            ColumnText columnText = new ColumnText(writer.DirectContent);

            List list = new List(true);
            try {
                list = new List(true);
                ListItem listItem =
                    new ListItem(
                        new Chunk(
                            "Quick brown fox jumped over a lazy dog. A very long line appears here because we need new line."));
                list.Add(listItem);
                Image i = Image.GetInstance(RESOURCES + "img\\fox.bmp");
                Chunk c = new Chunk(i, 0, 0);
                c.SetAccessibleAttribute(PdfName.ALT, new PdfString("Fox image"));
                listItem = new ListItem(c);
                list.Add(listItem);
                listItem = new ListItem(new Chunk("jumped over a lazy"));
                list.Add(listItem);
                i = Image.GetInstance(RESOURCES + "img\\dog.bmp");
                c = new Chunk(i, 0, 0);
                c.SetAccessibleAttribute(PdfName.ALT, new PdfString("Dog image"));
                listItem = new ListItem(c);
                list.Add(listItem);
                listItem = new ListItem(new Paragraph(text));
                list.Add(listItem);
            }
            catch (Exception) {
            }
            columnText.SetSimpleColumn(36, 36, 400, 800);
            columnText.AddElement(h1);
            columnText.AddElement(list);
            columnText.Go();
            document.NewPage();
            columnText.SetSimpleColumn(36, 36, 400, 800);
            columnText.Go();
            document.Close();

            int[] nums = new int[] {64, 35};
            CheckNums(nums);
            CompareResults("8");
        }
Example #33
0
        /**
        * Constructs a new RtfList for the specified List.
        *
        * @param doc The RtfDocument this RtfList belongs to
        * @param list The List this RtfList is based on
        * @since 2.1.3
        */
        public RtfList(RtfDocument doc, List list)
            : base(doc)
        {
            // setup the listlevels
            // Then, setup the list data below

            // setup 1 listlevel if it's a simple list
            // setup 9 if it's a regular list
            // setup 9 if it's a hybrid list (default)
            CreateDefaultLevels();

            this.items = new ArrayList();       // list content
            RtfListLevel ll = (RtfListLevel)this.listLevels[0];

            // get the list number or create a new one adding it to the table
            this.listNumber = document.GetDocumentHeader().GetListNumber(this);

            if (list.SymbolIndent > 0 && list.IndentationLeft > 0) {
                ll.SetFirstIndent((int) (list.SymbolIndent * RtfElement.TWIPS_FACTOR * -1));
                ll.SetLeftIndent((int) ((list.IndentationLeft + list.SymbolIndent) * RtfElement.TWIPS_FACTOR));
            } else if (list.SymbolIndent > 0) {
                ll.SetFirstIndent((int) (list.SymbolIndent * RtfElement.TWIPS_FACTOR * -1));
                ll.SetLeftIndent((int) (list.SymbolIndent * RtfElement.TWIPS_FACTOR));
            } else if (list.IndentationLeft > 0) {
                ll.SetFirstIndent(0);
                ll.SetLeftIndent((int) (list.IndentationLeft * RtfElement.TWIPS_FACTOR));
            } else {
                ll.SetFirstIndent(0);
                ll.SetLeftIndent(0);
            }
            ll.SetRightIndent((int) (list.IndentationRight * RtfElement.TWIPS_FACTOR));
            ll.SetSymbolIndent((int) ((list.SymbolIndent + list.IndentationLeft) * RtfElement.TWIPS_FACTOR));
            ll.CorrectIndentation();
            ll.SetTentative(false);

            if (list is RomanList) {
                if (list.Lowercase) {
                    ll.SetListType(RtfListLevel.LIST_TYPE_LOWER_ROMAN);
                } else {
                    ll.SetListType(RtfListLevel.LIST_TYPE_UPPER_ROMAN);
                }
            } else if (list.Numbered) {
                ll.SetListType(RtfListLevel.LIST_TYPE_NUMBERED);
            } else if (list.Lettered) {
                if (list.Lowercase) {
                    ll.SetListType(RtfListLevel.LIST_TYPE_LOWER_LETTERS);
                } else {
                    ll.SetListType(RtfListLevel.LIST_TYPE_UPPER_LETTERS);
                }
            }
            else {
            //          Paragraph p = new Paragraph();
            //          p.Add(new Chunk(list.GetPreSymbol()) );
            //          p.Add(list.GetSymbol());
            //          p.Add(new Chunk(list.GetPostSymbol()) );
            //          ll.SetBulletChunk(list.GetSymbol());
                ll.SetBulletCharacter(list.PreSymbol + list.Symbol.Content + list.PostSymbol);
                ll.SetListType(RtfListLevel.LIST_TYPE_BULLET);
            }

            // now setup the actual list contents.
            for (int i = 0; i < list.Items.Count; i++) {
                try {
                    IElement element = (IElement) list.Items[i];

                    if (element.Type == Element.CHUNK) {
                        element = new ListItem((Chunk) element);
                    }
                    if (element is ListItem) {
                        ll.SetAlignment(((ListItem) element).Alignment);
                    }
                    IRtfBasicElement[] rtfElements = doc.GetMapper().MapElement(element);
                    for (int j = 0; j < rtfElements.Length; j++) {
                        IRtfBasicElement rtfElement = rtfElements[j];
                        if (rtfElement is RtfList) {
                            ((RtfList) rtfElement).SetParentList(this);
                        } else if (rtfElement is RtfListItem) {
                            ((RtfListItem) rtfElement).SetParent(ll);
                        }
                        ll.SetFontNumber( new RtfFont(document, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL, new Color(0, 0, 0))) );
                        if (list.Symbol != null && list.Symbol.Font != null && !list.Symbol.Content.StartsWith("-") && list.Symbol.Content.Length > 0) {
                            // only set this to bullet symbol is not default
                            ll.SetBulletFont( list.Symbol.Font);
                            ll.SetBulletCharacter(list.Symbol.Content.Substring(0, 1));
                        } else
                        if (list.Symbol != null && list.Symbol.Font != null) {
                            ll.SetBulletFont(list.Symbol.Font);

                        } else {
                            ll.SetBulletFont(new Font(Font.SYMBOL, 10, Font.NORMAL, new Color(0, 0, 0)));
                        }
                        items.Add(rtfElement);
                    }

                } catch (DocumentException) {
                }
            }
        }