• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# pdf.BaseFont类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



BaseFont类属于iTextSharp.text.pdf命名空间,在下文中一共展示了BaseFont类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnOpenDocument

 public override void OnOpenDocument(PdfWriter writer, Document document)
 {
     printTime = DateTime.Now;
     string arialuniTff = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "ARIALUNI.TTF");
     baseFont = BaseFont.CreateFont(arialuniTff, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
     pdfContent = writer.DirectContent;
     pageNumberTemplate = pdfContent.CreateTemplate(50, 50);
 }
开发者ID:vamelnyk,项目名称:CorporateEmployeeServiceSystem,代码行数:8,代码来源:PrintHeaderFooter.cs


示例2: CreatePdf

// ---------------------------------------------------------------------------    
    /**
     * Creates a PDF document.
     */
    public byte[] CreatePdf(BaseFont bf, String text) {
      using (MemoryStream ms = new MemoryStream()) {
        using (Document document = new Document()) {
          PdfWriter.GetInstance(document, ms);
          document.Open();
          document.Add(new Paragraph(text, new Font(bf, 12)));
        }
        return ms.ToArray();
      }
    }    
开发者ID:,项目名称:,代码行数:14,代码来源:


示例3: OnOpenDocument

 public override void OnOpenDocument(PdfWriter writer, Document document)
 {
     base.OnOpenDocument(writer, document);
     font = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
     dc = writer.DirectContent;
     tpl = dc.CreateTemplate(50, 50);
 }
开发者ID:stevesloka,项目名称:bvcms,代码行数:7,代码来源:EnrollmentControlResult.cs


示例4: OnOpenDocument

 // we override the onOpenDocument method
 public override void OnOpenDocument(PdfWriter writer, Document document)
 {
     _bf = _normalFont.GetCalculatedBaseFont(false);
     _cb = writer.DirectContent;
     _ct = new ColumnText(_cb);
     base.OnOpenDocument(writer, document);
 }
开发者ID:jwebb-vtg,项目名称:WSCIEMP,代码行数:8,代码来源:rptFieldContracting.cs


示例5: OnOpenDocument

        public override void OnOpenDocument(PdfWriter writer, Document document)
        {
            total = writer.DirectContent.CreateTemplate(100, 100);
            total.BoundingBox = new Rectangle(-20, -20, 100, 100);

            helv = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
        }
开发者ID:woofwoof88,项目名称:first-place-processing,代码行数:7,代码来源:pdfPrintEnvelopes.ashx.cs


示例6: OnOpenDocument

 public override void OnOpenDocument(PdfWriter writer, Document document)
 {
     printTime = DateTime.Now;
     baseFont = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
     pdfContent = writer.DirectContent;
     pageNumberTemplate = pdfContent.CreateTemplate(50, 50);
 }
开发者ID:huutruongqnvn,项目名称:vnecoo01,代码行数:7,代码来源:PrintHeaderFooter.cs


示例7: StarSeparator

// ---------------------------------------------------------------------------    
    /**
     * Constructs a positioned Arrow mark.
     * @param    left    if true, an arrow will be drawn on the left;
     * otherwise, it will be drawn on the right.
     * @throws IOException 
     * @throws DocumentException 
     */
    public StarSeparator() {
      try {
        bf = BaseFont.CreateFont();
      } catch {
        bf = null;
        throw;
      }
    }
开发者ID:,项目名称:,代码行数:16,代码来源:


示例8: PDFWriter

        public PDFWriter()
        {
            //Initialization
            DEFAULT_FONTSIZE = 12.0f;
            DEFAULT_HEADINGSIZE = 16.0f;
            FONTNAME = "segoeui.ttf";

            string fg = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), FONTNAME);
            baseFont = BaseFont.CreateFont(fg, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
        }
开发者ID:drdaemos,项目名称:ODTCONVERTvs10,代码行数:10,代码来源:PDFWriter.cs


示例9: PositionedArrow

// ---------------------------------------------------------------------------    
    /**
     * Constructs a positioned Arrow mark.
     * @param    left    if true, an arrow will be drawn on the left;
     * otherwise, it will be drawn on the right.
     * @throws IOException 
     * @throws DocumentException 
     */
    public PositionedArrow(bool left) {
      this.left = left;
      try {
        zapfdingbats = BaseFont.CreateFont(
          BaseFont.ZAPFDINGBATS, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED
        );
      }
      catch {
        zapfdingbats = null;
        throw;
      }
    }
