本文整理汇总了C#中iTextSharp.text.BaseColor类的典型用法代码示例。如果您正苦于以下问题:C# BaseColor类的具体用法?C# BaseColor怎么用?C# BaseColor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseColor类属于iTextSharp.text命名空间,在下文中一共展示了BaseColor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GenerateRow
private static void GenerateRow(PdfPTable table, PlayerInfo player, Font font, BaseColor backgroundColor)
{
var jpg = Image.GetInstance(player.PictureUrl);
table.AddCell(jpg);
PdfPCell cell;
cell = new PdfPCell(new Phrase(player.JerseyNumber, font)) {BackgroundColor = backgroundColor};
table.AddCell(cell);
cell = new PdfPCell(new Phrase(player.Name, font)) {BackgroundColor = backgroundColor};
table.AddCell(cell);
if (table.NumberOfColumns == NumberColsWithPosition)
{
cell = new PdfPCell(new Phrase(player.Position, font)) {BackgroundColor = backgroundColor};
table.AddCell(cell);
}
cell = new PdfPCell(new Phrase(player.Height, font)) {BackgroundColor = backgroundColor};
table.AddCell(cell);
cell = new PdfPCell(new Phrase(player.Weight, font)) {BackgroundColor = backgroundColor};
table.AddCell(cell);
cell = new PdfPCell(new Phrase(player.DateOfBirth, font)) {BackgroundColor = backgroundColor};
table.AddCell(cell);
cell = new PdfPCell(new Phrase(player.Age, font)) {BackgroundColor = backgroundColor};
table.AddCell(cell);
cell = new PdfPCell(new Phrase(player.BirthPlace, font)) {BackgroundColor = backgroundColor};
table.AddCell(cell);
}
开发者ID:ColinStranc,项目名称:MockDraftAnalysis,代码行数:34,代码来源:PdfGenerator.cs
示例2: BaseFontAndSize
// 函数描述:设置字体的样式
public static Font BaseFontAndSize(string fontName, int size, int style, BaseColor baseColor)
{
BaseFont.AddToResourceSearch("iTextAsian.dll");
BaseFont.AddToResourceSearch("iTextAsianCmaps.dll");
string fileName;
switch (fontName)
{
case "黑体":
fileName = "SIMHEI.TTF";
break;
case "华文中宋":
fileName = "STZHONGS.TTF";
break;
case "宋体":
fileName = "simsun_1.ttf";
break;
default:
fileName = "simsun_1.ttf";
break;
}
var baseFont = BaseFont.CreateFont(@"c:/windows/fonts/" + fileName, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
var fontStyle = style < -1 ? Font.NORMAL : style;
var font = new Font(baseFont, size, fontStyle, baseColor);
return font;
}
开发者ID:GankerChen2012,项目名称:PdfTools,代码行数:26,代码来源:ExamAnalysiseReportFormat.cs
示例3: LineSeparator
/**
* Creates a new instance of the LineSeparator class.
* @param lineWidth the thickness of the line
* @param percentage the width of the line as a percentage of the available page width
* @param color the color of the line
* @param align the alignment
* @param offset the offset of the line relative to the current baseline (negative = under the baseline)
*/
public LineSeparator(float lineWidth, float percentage, BaseColor lineColor, int align, float offset) {
this.lineWidth = lineWidth;
this.percentage = percentage;
this.lineColor = lineColor;
this.alignment = align;
this.offset = offset;
}
开发者ID:Gianluigi,项目名称:dssnet,代码行数:15,代码来源:LineSeparator.cs
示例4: HeaderGeneration
private static void HeaderGeneration(PdfPTable table, DateTime d)
{
string date = d.Date.ToString("dd-MMM-yyyy", CultureInfo.InvariantCulture);
Font verdana2 = FontFactory.GetFont("Verdana", 12, Font.BOLD);
d = d.Date;
PdfPCell dateCell = new PdfPCell(new Phrase("Date: " + date));
dateCell.Colspan = 5;
dateCell.BackgroundColor = new BaseColor(242, 242, 242);
table.AddCell(dateCell);
BaseColor color = new BaseColor(217, 217, 217);
PdfPCell product = new PdfPCell(new Phrase("Product", verdana2));
product.BackgroundColor = color;
table.AddCell(product);
PdfPCell quantity = new PdfPCell(new Phrase("Quantity", verdana2));
quantity.BackgroundColor = color;
table.AddCell(quantity);
PdfPCell unitPrice = new PdfPCell(new Phrase("Unit Price", verdana2));
unitPrice.BackgroundColor = color;
table.AddCell(unitPrice);
PdfPCell location = new PdfPCell(new Phrase("Location", verdana2));
location.BackgroundColor = color;
table.AddCell(location);
PdfPCell sum = new PdfPCell(new Phrase("Sum", verdana2));
sum.BackgroundColor = color;
table.AddCell(sum);
}
开发者ID:TeamMingFern,项目名称:DatabaseApplicationsTeamwork,代码行数:32,代码来源:PDFGenerator.cs
示例5: GeneratePdfReport
/// <summary>
/// Creates PDF reports and saves them as a PDF file
/// </summary>
public static void GeneratePdfReport()
{
File.Delete(PdfPath + PdfFileName);
var repo = new MSSqlRepository();
var pdfData = repo.GetDataForPdfExport();
var doc = new Document();
PdfWriter.GetInstance(doc, new FileStream(PdfPath + PdfFileName, FileMode.Create));
doc.Open();
PdfPTable table = new PdfPTable(RowCountInPdfExport);
table.DefaultCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
table.DefaultCell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
var headerBackground = new BaseColor(204, 204, 204);
PdfPCell headerCell = new PdfPCell(new Phrase("Sample PDF Export From the Football Manager"));
headerCell.Colspan = RowCountInPdfExport;
headerCell.Padding = 10f;
headerCell.HorizontalAlignment = 1;
headerCell.BackgroundColor = headerBackground;
table.AddCell(headerCell);
string[] col = { "Date", "Staduim", "Home Team", "Away Team", "Result" };
for (int i = 0; i < col.Length; ++i)
{
PdfPCell columnCell = new PdfPCell(new Phrase(col[i]));
columnCell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
columnCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
columnCell.BackgroundColor = headerBackground;
table.AddCell(columnCell);
}
foreach (var item in pdfData)
{
PdfPCell townCell = new PdfPCell(new Phrase(item.Key));
townCell.Colspan = RowCountInPdfExport;
townCell.Padding = 10f;
table.AddCell(townCell);
foreach (var match in item.Value)
{
table.AddCell(match.Date.Day + "." + match.Date.Month + "." + match.Date.Year);
table.AddCell(match.Stadium);
table.AddCell(match.HomeTeam);
table.AddCell(match.AwayTeam);
table.AddCell(match.Result);
}
}
doc.Add(table);
doc.Close();
Process.Start(PdfPath);
}
开发者ID:Team-Selenium,项目名称:Football-Manager,代码行数:58,代码来源:PdfUtils.cs
示例6: CustomFontFactory
public CustomFontFactory(
string defaultFontFilePath,
string defaultFontEncoding = BaseFont.IDENTITY_H,
bool defaultFontEmbedding = BaseFont.EMBEDDED,
float? defaultFontSize = null,
int? defaultFontStyle = null,
BaseColor defaultFontColor = null,
bool automaticalySetReplacementForNullables = true)
{
//set default font properties
DefaultFontPath = defaultFontFilePath;
DefaultFontEncoding = defaultFontEncoding;
DefaultFontEmbedding = defaultFontEmbedding;
DefaultFontColor = defaultFontColor ?? DEFAULT_FONT_COLOR;
DefaultFontSize = defaultFontSize ?? DEFAULT_FONT_SIZE;
DefaultFontStyle = defaultFontStyle ?? DEFAULT_FONT_STYLE;
//set default replacement options
ReplaceFontWithDefault = false;
ReplaceEncodingWithDefault = true;
ReplaceEmbeddingWithDefault = false;
if (automaticalySetReplacementForNullables)
{
ReplaceSizeWithDefault = defaultFontSize.HasValue;
ReplaceStyleWithDefault = defaultFontStyle.HasValue;
ReplaceColorWithDefault = defaultFontColor != null;
}
//define default font
DefaultBaseFont = BaseFont.CreateFont(DefaultFontPath, DefaultFontEncoding, DefaultFontEmbedding);
//register system fonts
FontFactory.RegisterDirectories();
}
开发者ID:TomKaminski,项目名称:ITAD2015,代码行数:35,代码来源:CustomFontFactory.cs
示例7: PdfPatternPainter
internal PdfPatternPainter(PdfWriter wr, BaseColor defaultColor) : this(wr) {
stencil = true;
if (defaultColor == null)
this.defaultColor = BaseColor.GRAY;
else
this.defaultColor = defaultColor;
}
开发者ID:Gianluigi,项目名称:dssnet,代码行数:7,代码来源:PdfPatternPainter.cs
示例8: CreatePdfCell
private PdfPCell CreatePdfCell(string cellInfo, Font font, BaseColor backgroundColor, int colSpan = 0, int horizontalAligment = 0)
{
var cell = new PdfPCell(new Phrase(cellInfo, font));
cell.BackgroundColor = backgroundColor;
cell.Colspan = colSpan;
cell.HorizontalAlignment = horizontalAligment;
return cell;
}
开发者ID:GeriCookie,项目名称:Database-2015-Team-Flerovium-,代码行数:8,代码来源:PDFReporter.cs
示例9: GetCell
public static PdfPCell GetCell(string content, Font font, int horizontalAlignment, BaseColor background = null)
{
return new PdfPCell(new Phrase(content, font))
{
BackgroundColor = background,
HorizontalAlignment = horizontalAlignment,
};
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:8,代码来源:PDFHelper.cs
示例10: CreateReport
public static void CreateReport()
{
string directoryCreating = "..\\..\\..\\SalesReports.pdf";
if (File.Exists(directoryCreating))
{
File.Delete(directoryCreating);
}
Document pdfReport = new Document();
iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(pdfReport,
new System.IO.FileStream(directoryCreating, System.IO.FileMode.Create));
pdfReport.Open();
using (pdfReport)
{
PdfPTable reportTable = new PdfPTable(5);
AddCellToTable(reportTable, "Aggregated Sales Report", TextAlign.Center, 5);
using (var supermarketEntities = new SupermarketEntities())
{
var reportsOrderedByDate = supermarketEntities.Reports.OrderBy(x => x.ReportDate);
var currentDate = reportsOrderedByDate.First().ReportDate;
decimal currentSum = 0;
decimal totalSum = 0;
var headerColor = new BaseColor(217, 217, 217);
AddHeader(reportTable, currentDate, headerColor);
// aligment 0 = left, 1 = center, 2 = right
foreach (var report in reportsOrderedByDate)
{
if (currentDate != report.ReportDate)
{
AddFooter(reportTable, "Total sum for " + currentDate.ToString(), currentSum);
currentSum = 0;
currentDate = report.ReportDate;
AddHeader(reportTable, currentDate, headerColor);
}
else
{
AddCellToTable(reportTable, report.Product.ProductName.ToString(), 0);
AddCellToTable(reportTable, report.Quantity.ToString(), 0);
AddCellToTable(reportTable, report.UnitPrice.ToString(), 0);
AddCellToTable(reportTable, report.Supermarket.ToString(), 0);
AddCellToTable(reportTable, report.Sum.ToString(), 0);
totalSum += (decimal)report.Sum;
currentSum += (decimal)report.Sum;
}
}
AddFooter(reportTable, "Total sum for " + currentDate.ToString(), currentSum);
AddFooter(reportTable, "Grand total:", totalSum);
}
pdfReport.Add(reportTable);
}
}
开发者ID:TeamMojito,项目名称:SupermarketsDatabaseClient,代码行数:56,代码来源:PdfReportert.cs
示例11: CalendarAttributes
/// <summary>
/// MonthCalendar's attributes.
/// </summary>
public CalendarAttributes()
{
RelativeColumnWidths = new float[] { 1, 1, 1, 1, 1, 1, 1 };
BorderColor = BaseColor.LIGHT_GRAY;
GradientStartColor = new BaseColor(Color.LightGray.ToArgb());
GradientEndColor = new BaseColor(Color.DarkGray.ToArgb());
Padding = 5;
UseLongDayNamesOfWeek = true;
DayNamesRowBackgroundColor = new BaseColor(Color.WhiteSmoke.ToArgb());
}
开发者ID:VahidN,项目名称:PdfReport,代码行数:13,代码来源:CalendarAttributes.cs
示例12: ColoredTxtCell
public static PdfPCell ColoredTxtCell(string content, BaseColor color = null)
{
PdfPCell c = new PdfPCell(new Phrase(content));
// c.Border = PdfPCell.BOTTOM_BORDER | PdfPCell.TOP_BORDER | PdfPCell.LEFT_BORDER | PdfPCell.RIGHT_BORDER;
c.Padding = 4;
c.BorderWidth = 1;
c.BorderColor = new BaseColor(System.Drawing.Color.Transparent);
_getColoredCell(c, color);
return c;
}
开发者ID:gdlprj,项目名称:duscusys,代码行数:10,代码来源:PdfTools.cs
示例13: CreateFooterCell
private static PdfPCell CreateFooterCell(string cellValue, int colspan = 1, bool isBold = false, BaseColor backgroundColor = null)
{
PdfPCell cell = new PdfPCell(new Phrase(cellValue, new Font(DefaultFont, 10f, isBold ? Font.BOLD : Font.NORMAL)));
cell.Colspan = colspan;
cell.HorizontalAlignment = Element.ALIGN_RIGHT;
cell.Padding = DefaultCellPadding;
cell.BackgroundColor = backgroundColor;
return cell;
}
开发者ID:Okiana,项目名称:Team-Diosma,代码行数:10,代码来源:SalesReportGenerator.cs
示例14: AddBorderToTable
// Public Methods (6)
/// <summary>
/// Adds a border to an existing PdfGrid
/// </summary>
/// <param name="table">Table</param>
/// <param name="borderColor">Border's color</param>
/// <param name="spacingBefore">Spacing before the table</param>
/// <returns>A new PdfGrid</returns>
public static PdfGrid AddBorderToTable(this PdfGrid table, BaseColor borderColor, float spacingBefore)
{
var outerTable = new PdfGrid(numColumns: 1)
{
WidthPercentage = table.WidthPercentage,
SpacingBefore = spacingBefore
};
var pdfCell = new PdfPCell(table) { BorderColor = borderColor };
outerTable.AddCell(pdfCell);
return outerTable;
}
开发者ID:VahidN,项目名称:PdfReport,代码行数:19,代码来源:TableHelper.cs
示例15: PDFStyle
static PDFStyle()
{
var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "Arial.TTF");
BaseFont = BaseFont.CreateFont(path, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
NormalFont = new Font(BaseFont, Font.DEFAULTSIZE, Font.NORMAL);
BoldFont = new Font(BaseFont, Font.DEFAULTSIZE, Font.BOLD);
TextFont = new Font(BaseFont, 12, Font.NORMAL);
BoldTextFont = new Font(BaseFont, 12, Font.BOLD);
HeaderFont = new Font(BaseFont, 16, Font.BOLD);
HeaderBackground = new BaseColor(unchecked((int)0xFFD3D3D3));
}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:12,代码来源:PDFStyle.cs
示例16: DumpColor
private String DumpColor(BaseColor col) {
StringBuilder colBuf = new StringBuilder();
colBuf.Append("r:");
colBuf.Append(col.R);
colBuf.Append(" g:");
colBuf.Append(col.G);
colBuf.Append(" b:");
colBuf.Append(col.B);
colBuf.Append(" a:");
colBuf.Append(col.A);
return colBuf.ToString();
}
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:13,代码来源:WebColorTest.cs
示例17: GoodColorTests
public virtual void GoodColorTests() {
String[] colors = {
"#00FF00", "00FF00", "#0F0", "0F0", "LIme",
"rgb(0,255,0 )"
};
// TODO webColor creates colors with a zero alpha channel (save
// "transparent"), BaseColor's 3-param constructor creates them with a
// 0xFF alpha channel. Which is right?!
BaseColor testCol = new BaseColor(0, 255, 0);
foreach (String colStr in colors) {
BaseColor curCol = WebColors.GetRGBColor(colStr);
Assert.IsTrue(testCol.Equals(curCol), DumpColor(testCol) + "!=" + DumpColor(curCol));
}
}
开发者ID:newlysoft,项目名称:itextsharp,代码行数:14,代码来源:WebColorTest.cs
示例18: Generate
public static bool Generate(string filename)
{
Document document = new Document(PageSize.A4, 0f, 0f, 0f, 0f);
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filename, FileMode.Create));
document.Open();
PdfContentByte canvas = writer.DirectContent;
Font font = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 10);
string[] captions = { "ATM", "CASH", "WEB", "MOBILE" };
//double[] values = { 2, 60, 20, 18 };
double[] values = { 5, 60, 35, 0 };
PieChart chart = new PieChart(values, captions);
canvas.DrawPieChart(chart, 110, 730, 100);
canvas.DrawPieChart(chart, 410, 730, 60);
string[] captions2 = { "CAPTION 1", "CAPTION 2", "CAPTION 3", "CAPTION 4", "CAPTION 5", "CAPTION 6", "CAPTION 7", "CAPTION 8", "CAPTION 9", "CAPTION 10" };
double[] values2 = { 100, 80, 60, 40, 50, 60, 30, 0, 90, 40 };
chart = new PieChart(values2, captions2);
canvas.DrawPieChart(chart, 110, 520, 100, font);
canvas.DrawPieChart(chart, 410, 520, 60);
//string[] captions3 = { "CAPTION 1", "CAPTION 2", "CAPTION 3" };
//double[] values3 = { 100, 80, 60 };
//System.Drawing.Color[] colors = new System.Drawing.Color[] { System.Drawing.Color.Black,
// System.Drawing.Color.CornflowerBlue,
// System.Drawing.Color.Brown };
//chart = new PieChart(values3, captions3, colors);
//canvas.DrawPieChart(chart, 110, 300, 100, font);
//canvas.DrawPieChart(chart, 410, 300, 60);
string[] captions4 = { "CAPTION 1", "CAPTION 2", "CAPTION 3", "CAPTION 4", "CAPTION 5" };
double[] values4 = { 100, 80, 60, 50, 50 };
BaseColor pantome376 = new BaseColor(130, 197, 91);
BaseColor pantone369 = new BaseColor(95, 182, 85);
BaseColor pantonecool = new BaseColor(88, 89, 91);
BaseColor pantone447 = new BaseColor(67, 66, 61);
BaseColor pantonecoolLight = new BaseColor(173, 216, 230);
BaseColor[] colors4 = { pantome376, pantone369, pantonecool, pantone447, pantonecoolLight };
chart = new PieChart(values4, captions4, colors4);
canvas.DrawPieChart(chart, 110, 300, 100, font);
canvas.DrawPieChart(chart, 410, 300, 60);
document.Close();
return true;
}
开发者ID:KunleSmart,项目名称:iTextSharpExtensions,代码行数:48,代码来源:Program.cs
示例19: CreateCell
public static PdfPCell CreateCell(string str, int align = Element.ALIGN_CENTER, float fixedHeight = -1, BaseColor borderColor = null, int colSpan = 1, Fonts font = Fonts.Standard)
{
var c = new PdfPCell(GetPhrase(str, font))
{
HorizontalAlignment = align,
VerticalAlignment = Element.ALIGN_TOP,
Padding = 5,
BorderColor = borderColor ?? BaseColor.BLACK,
Colspan = colSpan
};
if (fixedHeight > 0)
{
c.FixedHeight = fixedHeight;
}
c.PaddingTop = 2;
return c;
}
开发者ID:HardcoreSoftware,项目名称:iSecretary,代码行数:17,代码来源:ElementFactory.cs
示例20: GetImageTextCell
public static PdfPCell GetImageTextCell(string imageSource, string text, float partial, BaseColor background = null)
{
var image = GetImage(imageSource);
var nestedTable = new PdfPTable(2);
nestedTable.SetWidths(new float[] { 1f, partial });
nestedTable.DefaultCell.Border = 0;
if (image == null)
nestedTable.AddCell("");
else
nestedTable.AddCell(image);
nestedTable.AddCell(new Phrase(text, PDFStyle.NormalFont));
return new PdfPCell(nestedTable)
{
Padding = 0,
BackgroundColor = background
};
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:18,代码来源:PDFHelper.cs
注:本文中的iTextSharp.text.BaseColor类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论