本文整理汇总了C#中iTextSharp.text.Document.GetTop方法的典型用法代码示例。如果您正苦于以下问题:C# Document.GetTop方法的具体用法?C# Document.GetTop怎么用?C# Document.GetTop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.text.Document
的用法示例。
在下文中一共展示了Document.GetTop方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderRfq
public void RenderRfq(Stream stream, VendorModel vendor, IEnumerable<ItemModel> items, UserModel user, int RfqNumber, PurchaseRequest Pr, DateTime DateRequested)
{
Document document = new Document(PageSize.LETTER);
try {
PdfWriter writer = PdfWriter.GetInstance(document, stream);
document.Open();
// Create a page in the document and add it to the bottom layer
document.NewPage();
//Pass Document to this
CurrentDoc = document;
page = writer.DirectContentUnder;
page.BeginText();
int top = (int)document.GetTop(0);
SetFontSizeTo(16);
PrintText("REQUEST FOR QUOTATION (THIS IS NOT AN ORDER)", 20, 10);
SetFontSizeTo(10);
//Header
PrintText("Company Name: {0}".WithTokens(Pr.User.Company.Name), 20, 30); // Company Name
PrintText("Address: 8th Floor Gedisco Tower, 534 Asuncion St., Binondo, Manila", 20, 45); // Company Address
PrintText("Purchasing Department", 20, 60);
PrintText("Issued By: {0} {1}".WithTokens(user.FirstName, user.LastName), 20, 75); // Requested By
PrintTextRight("RFQ NO: {0}".WithTokens(RfqNumber), 70, 30); // RFQ Number
PrintTextRight("Date: {0}".WithTokens(DateTime.Now.ToShortDateString()), 70, 45); // Date Created
PrintTextRight("PR No: {0}".WithTokens(Pr.PRNo), 70, 60); // PR Number
//Body
SetFontSizeTo(14);
PrintText("BID/OFFER/QUOTE MUST BE RECEIVED BY:", 20, 105); // Requested By
PrintTextRight("Date: {0}".WithTokens(DateRequested.ToShortDateString()), 95, 105); // Date Required
SetFontSizeTo(10);
PrintText("Attention: {0} {1}".WithTokens(user.FirstName, user.LastName), 40, 125); // Vendor Contact Person
PrintText("Tel No: {0}".WithTokens("+63 2 244 9296"), 40, 140); // Vendor Tel No
PrintText("Email Address: {0}".WithTokens(user.Email), 40, 155); // Vendor Email
PrintText("Fax No: {0}".WithTokens("+63 2 241 7826"), 240, 125); // Vendor Fax No
SetFontSizeTo(8);
PrintText("Unless otherwise requested, quote on each item separately. Unit Prices shall be shown. If unable to furnish", 20, 175); // Vendor Email
PrintText("items as specified, submit sample and/or descriptive specifications of substitute offered.", 20, 185); // Vendor Email
//Items
SetFontSizeTo(8);
PrintText("_______________________________________________________________________________________________________________________", 20, 210);
PrintText("Item No.", 20, 205);
PrintText("Item Description", 70, 205);
PrintText("Quantity", 370, 205);
PrintText("Unit Price", 420, 205);
PrintText("Discount", 470, 205);
PrintText("Total", 520, 205);
//// Items..
//int staryY = 225;
//int itemCount = 1;
//foreach (var item in items) {
// PrintItem(itemCount.ToString(), item.Description, item.Quantity.ToString(), ref staryY);
// itemCount++;
//}
//PrintText("********** NOTHING FOLLOWS **********", 75, staryY + 15);
// START HERE ----------------------------
Paragraph Grid = new Paragraph("\n\n\n\n\n\n\n\n\n");
Grid.Alignment = 1;
Grid.SpacingAfter = 35f;
document.Add(Grid);
Paragraph Grid2 = new Paragraph();
Grid2.Alignment = 1;
Grid2.SpacingBefore = 35f;
//Start Table -----------------------------------
PdfPTable rightTable = new PdfPTable(7);
int[] widths = { 1, 1, 1, 7, 2, 2, 2 };
rightTable.SetWidths(widths);
rightTable.TotalWidth = 570f;
rightTable.LockedWidth = true;
Font tableFont = new Font(Font.FontFamily.HELVETICA, 8);
rightTable.HorizontalAlignment = Element.ALIGN_CENTER;
rightTable.AddCell(new Phrase("Item No.", tableFont));
rightTable.AddCell(new Phrase("Item Description", tableFont));
rightTable.AddCell(new Phrase("Quantity", tableFont));
rightTable.AddCell(new Phrase("Unit Price", tableFont));
rightTable.AddCell(new Phrase("Discount", tableFont));
rightTable.AddCell(new Phrase("Total Amount", tableFont));
rightTable.HorizontalAlignment = Element.ALIGN_LEFT;
int itemCount = 1;
foreach (var item in items) {
rightTable.AddCell(new Phrase(item.ItemNumber.ToString(), tableFont));
rightTable.AddCell(new Phrase(item.Description, tableFont));
rightTable.AddCell(new Phrase(item.Quantity.ToString(), tableFont));
rightTable.AddCell(new Phrase("", tableFont));
rightTable.AddCell(new Phrase("", tableFont));
rightTable.AddCell(new Phrase("", tableFont));
itemCount++;
}
//Nothing Follows
//.........这里部分代码省略.........
示例2: RenderCanvasSheet
public void RenderCanvasSheet(Stream stream, IEnumerable<CanvasItemModel> items, UserModel currentUser,UserModel requestedBy, PurchaseRequest Pr, string[] Vendors)
{
Document document = new Document(PageSize.LETTER);
try {
PdfWriter writer = PdfWriter.GetInstance(document, stream);
document.Open();
// Create a page in the document and add it to the bottom layer
document.NewPage();
//Pass Document to this
CurrentDoc = document;
page = writer.DirectContentUnder;
page.BeginText();
int top = (int)document.GetTop(0);
SetFontSizeTo(16);
PrintText("CANVASS SHEET", 20, 10);
SetFontSizeTo(10);
//Header
PrintText("Company Name: " + requestedBy.CompanyName, 20, 30); // Company Name
PrintText("Department: " + requestedBy.DepartmentName, 20, 45); // Company Address
PrintText("Purpose: " + Pr.Purpose, 20, 60); // Purpose
PrintTextRight("Date: {0}".WithTokens(DateTime.Now.ToShortDateString()), 70, 30); // Date Created
PrintTextRight("PR No: {0}".WithTokens(Pr.PRNo), 70, 45); // PR Number
SetFontSizeTo(8);
// START HERE ----------------------------
Paragraph Grid = new Paragraph("\n");
Grid.Alignment = 1;
Grid.SpacingAfter = 10f;
document.Add(Grid);
Paragraph Grid2 = new Paragraph();
Grid2.Alignment = 1;
Grid2.SpacingBefore = 35f;
//Start Table -----------------------------------
PdfPTable rightTable = new PdfPTable(7);
int[] widths = { 1, 7, 2, 2, 2, 2, 2 };
rightTable.SetWidths(widths);
rightTable.TotalWidth = 570f;
rightTable.LockedWidth = true;
Font tableFont = new Font(Font.FontFamily.HELVETICA, 8);
PdfPCell rightAlignedCell = new PdfPCell();
rightAlignedCell.HorizontalAlignment = Element.ALIGN_CENTER;
//Headers
rightAlignedCell.Phrase = new Phrase("Item No.", tableFont); rightTable.AddCell(rightAlignedCell);
rightAlignedCell.Phrase = new Phrase("Item Description", tableFont); rightTable.AddCell(rightAlignedCell);
rightAlignedCell.Phrase = new Phrase("Quantity", tableFont); rightTable.AddCell(rightAlignedCell);
rightAlignedCell.Phrase = new Phrase("UOM", tableFont); rightTable.AddCell(rightAlignedCell);
rightAlignedCell.Phrase = new Phrase(Vendors[0], tableFont); rightTable.AddCell(rightAlignedCell);
rightAlignedCell.Phrase = new Phrase(Vendors[1], tableFont); rightTable.AddCell(rightAlignedCell);
rightAlignedCell.Phrase = new Phrase(Vendors[2], tableFont); rightTable.AddCell(rightAlignedCell);
rightAlignedCell.HorizontalAlignment = Element.ALIGN_RIGHT;
foreach (var item in items) {
string priceVendor1 = item.PriceVendor1 == 0 ? "NONE" : item.PriceVendor1.ToString();
string priceVendor2 = item.PriceVendor2 == 0 ? "NONE" : item.PriceVendor2.ToString();
string priceVendor3 = item.PriceVendor3 == 0 ? "NONE" : item.PriceVendor3.ToString();
rightTable.AddCell(new Phrase(item.ItemNumber.ToString(), tableFont));
rightTable.AddCell(new Phrase(item.ItemDescription, tableFont));
rightAlignedCell.Phrase = new Phrase(item.Quantity.ToString(), tableFont); rightTable.AddCell(rightAlignedCell);
rightTable.AddCell(new Phrase(item.UOM, tableFont));
rightAlignedCell.Phrase = new Phrase(priceVendor1, tableFont); rightTable.AddCell(rightAlignedCell);
rightAlignedCell.Phrase = new Phrase(priceVendor2, tableFont); rightTable.AddCell(rightAlignedCell);
rightAlignedCell.Phrase = new Phrase(priceVendor3, tableFont); rightTable.AddCell(rightAlignedCell);
}
Grid2.Add(rightTable);
document.Add(Grid2);
// Footer
SetFontSizeTo(10);
PrintTextBottom("Requested By:", 20, 105);
PrintTextBottom("{0} {1}".WithTokens(requestedBy.FirstName, requestedBy.LastName), 20, 35);
PrintTextBottom("Prepared By:", 265, 105);
PrintTextBottom("{0} {1}".WithTokens(currentUser.FirstName, currentUser.LastName), 265, 35);
PrintTextBottom("Approved By:", 450, 105);
PrintTextBottom("{0}".WithTokens("______________________"), 450, 35);
page.EndText();
writer.Flush();
}
finally {
document.Close();
}
}
示例3: RenderPurchaseOrder
public void RenderPurchaseOrder(Stream stream, int PoNumber, IEnumerable<PoItemModel> PoItems, int RequestNumber, string VendorName, string VendorCode, string VendorAddress, DateTime DateCreated, DateTime DeliveryDate, UserModel RequestUser, UserModel CurrentUser)
{
Document document = new Document(PageSize.LETTER);
try {
PdfWriter writer = PdfWriter.GetInstance(document, stream);
document.Open();
// Create a page in the document and add it to the bottom layer
document.NewPage();
//Pass Document to this
CurrentDoc = document;
string logoLocation = sonicLogo;
float logoPosition = 50;
string CurrentCompany = RequestUser.CompanyName;
//Image
if (RequestUser.CompanyId == (int)CompanyIds.SonicSteel) {
logoLocation = sonicLogo;
logoPosition = 70;
}
else if (RequestUser.CompanyId == (int)CompanyIds.SteelTech) {
logoLocation = steeltechLogo;
}
else if (RequestUser.CompanyId == (int)CompanyIds.Somico) {
logoLocation = somicoLogo;
}
Image logo = Image.GetInstance(Directory.GetCurrentDirectory() + logoLocation);
logo.SetAbsolutePosition(20, (int)CurrentDoc.GetTop(logoPosition));
// START HERE ----------------------------
Paragraph Grid = new Paragraph("\n\n\n\n\n\n\n\n\n");
Grid.Alignment = 1;
Grid.SpacingAfter = 35f;
document.Add(Grid);
Paragraph Grid2 = new Paragraph();
Grid2.Alignment = 1;
Grid2.SpacingBefore = 35f;
//Start Table -----------------------------------
PdfPTable rightTable = new PdfPTable(7);
int[] widths = { 1, 1, 1, 7, 2, 2, 2 };
rightTable.SetWidths(widths);
rightTable.TotalWidth = 570f;
rightTable.LockedWidth = true;
Font tableFont = new Font(Font.FontFamily.HELVETICA, 8);
rightTable.HorizontalAlignment = Element.ALIGN_CENTER;
rightTable.AddCell(new Phrase("Item No.", tableFont));
rightTable.AddCell(new Phrase("Quantity", tableFont));
rightTable.AddCell(new Phrase("UOM", tableFont));
rightTable.AddCell(new Phrase("Item Description", tableFont));
rightTable.AddCell(new Phrase("Unit Price", tableFont));
rightTable.AddCell(new Phrase("Discount", tableFont));
rightTable.AddCell(new Phrase("Total Amount", tableFont));
rightTable.HorizontalAlignment = Element.ALIGN_LEFT;
int itemCount = 1;
foreach (var poItem in PoItems) {
rightTable.AddCell(new Phrase(itemCount.ToString(), tableFont)); rightTable.AddCell(new Phrase(poItem.Quantity.ToString(), tableFont)); rightTable.AddCell(new Phrase(poItem.UOM, tableFont)); rightTable.AddCell(new Phrase(poItem.Description, tableFont)); rightTable.AddCell(new Phrase(poItem.Price.ToString(), tableFont)); rightTable.AddCell(new Phrase(poItem.Discount.ToString(), tableFont)); rightTable.AddCell(new Phrase(poItem.TotalPrice.ToString(), tableFont));
itemCount++;
}
//Nothing Follows
rightTable.AddCell(new Phrase("", tableFont)); rightTable.AddCell(new Phrase("", tableFont)); rightTable.AddCell(new Phrase("")); rightTable.AddCell(new Phrase("******** NOTHING FOLLOWS ********", tableFont)); rightTable.AddCell(new Phrase("")); rightTable.AddCell(new Phrase("")); rightTable.AddCell(new Phrase(""));
//Grand Total
rightTable.AddCell(new Phrase("", tableFont)); rightTable.AddCell(new Phrase("", tableFont)); rightTable.AddCell(new Phrase("")); rightTable.AddCell(new Phrase("", tableFont)); rightTable.AddCell(new Phrase("")); rightTable.AddCell(new Phrase("Grand Total:", new Font(Font.FontFamily.HELVETICA, 12))); rightTable.AddCell(new Phrase(PoItems.Sum(x => x.TotalPrice).ToString(), new Font(Font.FontFamily.HELVETICA, 12)));
Grid2.Add(rightTable);
document.Add(Grid2);
// End of table -----------------------------------
page = writer.DirectContentUnder;
page.AddImage(logo);
page.Stroke();
// For "Purchase Order" Text
PrintRectangle(20, 120, 570, 50);
//For two tables
PrintRectangle(20, 230, 350, 100);
PrintRectangle(370, 230, 220, 100);
//For Footer
PrintRectangleBottom(20, 20, 570, 50);
page.BeginText();
SetFontSizeTo(24);
PrintText("PURCHASE ORDER", 180, 105);
SetPOCompanyHeader(RequestUser);
SetFontSizeTo(10);
// Header
PrintText("To:", 25, 140); // Vendor Name
SetFontSizeTo(8);
//.........这里部分代码省略.........