开发者ID:,项目名称:,代码行数:20,代码来源:


示例10: Report

 //public Report()
 //{
 //    fntHeading = FontFactory.GetFont(FontFactory.HELVETICA, 7, Font.BOLD, new Color(0x00, 0x00, 0x00));
 //    fntDetails = FontFactory.GetFont(FontFactory.HELVETICA, 7, Font.NORMAL, new Color(0x00, 0x00, 0x00));
 //    bf = BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1250, BaseFont.NOT_EMBEDDED);
 //    doc = new Document(PageSize.A4 , 35, 35, 35, 35);
 //    writer = PdfWriter.GetInstance(doc, ms);
 //    MyPageEvents events = new MyPageEvents();
 //    writer.PageEvent = events;
 //}
 public Report(bool Landscape)
 {
     fntHeading = FontFactory.GetFont(FontFactory.HELVETICA, 7, Font.BOLD, new Color(0x00, 0x00, 0x00));
     fntDetails = FontFactory.GetFont(FontFactory.HELVETICA, 7, Font.NORMAL, new Color(0x00, 0x00, 0x00));
     bf = BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1250, BaseFont.NOT_EMBEDDED);
     if(Landscape)
         doc = new Document(PageSize.A4.Rotate(), 35, 35, 35, 35);
     else
         doc = new Document(PageSize.A4, 35, 35, 35, 35);
     writer = PdfWriter.GetInstance(doc, ms);
     MyPageEvents events = new MyPageEvents();
     writer.PageEvent = events;
 }
开发者ID:paulallies,项目名称:tsdt,代码行数:23,代码来源:Report.cs


示例11: OnOpenDocument

        public void OnOpenDocument(PdfWriter writer, Document document)
        {
            _baseFont = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED);
            _frontPageFont = BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252, BaseFont.EMBEDDED);
            _content = writer.DirectContent;

            if (!string.IsNullOrEmpty(_settings.PageTemplate))
            {
                var reader = new PdfReader(_settings.PageTemplate);
                _template = writer.GetImportedPage(reader, 1);
            }

            WriteFrontPage(writer, document);
        }
开发者ID:marcostomazini,项目名称:ReleaseNotes,代码行数:14,代码来源:ReleaseNotesPdfPageEvents.cs


