/// <summary>
 /// 文档初始
 /// </summary>
 /// <exception cref="Exception"></exception>
 protected override void DocumentInitialize()
 {
     lock (_loadSync)
     {
         FontFiles.ForEach(p =>
         {
             if (File.Exists(p) && !RegisterFontFiles.Contains(p))
             {
                 PdfFontFactory.Register(p);
                 RegisterFontFiles.Add(p);
             }
         });
     }
 }
예제 #2
0
        public static void Add(byte[] fileData, string localFile)
        {
            string dir  = WD.MakePath();
            string file = Path.Combine(dir, localFile);

            FileTools.CreateDir(dir);
            File.WriteAllBytes(file, fileData);

            if (DDWin32.AddFontResourceEx(file, DDWin32.FR_PRIVATE, IntPtr.Zero) == 0)             // ? 失敗
            {
                throw new DDError();
            }

            FontFiles.Add(file);
        }
예제 #3
0
        /// <summary>
        /// 文档初始
        /// </summary>
        /// <exception cref="Exception"></exception>
        protected override void DocumentInitialize()
        {
            if (_document != null)
            {
                throw new Exception("已经初始化,不允许重复初始化。");
            }

            lock (_loadSync)
            {
                FontFiles.ForEach(p =>
                {
                    if (File.Exists(p) && !RegisterFontFiles.Contains(p))
                    {
                        FontFactory.Register(p);
                        RegisterFontFiles.Add(p);
                    }
                });
            }

            _document = new iTextSharp.text.Document(_pageSize, _marginLeft, _marginRigth, _marginTop, _marginBottom);
        }
예제 #4
0
        protected override void DocumentInitialize()
        {
            FontFiles.Add("c:/windows/fonts/simsun.ttc");

            base.DocumentInitialize();
        }
예제 #5
0
 public static SpriteFont GetFont(FontFiles font)
 {
     return(fonts[font.ToString()]);
 }