本文整理汇总了C#中iTextSharp.text.pdf.BaseFont类的典型用法代码示例。如果您正苦于以下问题:C# BaseFont类的具体用法?C# BaseFont怎么用?C# BaseFont使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseFont类属于iTextSharp.text.pdf命名空间,在下文中一共展示了BaseFont类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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();
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}
示例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;
}
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
}
示例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);
}