示例12: PdfHelper

        public PdfHelper()
        {
            try
            {
                defaultFontSize = 10;//默認字体大小
                basefont = BaseFont.CreateFont("C:/Windows/Fonts/msyh.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);//默認字体为微软雅黑

                font = new Font(basefont,defaultFontSize);
                document = new Document(PageSize.A4);
            }
            catch (Exception ex)
            {
                throw new Exception("PdfManagement-->CreateFont-->" + ex.Message);
            }

        }
开发者ID:lxh2014,项目名称:gigade-net,代码行数:16,代码来源:PdfHelper.cs


示例13: SetTemplateFont

        /// <summary>
        /// Set font family and font size on all text fields for consistency
        /// </summary>
        /// <param name="stamperFields">
        /// PdfStamper.AcroFields - so we can set the form field value here.
        /// </param>
        /// <param name="family">BaseFont</param>
        /// <param name="size">Desired size</param>
        public static void SetTemplateFont(AcroFields stamperFields, BaseFont family, float size)
        {
            // ignore everything except text fields
            var textFields = stamperFields.Fields.Keys
                .Where(x => stamperFields.GetFieldType(x) == AcroFields.FIELD_TYPE_TEXT
                    && GetFontSize(stamperFields, x) != 0f
                )
                .ToDictionary(k => k);

            Console.WriteLine(string.Join(" :: ", textFields.Keys.ToArray()));

            foreach (var key in textFields.Keys)
            {
                stamperFields.SetFieldProperty(key, "textfont", family, null);
                stamperFields.SetFieldProperty(key, "textsize", size, null);
            }
        }
开发者ID:kuujinbo,项目名称:StackOverflow.iTextSharp,代码行数:25,代码来源:TextBoxField.cs


示例14: SetUp

        public void SetUp()
        {
            PdfReader reader = new PdfReader(
                TestResourceUtils.GetResourceAsStream(TEST_RESOURCES_PATH, "fontWithToUnicode.pdf"));
            PdfDictionary resourcesDict = reader.GetPageResources(1);
            PdfDictionary fontsDict = resourcesDict.GetAsDict(PdfName.FONT);
            foreach (PdfName key in fontsDict.Keys)
            {
                PdfObject pdfFont = fontsDict.Get(key);

                if (pdfFont is PRIndirectReference)
                {
                    fontWithToUnicode = BaseFont.CreateFont((PRIndirectReference)pdfFont);
                    break;
                }
            }
        }
开发者ID:,项目名称:,代码行数:17,代码来源:


示例15: PdfRenderer

        public PdfRenderer()
        {
            PageWidth = PageSize.A4.Width;
            PageHeight = PageSize.A4.Height;

            string fontpath = "ReportSharp.Fonts.tahoma.ttf";
            Stream stream = this.GetType().Assembly.GetManifestResourceStream(fontpath);
            byte[] buff = StreamHelper.ReadToEnd(stream);

            font = BaseFont.CreateFont("tahoma.ttf", "CP1254", BaseFont.EMBEDDED, false, buff, null, false, true);

            fontpath = "ReportSharp.Fonts.tahomabd.ttf";
            stream = this.GetType().Assembly.GetManifestResourceStream(fontpath);
            buff = StreamHelper.ReadToEnd(stream);

            fontBold = BaseFont.CreateFont("tahomabd.ttf", "CP1254", BaseFont.EMBEDDED, false, buff, null, false, true);
        }
开发者ID:koraytaylan,项目名称:ReportSharp,代码行数:17,代码来源:PdfRenderer.cs


示例16: OnOpenDocument

 public override void OnOpenDocument(PdfWriter writer, Document document)
 {
     try
     {
         PrintTime = DateTime.Now;
         baseFont = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
         contentByte = writer.DirectContent;
         template = contentByte.CreateTemplate(50, 50);
     }
     catch (DocumentException de)
     {
         Console.WriteLine("||On OpenDocument||" + de.StackTrace);
     }
     catch (System.IO.IOException ioe)
     {
         Console.WriteLine("||On OpenDocument||" + ioe.StackTrace);
     }
 }
开发者ID:Khaleesy,项目名称:Csharp,代码行数:18,代码来源:PdfPageFormat.cs


示例17: IlithaTimeSheetReport

        public IlithaTimeSheetReport(bool Landscape)
        {
            fntHeading = FontFactory.GetFont(FontFactory.HELVETICA, 7, Font.BOLD, new Color(0x00, 0x00, 0x00));
            fntDetails = FontFactory.GetFont(FontFactory.HELVETICA, 5, Font.NORMAL, new Color(0x00, 0x00, 0x00));
            footerFont = FontFactory.GetFont(FontFactory.HELVETICA, 5, Font.BOLD, new Color(0x00, 0x00, 0x00));
            SacoFont = FontFactory.GetFont(FontFactory.HELVETICA, 5, Font.BOLD, new Color(0xFF, 0xFF, 0xFF));
            ErrorFont = FontFactory.GetFont(FontFactory.HELVETICA, 5, Font.BOLD, new Color(0xFF, 0x00, 0x00));
            ReportBorderWidth = 0.5F;

            bf = BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1250, BaseFont.NOT_EMBEDDED);
            if (Landscape)
                doc = new Document(PageSize.A4.Rotate(), 18, 18, 18, 100);
            else
                doc = new Document(PageSize.A4, 18, 18, 18, 100);
            writer = PdfWriter.GetInstance(doc, ms);
            MyPageEvents events = new MyPageEvents();
            writer.PageEvent = events;
        }
开发者ID:paulallies,项目名称:tsdt,代码行数:18,代码来源:IlithaTimeSheetReport.cs


