当前位置: 首页>>代码示例>>C#>>正文


C# Chunk.SetUnderline方法代码示例

本文整理汇总了C#中iTextSharp.text.Chunk.SetUnderline方法的典型用法代码示例。如果您正苦于以下问题:C# Chunk.SetUnderline方法的具体用法?C# Chunk.SetUnderline怎么用?C# Chunk.SetUnderline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iTextSharp.text.Chunk的用法示例。


在下文中一共展示了Chunk.SetUnderline方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateDirectorPhrase

// ---------------------------------------------------------------------------
    /**
     * Creates a Phrase with the name and given name of a director using different fonts.
     * @param    rs    the ResultSet containing director records.
     */
    protected override Phrase CreateDirectorPhrase(DbDataReader r) {
      Phrase director = new Phrase();
      Chunk name = new Chunk(r["name"].ToString(), BOLD);
      name.SetUnderline(0.2f, -2f);
      director.Add(name);
      director.Add(new Chunk(",", BOLD));
      director.Add(new Chunk(" ", NORMAL));
      director.Add(
        new Chunk(r["given_name"].ToString(), NORMAL)
      );
      director.Leading = 24;
      return director;
    }
开发者ID:,项目名称:,代码行数:18,代码来源:

示例2: CreateTaggedPdf16

        public void CreateTaggedPdf16() {
            InitializeDocument("16");

            Paragraph p = new Paragraph();
            Chunk chunk = new Chunk("Hello tagged world!");
            chunk.SetBackground(new BaseColor(255, 0, 255));
            chunk.Font = FontFactory.GetFont("TimesNewRoman", 20, BaseColor.ORANGE);
            chunk.SetUnderline(BaseColor.PINK, 1.2f, 1, 1, 1, 0);
            p.Add(chunk);
            PdfDiv div = new PdfDiv();
            div.AddElement(p);
            document.Add(div);

            document.Add(new Paragraph("This paragraph appears between 2 div blocks"));

            div = new PdfDiv();
            div.AddElement(new Paragraph(text));
            document.Add(div);


            document.Close();
            int[] nums = new int[] {48, 7};
            CheckNums(nums);
            CompareResults("16");
        }
开发者ID:,项目名称:,代码行数:25,代码来源:

示例3: CreateTaggedPdf15

        public void CreateTaggedPdf15() {
            InitializeDocument("15");

            Paragraph p = new Paragraph();
            Chunk chunk = new Chunk("Hello tagged world!");
            chunk.SetBackground(new BaseColor(255, 0, 255));
            chunk.Font = FontFactory.GetFont("TimesNewRoman", 20, BaseColor.ORANGE);
            chunk.SetUnderline(BaseColor.PINK, 1.2f, 1, 1, 1, 0);
            p.Add(chunk);

            document.Add(p);
            document.Close();
            int[] nums = new int[] {3};
            CheckNums(nums);
            CompareResults("15");
        }
开发者ID:,项目名称:,代码行数:16,代码来源:

示例4: GenerateResultsPDF

        /// <summary>
        /// Generates a pdf of election results for this election.
        /// </summary>
        /// <param name="session">A valid session.</param>
        /// <param name="path">The path where the pdf will be saved.</param>
        /// <returns>The document which was created.</returns>
        public virtual Document GenerateResultsPDF(ISession session, string path)
        {
            Committee committee = Committee.FindCommittee(session,
                PertinentCommittee);
            List<Certification> certifications = Certification.FindCertifications(session, ID);
            Dictionary<string, int> users = GetResults(session);

            var doc = new Document();
            PdfWriter.GetInstance(doc,
                new FileStream(path, FileMode.Create));

            PdfPTable table = new PdfPTable(2);
            table.SpacingBefore = 30f;
            table.SpacingAfter = 30f;

            table.AddCell("Candidate");
            table.AddCell("Number of Votes");

            foreach (KeyValuePair<string, int> i in users)
            {
                User user = User.FindUser(session, i.Key);
                table.AddCell(user.FirstName + " " + user.LastName);
                table.AddCell(i.Value.ToString());
            }

            doc.Open();
            Font header = FontFactory.GetFont("Arial", 24, BaseColor.BLACK);
            doc.Add(new Phrase("APSCUF-KU Election Results\n", header));

            // The semester the election was started during
            string semester = "nothing";

            // The fall semester is between august 27 and december 17
            if (Started >= new DateTime(Started.Year, 8, 27) &&
                Started <= new DateTime(Started.Year, 12, 17))
                semester = " held during the Fall " + Started.Year.ToString() + " semester.";
            // The spring semester is between january 22 and may 12
            else if (Started >= new DateTime(Started.Year, 1, 22) &&
                Started <= new DateTime(Started.Year, 5, 12))
                semester = " held during the Spring " + Started.Year.ToString() + " semester.";
            else // otherwise just say what date it started.
                semester = " started on " + Started.ToString("d") + ".";

            doc.Add(new Paragraph("The following results were collected during an election held to fill " + committee.NumberOfVacancies(session).ToString() + " vacancies in the " + committee.Name + semester));
            doc.Add(table);

            foreach(Certification i in certifications)
            {
                User certifyingUser = User.FindUser(session, i.User);
                Chunk sigLine = new Chunk("                                                  \n");
                sigLine.SetUnderline(0.5f, -1.5f);
                Phrase signatureArea = new Phrase();
                signatureArea.Add("I hereby certify the results of this election:\n");
                signatureArea.Add(sigLine);
                signatureArea.Add(certifyingUser.FirstName + " " + certifyingUser.LastName + "\n");
                signatureArea.Add(sigLine);
                signatureArea.Add("Date\n\n");

                doc.Add(signatureArea);
            }
            doc.Close();
            return doc;
        }
开发者ID:bashtech,项目名称:ivote-teama,代码行数:69,代码来源:CommitteeElection.cs

示例5: PrintOrdersToPdf


//.........这里部分代码省略.........
                        cellLogo.HorizontalAlignment = Element.ALIGN_RIGHT;
                        headerTable.AddCell(cellLogo);
                    }
                }
                doc.Add(headerTable);

                PdfContentByte cb = writer.DirectContent;
                cb.MoveTo(pageSize.Left + 40f, pageSize.Top - 80f);
                cb.LineTo(pageSize.Right - 40f, pageSize.Top - 80f);
                cb.Stroke();

                #endregion

                #region Addresses

                var fontSmall = new Font(iTextSharp.text.Font.FontFamily.HELVETICA, 7, iTextSharp.text.Font.NORMAL);

                var addressTable = new PdfPTable(2);
                addressTable.WidthPercentage = 100f;
                addressTable.SetWidths(new[] { 50, 50 });

                //billing address
                string company = String.Format("{0}, {1}, {2} {3}", _companyInformationSettings.CompanyName, 
                    _companyInformationSettings.Street, 
                    _companyInformationSettings.ZipCode,
                    _companyInformationSettings.City);

                cell = new PdfPCell();
                cell.Border = Rectangle.NO_BORDER;
                cell.AddElement(new Paragraph(" "));
                cell.AddElement(new Paragraph(" "));

                Chunk chkHeader = new Chunk(company, fontSmall);
                chkHeader.SetUnderline(.5f, -2f);
                cell.AddElement(new Paragraph(chkHeader));

                if (_addressSettings.CompanyEnabled && !String.IsNullOrEmpty(order.BillingAddress.Company))
                {
                    cell.AddElement(new Paragraph(order.BillingAddress.Company, font));
                }
                cell.AddElement(new Paragraph(String.Format(order.BillingAddress.FirstName + " " + order.BillingAddress.LastName), font));
                if (_addressSettings.StreetAddressEnabled)
                {
                    cell.AddElement(new Paragraph(order.BillingAddress.Address1, font));
                }
                if (_addressSettings.StreetAddress2Enabled && !String.IsNullOrEmpty(order.BillingAddress.Address2))
                {
                    cell.AddElement(new Paragraph(order.BillingAddress.Address2, font));
                }
                if (_addressSettings.CityEnabled || _addressSettings.StateProvinceEnabled || _addressSettings.ZipPostalCodeEnabled || _addressSettings.CountryEnabled && order.BillingAddress.Country != null)
                {
                    cell.AddElement(new Paragraph(String.Format("{0} {1} - {2} {3}", 
                        order.BillingAddress.Country != null ? order.BillingAddress.Country.GetLocalized(x => x.TwoLetterIsoCode, lang.Id) : "",
                        order.BillingAddress.StateProvince != null ? "(" + order.BillingAddress.StateProvince.GetLocalized(x => x.Name, lang.Id) + ")": "", 
                        order.BillingAddress.ZipPostalCode,
                        order.BillingAddress.City ), font));
                }
                
                addressTable.AddCell(cell);

                //legal + shop infos 
                cell = new PdfPCell();
                cell.Border = Rectangle.NO_BORDER;
                var paragraph = new Paragraph(_companyInformationSettings.CompanyName, font);
                paragraph.Alignment = Element.ALIGN_RIGHT;
                cell.AddElement(paragraph);
