/// <summary>
        /// Create a TextOptions with defaults
        /// </summary>
        public TableOptions()
        {
            // default table settings
            this.DefaultFontFamily = TextFontFamily.TimesNewRoman;

            this.BorderHeader     = new TableBorderOptions();
            this.BorderTop        = new TableBorderOptions();
            this.BorderBottom     = new TableBorderOptions();
            this.BorderHorizontal = new TableBorderOptions();
            this.BorderVertical   = new TableBorderOptions();
            this.ColumnWidths     = null;

            // default font for titles
            this.HeaderFontOptions = new TextFontOptions()
            {
                FontFamily = this.DefaultFontFamily,
                FontStyle  = TextFontStyle.Normal,
                FontWeight = TextFontWeight.Bold,
                FontSize   = 14, // points
                FontColor  = Color.Black
            };

            // default font for headings
            this.CellFontOptions = new TextFontOptions()
            {
                FontFamily = this.DefaultFontFamily,
                FontStyle  = TextFontStyle.Normal,
                FontWeight = TextFontWeight.Normal,
                FontSize   = 12, // points
                FontColor  = Color.Black
            };
        }
        /// <summary>
        /// Create a DocumentOptions with defaults
        /// </summary>
        public DocumentOptions()
        {
            // default document settings
            this.PageSize          = PageSize.A4;
            this.PageOrientation   = PageOrientation.Portrait;
            this.DefaultFontFamily = TextFontFamily.TimesNewRoman;

            this.MarginLeft   = 10; // mm
            this.MarginTop    = 10; // mm
            this.MarginRight  = 10; // mm
            this.MarginBottom = 10; // mm

            // default font for titles
            this.TitleFontOptions = new TextFontOptions()
            {
                FontFamily = this.DefaultFontFamily,
                FontStyle  = TextFontStyle.Normal,
                FontWeight = TextFontWeight.Normal,
                FontSize   = 28, // points
                FontColor  = Color.Black
            };

            // default font for headings
            this.HeadingFontOptions = new TextFontOptions()
            {
                FontFamily = this.DefaultFontFamily,
                FontStyle  = TextFontStyle.Normal,
                FontWeight = TextFontWeight.Normal,
                FontSize   = 16, // points
                FontColor  = Color.Black
            };

            // default font for text
            this.TextFontOptions = new TextFontOptions()
            {
                FontFamily = this.DefaultFontFamily,
                FontStyle  = TextFontStyle.Normal,
                FontWeight = TextFontWeight.Normal,
                FontSize   = 12, // points
                FontColor  = Color.Black
            };

            // default font for paragraphs
            this.ParagraphFontOptions = new TextFontOptions()
            {
                FontFamily = this.DefaultFontFamily,
                FontStyle  = TextFontStyle.Normal,
                FontWeight = TextFontWeight.Normal,
                FontSize   = 12, // points
                FontColor  = Color.Black
            };
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get the PdfFont that best matches the specified TextFontOptions
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        private PdfFont getPdfFont(TextFontOptions options)
        {
            string fontKey = options.FontFamily.Value.Replace(" ", string.Empty).ToUpper();

            System.Drawing.FontStyle drawingFontStyle;
            switch (options.FontStyle)
            {
            case TextFontStyle.Normal:
                fontKey         += "-R";
                drawingFontStyle = System.Drawing.FontStyle.Regular;
                if (options.FontWeight == TextFontWeight.Bold)
                {
                    drawingFontStyle = System.Drawing.FontStyle.Bold;
                    fontKey         += "-B";
                }
                break;

            case TextFontStyle.Italic:
                fontKey         += "-I";
                drawingFontStyle = System.Drawing.FontStyle.Italic;
                if (options.FontWeight == TextFontWeight.Bold)
                {
                    drawingFontStyle = System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic;
                    fontKey         += "-B";
                }
                break;

            default:
                drawingFontStyle = System.Drawing.FontStyle.Regular;
                fontKey         += "-R";
                break;
            }

            if (!this.fontDictionary.ContainsKey(fontKey))
            {
                var pdfFont = PdfFont.CreatePdfFont(this.document, options.FontFamily.Value, drawingFontStyle, true);
                this.fontDictionary.Add(fontKey, pdfFont);
            }

            return(this.fontDictionary[fontKey]);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Create a TextOptions with defaults
 /// </summary>
 public TextOptions()
 {
     this.FontOptions = new TextFontOptions();
 }