示例18: createPdf

 public static byte[] createPdf(string template, Action<AcroFields, Action<AcroFields, string, string, int, bool>> setFields) {
   if (font == null)
     lock (typeof(PdfGenerator))
       if (font == null) {
         var path = string.Format(ConfigurationManager.AppSettings["PDF.Font"], Machines.rootPath);
         font = BaseFont.CreateFont(path, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
         path = string.Format(ConfigurationManager.AppSettings["PDF.FontBold"], Machines.rootPath);
         fontBold = BaseFont.CreateFont(path, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
         path = string.Format(ConfigurationManager.AppSettings["PDF.Cert"], Machines.rootPath);
         Cert(path, ConfigurationManager.AppSettings["PDF.Cert.Password"], out akp, out chain);
       }
   //PdfReader rdr = new PdfReader(new RandomAccessFileOrArray(template), null);
   PdfReader rdr = new PdfReader(template, null);
   MemoryStream res = new MemoryStream();
   try {
     PdfStamper ps = new PdfStamper(rdr, res);
     try {
       //Dosazeni poli
       AcroFields af = ps.AcroFields;
       setFields(af, setPdfField);
       ps.FormFlattening = true;
       //Priprava na elektronicky podpis
     } finally { ps.Close(); }
   } finally { rdr.Close(); }
   //PdfReader certRdr = new PdfReader(res.ToArray());
   //MemoryStream certRes = new MemoryStream();
   //try {
   //  PdfStamper certPs = PdfStamper.CreateSignature(certRdr, certRes, '\0');
   //  try {
   //    PdfSignatureAppearance sap = certPs.SignatureAppearance;
   //    //LM16
   //    //sap.SetCrypto(akp, chain, null, PdfSignatureAppearance.WINCER_SIGNED);
   //    sap.Reason = "Certify";
   //    sap.Contact = "LANGMaster";
   //    sap.Location = "EU";
   //    certRes.Seek(0, SeekOrigin.Begin);
   //  } finally {
   //    certPs.Close();
   //  }
   //} finally { certRdr.Close(); }
   //return certRes.ToArray();
   return res.ToArray();
 }
开发者ID:PavelPZ,项目名称:NetNew,代码行数:43,代码来源:PdfGenerator.cs


示例19: FooterPdfInitialize

        private static void FooterPdfInitialize(PdfWriter writer, Document document, PdfTemplate template, PdfContentByte contentByte, BaseFont baseFont, DateTime PrintTime)
        {
            int pageNumber = writer.PageNumber;
            string footerText = string.Format("Strona {0}{1}", pageNumber, " z ");
            float lenght = baseFont.GetWidthPoint(footerText, textSize);
            Rectangle pageSize = document.PageSize;

            contentByte.SetRGBColorFill(100, 100, 100);
            contentByte.BeginText();
            contentByte.SetFontAndSize(baseFont, textSize);
            contentByte.SetTextMatrix(pageSize.GetLeft(left), pageSize.GetBottom(bottom));
            contentByte.ShowText(footerText);
            contentByte.EndText();
            contentByte.AddTemplate(template, pageSize.GetLeft(left) + lenght, pageSize.GetBottom(bottom));

            contentByte.BeginText();
            contentByte.SetFontAndSize(baseFont, textSize);
            contentByte.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, string.Format("Utworzony: {0}", PrintTime.ToString()), pageSize.GetRight(right), pageSize.GetBottom(bottom), 0);
            contentByte.EndText();
        }
开发者ID:Khaleesy,项目名称:Csharp,代码行数:20,代码来源:PdfFooter.cs


示例20: generarAllLiquidaciones

        public static void generarAllLiquidaciones(List<edificio> edificios, bool todo, DateTime p, DateTime vto1, DateTime vto2, string textoPie, System.Drawing.Image _24, System.Drawing.Image qr, System.Drawing.Image tijera)
        {
            List<ExpensasEdificio> expensas = CatalogoExpensas.getAllExpensas(edificios, p, vto1, vto2);
            calibri = BaseFont.CreateFont(IncludesPath + "calibri.ttf", BaseFont.CP1252, BaseFont.EMBEDDED);
            calibri8N = new Font(calibri, 8, Font.NORMAL);
            calibri8B = new Font(calibri, 8, Font.BOLD);
            calibri9N = new Font(calibri, 9, Font.NORMAL);
            calibri9B = new Font(calibri, 9, Font.BOLD);
            calibri12N = new Font(calibri, 10, Font.NORMAL);
            calibri12B = new Font(calibri, 10, Font.BOLD);
            calibri11N = new Font(calibri, 10, Font.NORMAL);
            calibri11B = new Font(calibri, 10, Font.BOLD);

            foreach (var expensasEdificio in expensas)
                hacerLiquidacionThread(expensasEdificio, p, vto1, vto2, textoPie, _24, qr, tijera);

            if (todo)
            {
                generarInformeDeEmision(p);
                generarCSV(p, expensas, vto1, vto2);
                generarCajaGeneral(p, expensas);
            }
        }
开发者ID:fedec93,项目名称:Administracion,代码行数:23,代码来源:ControladorInformes.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# pdf.ColumnText类代码示例发布时间:2022-05-26
下一篇:
C# simpleparser.HTMLWorker类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap