public Aspose.Pdf.Generator.Pdf GetCustomerLabels() { Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf(); pdf.IsTruetypeFontMapCached = false; // If you have purchased a license, // Set license like this: // string licenseFile = MapPath("License") + "\\Aspose.Pdf.lic"; // Aspose.Pdf.License lic = new Aspose.Pdf.License(); // lic.SetLicense(licenseFile); string xmlFile = Server.MapPath("~/App_Data/xml/CustomerLabels.xml"); pdf.BindXML(xmlFile, null); Section section = pdf.Sections["section1"]; Aspose.Pdf.Generator.Table table1 = (Aspose.Pdf.Generator.Table)section.Paragraphs["table1"]; IList <Customer> customersList = customerDao.GetAll(); string[] strArr = new string[customersList.Count]; for (int i = 0; i < customersList.Count; i++) { strArr[i] = customersList[0].CompanyName.ToString() + "#$NL" + customersList[1].Address.ToString() + "#$NL" + customersList[2].City.ToString() + " " + (customersList[3].Region == null ? string.Empty : customersList[3].Region.ToString()) + " " + customersList[4].PostalCode.ToString() + "#$NL" + customersList[5].Country.ToString(); } table1.DefaultCellTextInfo.FontSize = 10; table1.ImportArray(strArr, 0, 0, false); foreach (Row cRow in table1.Rows) { foreach (Cell curCell in cRow.Cells) { curCell.Padding = new MarginInfo(); curCell.Padding.Top = 10; } } return(pdf); }
public Aspose.Pdf.Generator.Pdf GetCustomerLabels() { Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf(); pdf.IsTruetypeFontMapCached = false; // If you have purchased a license, // Set license like this: // string licenseFile = MapPath("License") + "\\Aspose.Pdf.lic"; // Aspose.Pdf.License lic = new Aspose.Pdf.License(); // lic.SetLicense(licenseFile); string xmlFile = Server.MapPath("~/App_Data/xml/CustomerLabels.xml"); pdf.BindXML(xmlFile, null); Section section = pdf.Sections["section1"]; Aspose.Pdf.Generator.Table table1 = (Aspose.Pdf.Generator.Table)section.Paragraphs["table1"]; IList<Customer> customersList = customerDao.GetAll(); string[] strArr = new string[customersList.Count]; for (int i = 0; i < customersList.Count; i++) { strArr[i] = customersList[0].CompanyName.ToString() + "#$NL" + customersList[1].Address.ToString() + "#$NL" + customersList[2].City.ToString() + " " + (customersList[3].Region == null ? string.Empty : customersList[3].Region.ToString()) + " " + customersList[4].PostalCode.ToString() + "#$NL" + customersList[5].Country.ToString(); } table1.DefaultCellTextInfo.FontSize = 10; table1.ImportArray(strArr, 0, 0, false); foreach (Row cRow in table1.Rows) { foreach (Cell curCell in cRow.Cells) { curCell.Padding = new MarginInfo(); curCell.Padding.Top = 10; } } return pdf; }
public Aspose.Pdf.Generator.Pdf GetInvoice(FlightInfo flightInfo, PassengerInfo passengerInfo, BookingInfo bookingInfo) { //create a Pdf object Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf(); pdf.IsTruetypeFontMapCached = false; //bind XML file string xmlFile = path + "\\Invoice.xml"; pdf.BindXML(xmlFile, null); //create header HeaderFooter headerFooter = pdf.Sections[0].OddHeader; Image logoImage = (Image)headerFooter.Paragraphs[0]; logoImage.ImageInfo.File = path + "\\flynowairlinelogoandinvoice.jpg"; logoImage.ImageScale = 0.74F; //call the method to create invoice PutOrder(pdf, flightInfo, passengerInfo, bookingInfo); return pdf; }
public Aspose.Pdf.Generator.Pdf GetInvoice(FlightInfo flightInfo, PassengerInfo passengerInfo, BookingInfo bookingInfo) { //create a Pdf object Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf(); pdf.IsTruetypeFontMapCached = false; //bind XML file string xmlFile = path + "\\Invoice.xml"; pdf.BindXML(xmlFile, null); //create header HeaderFooter headerFooter = pdf.Sections[0].OddHeader; Image logoImage = (Image)headerFooter.Paragraphs[0]; logoImage.ImageInfo.File = path + "\\flynowairlinelogoandinvoice.jpg"; logoImage.ImageScale = 0.74F; //call the method to create invoice PutOrder(pdf, flightInfo, passengerInfo, bookingInfo); return(pdf); }
public Aspose.Pdf.Generator.Pdf GetCatalog() { productsList = productDao.GetAll(); CategoryList = categoryDao.GetAll(); Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf(); pdf.IsTruetypeFontMapCached = false; // If you have purchased a license, // Set license like this: // string licenseFile = MapPath("License") + "\\Aspose.Pdf.lic"; // Aspose.Pdf.License lic = new Aspose.Pdf.License(); // lic.SetLicense(licenseFile); string xmlFile = Server.MapPath("~/App_Data/xml/Catalog.xml"); string path = Server.MapPath("~/img"); pdf.BindXML(xmlFile, null); Section section = pdf.Sections["section1"]; Paragraph logoPara = section.Paragraphs["Logo"]; Image logoImage = (Image)logoPara; logoImage.ImageInfo.File = path + "\\FallCatalog.jpg"; logoImage.ImageScale = 0.77F; Section section2 = pdf.Sections["section2"]; Paragraph beveragePara = section2.Paragraphs["BeverageTable"]; Table beverageTable = (Table)beveragePara; Row row1 = beverageTable.Rows[0]; Cell row1Cell2 = row1.Cells[1]; Image beverageImage = (Image)row1Cell2.Paragraphs[0]; beverageImage.ImageInfo.File = path + "\\Beverage.jpg"; Table beveragesTable1 = (Table)section2.Paragraphs["BeverageTable1"]; FillTable(beveragesTable1, GetProductsByCateGoryID(1)); Paragraph condimentsPara = section2.Paragraphs["CondimentsTable"]; Table condimentsTable = (Table)condimentsPara; Row row1CondimentTable = condimentsTable.Rows[0]; Cell row1Cell2CondimentTable = row1CondimentTable.Cells[1]; Image condimentsImage = (Image)row1Cell2CondimentTable.Paragraphs[0]; condimentsImage.ImageInfo.File = path + "\\Condiments.jpg"; Table condimentsTable1 = (Table)section2.Paragraphs["CondimentsTable1"]; FillTable(condimentsTable1, GetProductsByCateGoryID(2)); Paragraph confectionsPara = section2.Paragraphs["ConfectionsTable"]; Table confectionsTable = (Table)confectionsPara; Row row1ConfectionsTable = confectionsTable.Rows[0]; Cell row1Cell2ConfectionsTable = row1ConfectionsTable.Cells[1]; Image confectionsImage = (Image)row1Cell2ConfectionsTable.Paragraphs[0]; confectionsImage.ImageInfo.File = path + "\\Confections.jpg"; Table confectionsTable1 = (Table)section2.Paragraphs["ConfectionsTable1"]; FillTable(confectionsTable1, GetProductsByCateGoryID(3)); Paragraph dairyPara = section2.Paragraphs["DairyTable"]; Table dairyTable = (Table)dairyPara; Row row1DairyTable = dairyTable.Rows[0]; Cell row1Cell2DairyTable = row1DairyTable.Cells[1]; Image diaryImage = (Image)row1Cell2DairyTable.Paragraphs[0]; diaryImage.ImageInfo.File = path + "\\Dairy.jpg"; Table dairyTable1 = (Table)section2.Paragraphs["DairyTable1"]; FillTable(dairyTable1, GetProductsByCateGoryID(4)); Paragraph grainsPara = section2.Paragraphs["GrainsTable"]; Table grainsTable = (Table)grainsPara; Row row1GrainsTable = grainsTable.Rows[0]; Cell row1Cell2GrainsTable = row1GrainsTable.Cells[1]; Image grainsImage = (Image)row1Cell2GrainsTable.Paragraphs[0]; grainsImage.ImageInfo.File = path + "\\Grains.jpg"; Table grainsTable1 = (Table)section2.Paragraphs["GrainsTable1"]; FillTable(grainsTable1, GetProductsByCateGoryID(5)); Paragraph meatPara = section2.Paragraphs["MeatTable"]; Table meatTable = (Table)meatPara; Row row1MeatTable = meatTable.Rows[0]; Cell row1Cell2MeatTable = row1MeatTable.Cells[1]; Image meatImage = (Image)row1Cell2MeatTable.Paragraphs[0]; meatImage.ImageInfo.File = path + "\\Meat.jpg"; Table meatTable1 = (Table)section2.Paragraphs["MeatTable1"]; FillTable(meatTable1, GetProductsByCateGoryID(6)); Paragraph producePara = section2.Paragraphs["ProduceTable"]; Table produceTable = (Table)producePara; Row row1ProduceTable = produceTable.Rows[0]; Cell row1Cell2ProduceTable = row1ProduceTable.Cells[1]; Image produceImage = (Image)row1Cell2ProduceTable.Paragraphs[0]; produceImage.ImageInfo.File = path + "\\Produce.jpg"; Table produceTable1 = (Table)section2.Paragraphs["ProduceTable1"]; FillTable(produceTable1, GetProductsByCateGoryID(7)); Paragraph seafoodPara = section2.Paragraphs["SeafoodTable"]; Table seafoodTable = (Table)seafoodPara; Row row1SeafoodTable = seafoodTable.Rows[0]; Cell row1Cell2SeafoodTable = row1SeafoodTable.Cells[1]; Image seafoodImage = (Image)row1Cell2SeafoodTable.Paragraphs[0]; seafoodImage.ImageInfo.File = path + "\\Seafood.jpg"; Table seafoodTable1 = (Table)section2.Paragraphs["SeafoodTable1"]; FillTable(seafoodTable1, GetProductsByCateGoryID(8)); return(pdf); }
public Aspose.Pdf.Generator.Pdf GetProductsByCategory() { IList <Product> productsList = productDao.GetAll(); IList <Category> CategoryList = categoryDao.GetAll(); Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf(); pdf.IsTruetypeFontMapCached = false; // If you have purchased a license, // Set license like this: // string licenseFile = MapPath("License") + "\\Aspose.Pdf.lic"; // Aspose.Pdf.License lic = new Aspose.Pdf.License(); // lic.SetLicense(licenseFile); string xmlFile = Server.MapPath("~/App_Data/xml/ProductsByCategory.xml"); pdf.BindXML(xmlFile, null); Section section = pdf.Sections["section1"]; Aspose.Pdf.Generator.Table table1 = new Aspose.Pdf.Generator.Table(section); section.Paragraphs.Add(table1); table1.ColumnWidths = "314 314 314"; table1.Border = new BorderInfo((int)BorderSide.Top, 4, new Aspose.Pdf.Generator.Color(204)); table1.IsRowBroken = false; table1.DefaultCellPadding.Top = table1.DefaultCellPadding.Bottom = 15; table1.DefaultCellTextInfo.FontSize = 14; table1.Margin.Top = 10; int j; Row curRow = null; Cell curCell = null; Aspose.Pdf.Generator.Table curSubTab = null; string[] names = new string[] { "Catagory: Beverages", "Catagory: Condiments", "Catagory: Confections", "Catagory: Dairy Products", "Catagory: Grains/Cereals", "Catagory: Meat/Poultry", "Catagory: Produce", "Catagory: Seafood" }; for (j = 1; j <= 8; j++) { if (j == 1 || j == 4 || j == 7) { curRow = table1.Rows.Add(); } curCell = curRow.Cells.Add(); curSubTab = new Aspose.Pdf.Generator.Table(curCell); curSubTab.DefaultCellPadding.Top = curSubTab.DefaultCellPadding.Bottom = 3; curCell.Paragraphs.Add(curSubTab); curSubTab.ColumnWidths = "214 90"; Row row0 = curSubTab.Rows.Add(); Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo(); tf1.FontSize = 16; tf1.FontName = "Times-Bold"; row0.Cells.Add(names[j - 1], tf1); IList <Product> filteredProductsList = (from productsTable in productsList where (productsTable.Discontinued == false) && (productsTable.CategoryID == j) orderby productsTable.ProductName select productsTable).ToList <Product>(); DataTable dataTable1 = ConvertToDataTable(filteredProductsList); curSubTab.ImportDataTable(dataTable1, true, 1, 0); curSubTab.Rows[1].Border = new BorderInfo((int)(BorderSide.Top | BorderSide.Bottom), 4, new Aspose.Pdf.Generator.Color(204)); Row lastRow = curSubTab.Rows[curSubTab.Rows.Count - 1]; foreach (Cell cCell in lastRow.Cells) { cCell.Padding.Bottom = 20; } lastRow = curSubTab.Rows.Add(); lastRow.Cells.Add("number of products:"); lastRow.Cells.Add(dataTable1.Rows.Count.ToString()); lastRow.Border = new BorderInfo((int)BorderSide.Top, new Aspose.Pdf.Generator.Color(204)); } curRow.Cells.Add(); return(pdf); }