/// <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); } }); } }
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); }
/// <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); }
protected override void DocumentInitialize() { FontFiles.Add("c:/windows/fonts/simsun.ttc"); base.DocumentInitialize(); }
public static SpriteFont GetFont(FontFiles font) { return(fonts[font.ToString()]); }