开发者ID:GloriousOnion,项目名称:SmartStoreNET,代码行数:67,代码来源:PdfService.cs

示例6: Apply

        /**
         *
         * @param c the Chunk to apply CSS to.
         * @param t the tag containing the chunk data
         * @return the styled chunk
         */

        virtual public Chunk Apply(Chunk c, Tag t)
        {
            Font f = ApplyFontStyles(t);
            float size = f.Size;
            String value = null;
            IDictionary<String, String> rules = t.CSS;
            foreach (KeyValuePair<String, String> entry in rules)
            {
                String key = entry.Key;
                value = entry.Value;
                if (Util.EqualsIgnoreCase(CSS.Property.FONT_STYLE, key)) {
                    if (Util.EqualsIgnoreCase(CSS.Value.OBLIQUE, value)) {
                        c.SetSkew(0, 12);
                    }
                } else if (Util.EqualsIgnoreCase(CSS.Property.LETTER_SPACING, key)) {
                    String letterSpacing = entry.Value;
                    float letterSpacingValue = 0f;
                    if (utils.IsRelativeValue(value)) {
                        letterSpacingValue = utils.ParseRelativeValue(letterSpacing, f.Size);
                    } else if (utils.IsMetricValue(value)) {
                        letterSpacingValue = utils.ParsePxInCmMmPcToPt(letterSpacing);
                    }
                    c.SetCharacterSpacing(letterSpacingValue);
                } else if (Util.EqualsIgnoreCase(CSS.Property.XFA_FONT_HORIZONTAL_SCALE, key)) {
                    // only % allowed; need a catch block NumberFormatExc?
                    c.SetHorizontalScaling(
                        float.Parse(value.Replace("%", ""))/100);
                }
            }
            // following styles are separate from the for each loop, because they are based on font settings like size.
            if (rules.TryGetValue(CSS.Property.VERTICAL_ALIGN, out value))
            {
                if (Util.EqualsIgnoreCase(CSS.Value.SUPER, value)
                    || Util.EqualsIgnoreCase(CSS.Value.TOP, value)
                    || Util.EqualsIgnoreCase(CSS.Value.TEXT_TOP, value)) {
                    c.SetTextRise((float) (size/2 + 0.5));
                } else if (Util.EqualsIgnoreCase(CSS.Value.SUB, value)
                    || Util.EqualsIgnoreCase(CSS.Value.BOTTOM, value)
                    || Util.EqualsIgnoreCase(CSS.Value.TEXT_BOTTOM, value)) {
                    c.SetTextRise(-size/2);
                } else {
                    c.SetTextRise(utils.ParsePxInCmMmPcToPt(value));
                }
            }
            String xfaVertScale;
            if (rules.TryGetValue(CSS.Property.XFA_FONT_VERTICAL_SCALE, out xfaVertScale))
            {
                if (xfaVertScale.Contains("%"))
                {
                    size *= float.Parse(xfaVertScale.Replace("%", ""))/100;
                    c.SetHorizontalScaling(100/float.Parse(xfaVertScale.Replace("%", "")));
                }
            }
            if (rules.TryGetValue(CSS.Property.TEXT_DECORATION, out value)) {
                String[] splitValues = new Regex(@"\s+").Split(value);
                foreach (String curValue in splitValues) {
                    if (Util.EqualsIgnoreCase(CSS.Value.UNDERLINE, curValue)) {
                        c.SetUnderline(0.75f, -size/8f);
                    }
                    if (Util.EqualsIgnoreCase(CSS.Value.LINE_THROUGH, curValue)) {
                        c.SetUnderline(0.75f, size/4f);
                    }
                }
            }
            if (rules.TryGetValue(CSS.Property.BACKGROUND_COLOR, out value))
            {
                c.SetBackground(HtmlUtilities.DecodeColor(value));
            }
            f.Size = size;
            c.Font = f;


            float? leading = null;
            value = null;
            if (rules.TryGetValue(CSS.Property.LINE_HEIGHT, out value)) {
                if (utils.IsNumericValue(value)) {
                    leading = float.Parse(value) * c.Font.Size;
                } else if (utils.IsRelativeValue(value)) {
                    leading = utils.ParseRelativeValue(value, c.Font.Size);
                } else if (utils.IsMetricValue(value)) {
                    leading = utils.ParsePxInCmMmPcToPt(value);
                }
            }

            if (leading != null) {
                c.setLineHeight((float)leading);
            }
            return c;
        }
开发者ID:htlp,项目名称:itextsharp,代码行数:96,代码来源:ChunkCssApplier.cs

示例7: Download_Click

    protected void Download_Click(object sender, EventArgs e)
    {
        //  Check condition
        if (!GridView1.Columns[GridView1.Columns.Count - 1].Visible)
        {
            // Create PDF Document
            String Path = Server.MapPath("~\\Bangdiem\\DKHP\\DKHP_" + userName + ".pdf");
            Document myDocument = new Document(PageSize.A4, 5, 5, 30, 10);

            if (!File.Exists(Path))
            {

                PdfWriter.GetInstance(myDocument, new FileStream(Path, FileMode.CreateNew));

                //  Open document
                myDocument.Open();

                BaseFont bf = BaseFont.CreateFont(Server.MapPath(@"~\Font\TIMES.TTF"), BaseFont.IDENTITY_H, true);
                iTextSharp.text.Font font = new iTextSharp.text.Font(bf, 12);

                iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(Server.MapPath("~/images/UIT.png"));
                image.Alignment = iTextSharp.text.Image.UNDERLYING;
                image.ScaleToFit(30f, 30f);

                Chunk c1 = new Chunk("TRƯỜNG ĐẠI HỌC CÔNG NGHỆ THÔNG TIN", font);
                c1.SetUnderline(0.5f, -4f);
                Paragraph Header = new Paragraph(15);
                Header.IndentationLeft = 15;
                Header.Alignment = 3;
                Header.Font = font;
                Header.Add(image);
                Header.SpacingBefore = 5f;
                Header.Add("             ĐẠI HỌC QUỐC GIA THÀNH PHỐ HỒ CHÍ MINH \n               ");
                Header.Add(c1);

                Header.Add("\n\n\n");

                myDocument.Add(Header);

                // Add gridview to
                iTextSharp.text.Table table = new iTextSharp.text.Table(5);

                // set table style properties
                table.BorderWidth = 1;
                table.BorderColor = Color.DARK_GRAY;
                table.Padding = 4;
                table.Alignment = 1;
                table.Width = 90;

                // set *column* widths
                float[] widths = { 0.05f, 0.23f, 0.17f, 0.45f, 0.1f };
                table.Widths = widths;

                string[] col = { "TT", "Mã Lớp", "Mã Môn", "Tên Môn Học", "Số TC" };
                font = new iTextSharp.text.Font(bf, 13, 1);

                // create the *table* header row
                for (int i = 0; i < col.Length; ++i)
                {
                    Cell cell = new Cell(new Phrase(col[i], font));
                    cell.Header = true;
                    cell.HorizontalAlignment = 1;
                    table.AddCell(cell);
                }
                table.EndHeaders();

                int sum = 0;
                font = new iTextSharp.text.Font(bf, 12);
                int order = 0;
                foreach (GridViewRow row in GridView1.Rows)
                {
                    Cell c = new Cell(new Phrase((++order).ToString(), font));
                    c.HorizontalAlignment = 1;
                    table.AddCell(c);

                    c = new Cell(new Phrase(row.Cells[1].Text, font));
                    c.HorizontalAlignment = 1;
                    table.AddCell(c);

                    c = new Cell(new Phrase(((HiddenField)row.FindControl("SubID")).Value, font));
                    c.HorizontalAlignment = 1;
                    table.AddCell(c);

                    c = new Cell(new Phrase("   " + ((LinkButton)row.FindControl("SubNm")).Text, font));
                    table.AddCell(c);

                    c = new Cell(new Phrase(row.Cells[3].Text, font));
                    c.HorizontalAlignment = 1;
                    try { sum += Int16.Parse(row.Cells[3].Text); }
                    catch (Exception ex) { }
                    table.AddCell(c);
                }

                font = new iTextSharp.text.Font(bf, 14);
                Paragraph p = new Paragraph("ĐĂNG KÍ HỌC PHẦN HK " + getTerm() + " " + getYear() + " \n", font);
                p.Alignment = 1;
                p.Add("MSSV : " + userName);
                myDocument.Add(p);

                font = new iTextSharp.text.Font(bf, 12);
//.........这里部分代码省略.........
开发者ID:hoaian89,项目名称:DAA,代码行数:101,代码来源:RegisterReg.ascx.cs

示例8: pdfButton_Click

        protected void pdfButton_Click(object sender, EventArgs e)
        {
            Document doc = new Document(PageSize.A4, 36, 72, 108, 180);
            string path = @"D:\";
            PdfWriter.GetInstance(doc, new FileStream(path + "/Treatment.pdf", FileMode.Create));
            doc.Open();
            Voter aVoter = new Voter();
            aVoter.Id=nationalIdTextBox.Text;
            aVoter.Name = nameTextBox.Text;
            aVoter.Address = addressTextBox.Text;
                Paragraph paragraph = new Paragraph();
                paragraph.Add("National Id : " + aVoter.Id);
                paragraph.Add(Environment.NewLine);
                paragraph.Add("Name : " + aVoter.Name);
                paragraph.Add(Environment.NewLine);
                paragraph.Add("Address :" + aVoter.Address);
                paragraph.Add(Environment.NewLine);
                paragraph.Add(Environment.NewLine);
                doc.Add(paragraph);

                Patient aPatient = new Patient();
                aPatient.VoterId = nationalIdTextBox.Text;
                GetPatientInformation(aPatient.VoterId);
                aPatient.Id = patientManager.GetPatientId(aPatient);

             int count = 0;
                List<Treatment> ObservationList = treatmentManager.GetObservationList(aPatient);
                foreach (var observation in ObservationList)
                {
                    count++;
                    PdfPTable table = new PdfPTable(1);
                    Paragraph aParagraph = new Paragraph();
                    Chunk chunk = new Chunk("Treatment-" + count, FontFactory.GetFont("dax-black"));
                    chunk.SetUnderline(0.5f, -1.5f);
                    doc.Add(chunk);

                    string centerName = centerManager.GetCenterName(observation.CenterId);
                    aParagraph.Add("Center Name : " + centerName);
                    aParagraph.Add(Environment.NewLine);
                    string Date = observation.Date;
                    aParagraph.Add("Date : " + Date);
                    aParagraph.Add(Environment.NewLine);
                    string DoctorName = doctorManager.GetDoctorName(observation.DoctorId);
                    aParagraph.Add("Doctor Name : " + DoctorName);
                    aParagraph.Add(Environment.NewLine);
                    string Observation = observation.Observation;
                    aParagraph.Add("Observation : " + Observation);
                    aParagraph.Add(Environment.NewLine);
                    table.AddCell(aParagraph);
                    doc.Add(table);
                    List<Treatment> treatmentList = treatmentManager.GetTreatmentList(observation.ObservationId);
                    List<Treatment> aTreatmentList = new List<Treatment>();
                    foreach (var treatment in treatmentList)
                    {
                        string diseaseName = diseaseManager.GetDiseaseName(treatment.DiseaseId);
                        string medicineName = medicineManager.GetMedicineName(treatment.MedicineId);
                        Treatment aTreatment = new Treatment();
                        aTreatment.NameOfDisease = diseaseName;
                        aTreatment.NameOfMedicine = medicineName;
                        aTreatment.Dose = treatment.Dose;
                        aTreatment.TakenTime = treatment.TakenTime;
                        aTreatment.Quantity = treatment.Quantity;
                        aTreatment.Note = treatment.Note;

                        aTreatmentList.Add(aTreatment);
                    }
                    ShowAllTreatment(centerName, Date, DoctorName, Observation, count, aTreatmentList);
                    PdfPTable aTable = new PdfPTable(6);
                    aTable.AddCell("Disease");
                    aTable.AddCell("Medicine");
                    aTable.AddCell("Dose");
                    aTable.AddCell("Before/After meal");
                    aTable.AddCell("Quantity");
                    aTable.AddCell("Note");
                    foreach (var eachTreatment in aTreatmentList) {
                        aTable.AddCell(eachTreatment.NameOfDisease);
                        aTable.AddCell(eachTreatment.NameOfMedicine);
                        aTable.AddCell(eachTreatment.Dose);
                        aTable.AddCell(eachTreatment.TakenTime);
                        aTable.AddCell(eachTreatment.Quantity.ToString());
                        aTable.AddCell(eachTreatment.Note);
                    }
                    doc.Add(aTable);
                }
            doc.Close();
            Response.Redirect("OpenPdfUI.aspx");
            megLabel.Text = "PDF Creation Successful!";
        }
开发者ID:nazruldiu,项目名称:CommunityMedicineAutomation,代码行数:88,代码来源:ShowAllHistoryUI.aspx.cs

示例9: Apply

        /**
         *
         * @param c the Chunk to apply CSS to.
         * @param t the tag containing the chunk data
         * @return the styled chunk
         */

        public Chunk Apply(Chunk c, Tag t)
        {
            Font f = ApplyFontStyles(t);
            float size = f.Size;
            String value = null;
            IDictionary<String, String> rules = t.CSS;
            foreach (KeyValuePair<String, String> entry in rules)
            {
                String key = entry.Key;
                value = entry.Value;
                if (Util.EqualsIgnoreCase(CSS.Property.FONT_STYLE, key)) {
                    if (Util.EqualsIgnoreCase(CSS.Value.OBLIQUE, value))
                    {
                        c.SetSkew(0, 12);
                    }
                } else if (Util.EqualsIgnoreCase(CSS.Property.LETTER_SPACING, key)) {
                    c.SetCharacterSpacing(utils.ParsePxInCmMmPcToPt(value));
                } else if (Util.EqualsIgnoreCase(CSS.Property.XFA_FONT_HORIZONTAL_SCALE, key)) {
                    // only % allowed; need a catch block NumberFormatExc?
                    c.SetHorizontalScaling(
                        float.Parse(value.Replace("%", ""))/100);
                }
            }
            // following styles are separate from the for each loop, because they are based on font settings like size.
            if (rules.TryGetValue(CSS.Property.VERTICAL_ALIGN, out value))
            {
                if (Util.EqualsIgnoreCase(CSS.Value.SUPER, value)
                    || Util.EqualsIgnoreCase(CSS.Value.TOP, value)
                    || Util.EqualsIgnoreCase(CSS.Value.TEXT_TOP, value)) {
                    c.SetTextRise((float) (size/2 + 0.5));
                } else if (Util.EqualsIgnoreCase(CSS.Value.SUB, value)
                    || Util.EqualsIgnoreCase(CSS.Value.BOTTOM, value)
                    || Util.EqualsIgnoreCase(CSS.Value.TEXT_BOTTOM, value)) {
                    c.SetTextRise(-size/2);
                } else {
                    c.SetTextRise(utils.ParsePxInCmMmPcToPt(value));
                }
            }
            String xfaVertScale;
            if (rules.TryGetValue(CSS.Property.XFA_FONT_VERTICAL_SCALE, out xfaVertScale))
            {
                if (xfaVertScale.Contains("%"))
                {
                    size *= float.Parse(xfaVertScale.Replace("%", ""))/100;
                    c.SetHorizontalScaling(100/float.Parse(xfaVertScale.Replace("%", "")));
                }
            }
            if (rules.TryGetValue(CSS.Property.TEXT_DECORATION, out value))
            {
                // Restriction? In html a underline and a line-through is possible on one piece of text. A Chunk can set an underline only once.
                if (Util.EqualsIgnoreCase(CSS.Value.UNDERLINE, value))
                {
                    c.SetUnderline(0.75f, -size/8f);
                }
                if (Util.EqualsIgnoreCase(CSS.Value.LINE_THROUGH, value))
                {
                    c.SetUnderline(0.75f, size/4f);
                }
            }
            if (rules.TryGetValue(CSS.Property.BACKGROUND_COLOR, out value))
            {
                c.SetBackground(HtmlUtilities.DecodeColor(value));
            }
            f.Size = size;
            c.Font = f;
            return c;
        }
开发者ID:,项目名称:,代码行数:74,代码来源:

示例10: Button2_Click


//.........这里部分代码省略.........

                    pdftable.TotalWidth = 500f;

                    //fix the absolute width of the table
                    pdftable.LockedWidth = true;

                    //relative col widths in proportions - 1/3 and 2/3
                    float[] widths = new float[] { 4f, 7f, 6f, 7f, 6f, 8f, 7f, 8f, 6f };
                    pdftable.SetWidths(widths);
                    pdftable.HorizontalAlignment = 0;
                    //leave a gap before and after the table
                    pdftable.SpacingBefore = 20f;
                    pdftable.SpacingAfter = 30f;

                    //bordercolor

                    /*
                    pdfcell.BorderColorLeft = BaseColor.BLACK;
                    pdfcell.BorderColorRight = BaseColor.BLACK;
                    pdfcell.BorderColorTop = BaseColor.BLACK;
                    pdfcell.BorderColorBottom = BaseColor.BLACK;
                    pdfcell.BorderWidthLeft = 1f;
                    pdfcell.BorderWidthRight = 1f;
                    pdfcell.BorderWidthTop = 1f;
                    pdfcell.BorderWidthBottom = 1f;

            */
                    pdftable.AddCell(pdfcell);

                }

                }

                Document pdfdocument = new Document(PageSize.A4, 30f, 20f, 20f, 20f);
                iTextSharp.text.Image PNG = iTextSharp.text.Image.GetInstance("logo1 copy.PNG");

                iTextSharp.text.Image PNG1 = iTextSharp.text.Image.GetInstance("copyright.PNG");
            PdfWriter.GetInstance(pdfdocument, Response.OutputStream);

                pdfdocument.Open();

                PNG.ScaleToFit(500f, 150f);
                PNG1.ScaleToFit(500f, 90f);

                Paragraph p1 = new Paragraph();
                Paragraph p2 = new Paragraph();

                Chunk chunk = new Chunk("Fare Details  "  , FontFactory.GetFont("dax-black"));

                chunk.SetUnderline(0.5f, -1.5f);

                Font arial = FontFactory.GetFont("Arial", 16, iTextSharp.text.BaseColor.RED);
                Font arial2 = FontFactory.GetFont("Arial", 12, iTextSharp.text.BaseColor.BLACK);

                p2.Add(Chunk.NEWLINE);
                p2.Add(Chunk.NEWLINE);

                p2.Add(new Chunk("Purchased on : " + Label6.Text + "", arial2));

                p2.Add(Chunk.NEWLINE);
                p2.Add(Chunk.NEWLINE);

                p2.Add(new Chunk("Your Ticket Number is : ", arial2));
                p2.Add(new Chunk("#" +Label4.Text+"", arial));

                //p1.Alignment = Element.ALIGN_RIGHT;

                p1.Add(new Chunk("Fare Details", arial2));
                p1.Add(Chunk.NEWLINE);
                p1.Add(Chunk.NEWLINE);
                p1.Add(new Chunk( "No of Adults : " +Label1.Text+"   ", arial2));
                p1.Add(Chunk.NEWLINE);
                p1.Add(Chunk.NEWLINE);
                p1.Add(new Chunk("No of Childs : " + Label2.Text + "   ", arial2));
                p1.Add(Chunk.NEWLINE);
                p1.Add(Chunk.NEWLINE);
                p1.Add(new Chunk("Total Fare (MYR)  : " + Label3.Text + ".00   ",arial));
                p1.Add(Chunk.NEWLINE);
                p1.Add(Chunk.NEWLINE);

                pdfdocument.Add(PNG);
                pdfdocument.Add(p2);
                pdfdocument.Add(pdftable);
                pdfdocument.Add(p1);
                pdfdocument.Add(PNG1);

                pdfdocument.Close();

                Response.ContentType = "application/pdf";

                string fileName =   "(" + "#" + Label4.Text + ")" + "-"+ "Ticket_Number.pdf";

                Response.AppendHeader("content-disposition", "attachment;filename=" + fileName);

                Response.Write(pdfdocument);

                Response.Flush();

                Response.End();
        }
开发者ID:jeva,项目名称:Int_Bus_Ticketing_System,代码行数:101,代码来源:ViewPrint(User).aspx.cs


注:本文中的iTextSharp.text.Chunk.SetUnderline方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。