Пример #1
0
        private void PutAdress(Aspose.Pdf.Generator.Pdf pdf, PassengerInfo passengerInfo)
        {
            //create table to add address of the customer
            Table adressTable = new Table();

            adressTable.IsFirstParagraph                = true;
            adressTable.ColumnWidths                    = "60 180 60 180";
            adressTable.DefaultCellTextInfo.FontSize    = 10;
            adressTable.DefaultCellTextInfo.LineSpacing = 3;
            adressTable.DefaultCellPadding.Bottom       = 3;
            //add this table in the first section/page
            Section section = pdf.Sections[0];

            section.Paragraphs.Add(adressTable);
            //add a new row in the table
            Row row1AdressTable = new Row(adressTable);

            adressTable.Rows.Add(row1AdressTable);
            //add cells and text
            Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo();
            tf1.Color    = new Aspose.Pdf.Generator.Color(111, 146, 188);
            tf1.FontName = "Helvetica-Bold";

            row1AdressTable.Cells.Add("Bill To:", tf1);
            row1AdressTable.Cells.Add(passengerInfo.Name + "#$NL" +
                                      passengerInfo.Address + "#$NL" + passengerInfo.Email + "#$NL" +
                                      passengerInfo.PhoneNumber);
        }
Пример #2
0
        private void PutOrder(Aspose.Pdf.Generator.Pdf pdf, PassengerInfo passengerInfo, FlightInfo flightInfo, BookingInfo bookingInfo)
        {
            //ticket for leaving
            PutSummary(pdf, passengerInfo, bookingInfo, flightInfo, false);

            //ticket for returning
            PutSummary(pdf, passengerInfo, bookingInfo, flightInfo, true);
        }
Пример #3
0
        private void PutOrder(Aspose.Pdf.Generator.Pdf pdf, FlightInfo flightInfo, PassengerInfo passengerInfo, BookingInfo bookingInfo)
        {
            //add customer address at the top
            PutAdress(pdf, passengerInfo);
            //add order summary
            PutSummary(pdf, passengerInfo, flightInfo);
            //create a table and add order details in row(s)
            Table table = AddTable(pdf);

            AddRow(pdf, table, flightInfo);
            PutAmount(pdf, flightInfo.Fare, 0);
        }
Пример #4
0
        public static void Run()
        {
            // ExStart:SVGToPDF
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Conversion();

            // Instantiate Pdf object
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
            // Bind the source SVG file
            pdf.BindSvg( dataDir + "SVGToPDF.svg");
            // Save the resultant PDF document
            pdf.Save(dataDir + @"SVGToPDF_out.pdf");
            // ExEnd:SVGToPDF
        }
Пример #5
0
        public static void Run()
        {
            // ExStart:SVGToPDF
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Conversion();

            // Instantiate Pdf object
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
            // Bind the source SVG file
            pdf.BindSvg(dataDir + "SVGToPDF.svg");
            // Save the resultant PDF document
            pdf.Save(dataDir + @"SVGToPDF_out_.pdf");
            // ExEnd:SVGToPDF
        }
Пример #6
0
        private Table AddTable(Aspose.Pdf.Generator.Pdf pdf)
        {
            //create a table to hold order details
            Table detailTable = new Table();

            Aspose.Pdf.Generator.Color color = new Aspose.Pdf.Generator.Color(111, 146, 188);
            detailTable.Margin.Top   = 20;
            detailTable.ColumnWidths = "60 150 60 80 60 80";
            //detailTable.DefaultCellBorder = new BorderInfo((int)(BorderSide.Top|BorderSide.Bottom), color);
            detailTable.DefaultCellBorder            = new BorderInfo((int)(BorderSide.Top | BorderSide.Bottom | BorderSide.Right | BorderSide.Left), color);
            detailTable.DefaultCellTextInfo.FontSize = 10;
            detailTable.DefaultCellPadding.Bottom    = detailTable.DefaultCellPadding.Top = 4;
            Section section = pdf.Sections[0];

            section.Paragraphs.Add(detailTable);

            Row row1DetailTable = detailTable.Rows.Add();

            Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo();
            tf1.FontSize  = 10;
            tf1.Color     = new Aspose.Pdf.Generator.Color("White");
            tf1.FontName  = "Helvetica-Bold";
            tf1.Alignment = AlignmentType.Center;

            Cell cell1Row1DetailTable = row1DetailTable.Cells.Add("Product ID", tf1);

            cell1Row1DetailTable.BackgroundColor = color;

            Cell cell2Row1DetailTable = row1DetailTable.Cells.Add("Product Name", tf1);

            cell2Row1DetailTable.BackgroundColor = color;

            Cell cell3Row1DetailTable = row1DetailTable.Cells.Add("Quantity", tf1);

            cell3Row1DetailTable.BackgroundColor = color;

            Cell cell4Row1DetailTable = row1DetailTable.Cells.Add("Unit Price", tf1);

            cell4Row1DetailTable.BackgroundColor = color;

            Cell cell5Row1DetailTable = row1DetailTable.Cells.Add("Discount", tf1);

            cell5Row1DetailTable.BackgroundColor = color;

            Cell cell6Row1DetailTable = row1DetailTable.Cells.Add("Extended Price", tf1);

            cell6Row1DetailTable.BackgroundColor = color;

            return(detailTable);
        }
Пример #7
0
		public Aspose.Pdf.Generator.Pdf GetTicket(PassengerInfo passengerInfo, FlightInfo flightInfo, BookingInfo bookingInfo)
		{
            
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
			pdf.IsTruetypeFontMapCached = false;
            			
            pdf.Sections.Add();
            MarginInfo marginInfo = new MarginInfo();
            marginInfo.Top = 50;
            marginInfo.Left = 50;
            marginInfo.Right = 50;

            pdf.Sections[0].PageInfo.Margin = marginInfo;

            PutOrder(pdf, passengerInfo, flightInfo, bookingInfo);

            return pdf;
		}
Пример #8
0
        public Aspose.Pdf.Generator.Pdf GetTicket(PassengerInfo passengerInfo, FlightInfo flightInfo, BookingInfo bookingInfo)
        {
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
            pdf.IsTruetypeFontMapCached = false;

            pdf.Sections.Add();
            MarginInfo marginInfo = new MarginInfo();

            marginInfo.Top   = 50;
            marginInfo.Left  = 50;
            marginInfo.Right = 50;

            pdf.Sections[0].PageInfo.Margin = marginInfo;

            PutOrder(pdf, passengerInfo, flightInfo, bookingInfo);

            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);
        }
Пример #10
0
        public static void Run()
        {
            // ExStart:HTMLToPDF
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Conversion();

            // Instantiate an object PDF class
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
            
            // Add the section to PDF document sections collection
            Aspose.Pdf.Generator.Section section = pdf.Sections.Add();

            // Read the contents of HTML file into StreamReader object
            StreamReader r = File.OpenText(dataDir + "resultant.html");
            
            // Create text paragraphs containing HTML text
            Aspose.Pdf.Generator.Text text2 = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd());
            
            // Enable the property to display HTML contents within their own formatting
            text2.IsHtmlTagSupported = true;

            // ExStart:OverwriteFontNames
            text2.IfHtmlTagSupportedOverwriteHtmlFontNames = true;
            text2.IfHtmlTagSupportedOverwriteHtmlFontSizes = true;
            // ExEnd:OverwriteFontNames            

            // Add the text paragraphs containing HTML text to the section
            section.Paragraphs.Add(text2);
            
            // Specify the URL which serves as images database
            pdf.HtmlInfo.ImgUrl = dataDir;

            // ExStart:SpecialCharacters
            // Following properties are added from Aspose.Pdf for .NET 8.4.0
            pdf.HtmlInfo.BadHtmlHandlingStrategy = BadHtmlHandlingStrategy.TreatAsPlainText;
            pdf.HtmlInfo.ShowUnknownHtmlTagsAsText = true;
            // ExEnd:SpecialCharacters

            // Save the Pdf document
            pdf.Save(dataDir + "HTML2pdf_out.pdf");
            // ExEnd:HTMLToPDF
        }
Пример #11
0
        public static void Run()
        {
            // ExStart:HTMLToPDF
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Conversion();

            // Instantiate an object PDF class
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();

            // Add the section to PDF document sections collection
            Aspose.Pdf.Generator.Section section = pdf.Sections.Add();

            // Read the contents of HTML file into StreamReader object
            StreamReader r = File.OpenText(dataDir + "resultant.html");

            // Create text paragraphs containing HTML text
            Aspose.Pdf.Generator.Text text2 = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd());

            // Enable the property to display HTML contents within their own formatting
            text2.IsHtmlTagSupported = true;

            // ExStart:OverwriteFontNames
            text2.IfHtmlTagSupportedOverwriteHtmlFontNames = true;
            text2.IfHtmlTagSupportedOverwriteHtmlFontSizes = true;
            // ExEnd:OverwriteFontNames

            // Add the text paragraphs containing HTML text to the section
            section.Paragraphs.Add(text2);

            // Specify the URL which serves as images database
            pdf.HtmlInfo.ImgUrl = dataDir;

            // ExStart:SpecialCharacters
            // Following properties are added from Aspose.Pdf for .NET 8.4.0
            pdf.HtmlInfo.BadHtmlHandlingStrategy   = BadHtmlHandlingStrategy.TreatAsPlainText;
            pdf.HtmlInfo.ShowUnknownHtmlTagsAsText = true;
            // ExEnd:SpecialCharacters

            // Save the Pdf document
            pdf.Save(dataDir + "HTML2pdf_out_.pdf");
            // ExEnd:HTMLToPDF
        }
        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;
        }
Пример #13
0
        private void AddRow(Aspose.Pdf.Generator.Pdf pdf, Aspose.Pdf.Generator.Table tabel, FlightInfo flightInfo)
        {
            //add a new row in order detail.
            Section section = pdf.Sections[0];

            Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo();
            tf1.FontSize  = 10;
            tf1.Alignment = AlignmentType.Center;

            Row row1DetailTable = tabel.Rows.Add();

            row1DetailTable.Cells.Add("1", tf1);
            tf1.Alignment = AlignmentType.Left;
            row1DetailTable.Cells.Add("Ticket: " + flightInfo.DepartureLocation + " to " + flightInfo.Destination, tf1);
            tf1.Alignment = AlignmentType.Center;
            row1DetailTable.Cells.Add("1", tf1);
            row1DetailTable.Cells.Add(flightInfo.Fare.ToString("c", locale), tf1);
            row1DetailTable.Cells.Add("0" + "%", tf1);
            row1DetailTable.Cells.Add(flightInfo.Fare.ToString("c", locale), tf1);
        }
 public static void Run()
 {
     // ExStart:HTMLToPDFUsingStream
     // The path to the documents directory.
     string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Conversion();
     // Instantiate Pdf object
     Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
     // Specify the Character encoding for HTML file
     pdf.HtmlInfo.CharSet = "UTF-8";
     pdf.HtmlInfo.CharsetApplyingLevelOfForce = HtmlInfo.CharsetApplyingForceLevel.UseWhenImpossibleDetectFromContent;
     // Load the HTML file to Stream object
     using (Stream htmlAsStream = System.IO.File.OpenRead(dataDir + "resultant.html"))
     {
         // Bind the source HTML
         pdf.BindHTML(htmlAsStream, "");
     }
     // Save the PDF file
     pdf.Save(dataDir + "HTMLToPDFUsingStream_out.pdf");
     // ExEnd:HTMLToPDFUsingStream
 }
Пример #15
0
        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;
        }
Пример #16
0
        public static void Run()
        {
            // ExStart:HTMLToPDFUsingStream
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Conversion();

            // Instantiate Pdf object
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
            // Specify the Character encoding for HTML file
            pdf.HtmlInfo.CharSet = "UTF-8";
            pdf.HtmlInfo.CharsetApplyingLevelOfForce = HtmlInfo.CharsetApplyingForceLevel.UseWhenImpossibleDetectFromContent;
            // Load the HTML file to Stream object
            using (Stream htmlAsStream = System.IO.File.OpenRead(dataDir + "resultant.html"))
            {
                // Bind the source HTML
                pdf.BindHTML(htmlAsStream, "");
            }
            // Save the PDF file
            pdf.Save(dataDir + "HTMLToPDFUsingStream_out.pdf");
            // ExEnd:HTMLToPDFUsingStream
        }
Пример #17
0
        private void PutAmount(Aspose.Pdf.Generator.Pdf pdf, float fare, float tax)
        {
            //add total amount for this invoice
            Aspose.Pdf.Generator.Color color = new Aspose.Pdf.Generator.Color(111, 146, 188);

            CultureInfo culture     = new CultureInfo("en-US");
            Table       amountTable = new Table();

            amountTable.Margin.Top                   = 20;
            amountTable.Margin.Left                  = 370;
            amountTable.ColumnWidths                 = "60 60";
            amountTable.DefaultCellBorder            = new BorderInfo((int)BorderSide.Bottom, color);
            amountTable.DefaultCellPadding.Bottom    = amountTable.DefaultCellPadding.Top = 5;
            amountTable.DefaultCellTextInfo.FontSize = 10;

            Section section = pdf.Sections[0];

            section.Paragraphs.Add(amountTable);

            Row row1AmountTable = amountTable.Rows.Add();

            Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo();
            tf1.FontSize = 10;
            tf1.Color    = color;
            tf1.FontName = "Helvetica-Bold";

            row1AmountTable.Cells.Add("Subtotal", tf1);
            row1AmountTable.Cells.Add(fare.ToString("c", culture));

            Row row2AmountTable = amountTable.Rows.Add();

            row2AmountTable.Cells.Add("Tax", tf1);
            row2AmountTable.Cells.Add(tax.ToString("c", culture));

            Row row3AmountTable = amountTable.Rows.Add();

            row3AmountTable.Cells.Add("Total", tf1);
            row3AmountTable.Cells.Add((fare + tax).ToString("c", culture));
        }
Пример #18
0
        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);
        }
 protected void btnProcess_Click(object sender, EventArgs e)
 {
     Aspose.Pdf.Generator.Pdf pdf = GetCatalog();
     pdf.Save("catalog.pdf", SaveType.OpenInAcrobat, Response);
     Response.End();
 }
Пример #20
0
 /// <summary>
 /// Creates a pdf representation for a convict and saves it to the output stream
 /// </summary>
 /// <param name="convict">The input data that is to be rendered</param>
 /// <param name="output">An output stream to hold the resulting pdf.This stream's disposal should be managed externaly</param>
 public void CreatePdf(Convict convict, Stream output)
 {
     var pdf = new Aspose.Pdf.Generator.Pdf();
     RenderConvictToPdf(convict,pdf);
     pdf.Save(output);
 }
Пример #21
0
        private void PutSummary(Aspose.Pdf.Generator.Pdf pdf, PassengerInfo passengerInfo, BookingInfo bookingInfo, FlightInfo flightInfo, bool isReturn)
        {
            //create table structure for the ticket
            Table summaryTable = new Table();

            Aspose.Pdf.Generator.Color color = new Aspose.Pdf.Generator.Color(111, 146, 188);
            summaryTable.Margin.Top   = 20;
            summaryTable.ColumnWidths = "80 80 80 80";
            summaryTable.DefaultCellTextInfo.FontSize = 10;
            summaryTable.DefaultCellPadding.Bottom    = summaryTable.DefaultCellPadding.Top = 3;
            summaryTable.Border          = new BorderInfo((int)BorderSide.Box, 0.5f, color);
            summaryTable.BackgroundColor = new Color(173, 202, 225);

            //add table to the PDF page
            Section section = pdf.Sections[0];

            section.Paragraphs.Add(summaryTable);

            //declare temporary variables
            Aspose.Pdf.Generator.TextInfo textInfo = new Aspose.Pdf.Generator.TextInfo();
            Cell tempCell;

            //add logo and barcode images
            Row row1SummaryTable = summaryTable.Rows.Add();

            textInfo = SetTextInfo("Times-Roman", 9, "Black", false);
            Cell cell1 = new Cell(row1SummaryTable);

            cell1.ColumnsSpan         = 2;
            cell1.DefaultCellTextInfo = textInfo;

            Aspose.Pdf.Generator.Image img = new Aspose.Pdf.Generator.Image();
            img.ImageInfo.File          = path + "\\FlyNowLogoOnly.jpg";
            img.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg;

            img.ImageInfo.FixWidth  = 90;
            img.ImageInfo.FixHeight = 30;

            cell1.Paragraphs.Add(img);
            row1SummaryTable.Cells.Add(cell1);

            Cell cell2 = new Cell(row1SummaryTable);

            cell2.ColumnsSpan         = 2;
            cell2.DefaultCellTextInfo = textInfo;
            cell2.Alignment           = AlignmentType.Right;

            img = new Aspose.Pdf.Generator.Image();
            if (!isReturn)
            {
                img.ImageInfo.File = path + "\\barcodeleave.jpg";
            }
            else
            {
                img.ImageInfo.File = path + "\\barcodereturn.jpg";
            }

            img.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg;
            img.ImageInfo.FixWidth      = 160;
            img.ImageInfo.FixHeight     = 30;

            cell2.Paragraphs.Add(img);
            row1SummaryTable.Cells.Add(cell2);


            Row row2SummaryTable = summaryTable.Rows.Add();

            textInfo = SetTextInfo("Times-Roman", 9, "Black", true);
            tempCell = AddTextToCell("Class:", row2SummaryTable, textInfo, true);
            row2SummaryTable.Cells.Add(tempCell);

            //cell2 = new Cell(row2SummaryTable);
            textInfo = SetTextInfo("Times-Roman", 9, "Black", false);
            tempCell = AddTextToCell("Economy", row2SummaryTable, textInfo, false);
            row2SummaryTable.Cells.Add(tempCell);

            //add emptry cells
            Cell cell3 = new Cell(row2SummaryTable);

            row2SummaryTable.Cells.Add(cell3);
            Cell cell4 = new Cell(row2SummaryTable);

            row2SummaryTable.Cells.Add(cell4);


            //add flight details
            Row row3SummaryTable = summaryTable.Rows.Add();

            textInfo = SetTextInfo("Times-Roman", 9, "Black", true);
            tempCell = AddTextToCell("Flight:  ", row3SummaryTable, textInfo, true);
            row3SummaryTable.Cells.Add(tempCell);

            textInfo = SetTextInfo("Times-Roman", 9, "Black", false);

            if (!isReturn)
            {
                tempCell = AddTextToCell(flightInfo.FlightNumberLeave, row3SummaryTable, textInfo, false);
            }
            else
            {
                tempCell = AddTextToCell(flightInfo.FlightNumberReturn, row3SummaryTable, textInfo, false);
            }

            row3SummaryTable.Cells.Add(tempCell);

            textInfo = SetTextInfo("Times-Roman", 9, "Black", true);
            tempCell = AddTextToCell("Seat Number:  ", row3SummaryTable, textInfo, true);
            row3SummaryTable.Cells.Add(tempCell);

            textInfo = SetTextInfo("Times-Roman", 9, "Black", false);
            tempCell = AddTextToCell(passengerInfo.SeatNumber, row3SummaryTable, textInfo, false);
            row3SummaryTable.Cells.Add(tempCell);

            Row row4SummaryTable = summaryTable.Rows.Add();

            textInfo = SetTextInfo("Times-Roman", 9, "Black", true);
            tempCell = AddTextToCell("From:  ", row3SummaryTable, textInfo, true);
            row4SummaryTable.Cells.Add(tempCell);

            textInfo = SetTextInfo("Times-Roman", 9, "Black", false);
            if (!isReturn)
            {
                tempCell = AddTextToCell(flightInfo.DepartureLocation, row3SummaryTable, textInfo, false);
            }
            else
            {
                tempCell = AddTextToCell(flightInfo.Destination, row3SummaryTable, textInfo, false);
            }

            row4SummaryTable.Cells.Add(tempCell);

            textInfo = SetTextInfo("Times-Roman", 9, "Black", true);
            tempCell = AddTextToCell("To:  ", row3SummaryTable, textInfo, true);
            row4SummaryTable.Cells.Add(tempCell);

            textInfo = SetTextInfo("Times-Roman", 9, "Black", false);
            if (!isReturn)
            {
                tempCell = AddTextToCell(flightInfo.Destination, row3SummaryTable, textInfo, false);
            }
            else
            {
                tempCell = AddTextToCell(flightInfo.DepartureLocation, row3SummaryTable, textInfo, false);
            }

            row4SummaryTable.Cells.Add(tempCell);


            Row row5SummaryTable = summaryTable.Rows.Add();

            textInfo = SetTextInfo("Times-Roman", 9, "Black", true);
            tempCell = AddTextToCell("Departure:", row5SummaryTable, textInfo, true);
            row5SummaryTable.Cells.Add(tempCell);

            textInfo = SetTextInfo("Times-Roman", 9, "Black", false);
            if (!isReturn)
            {
                tempCell = AddTextToCell(flightInfo.DepartureDateandTime.ToString(), row5SummaryTable, textInfo, false);
            }
            else
            {
                tempCell = AddTextToCell(flightInfo.ReturnDateandTime.ToString(), row5SummaryTable, textInfo, false);
            }

            row5SummaryTable.Cells.Add(tempCell);

            textInfo = SetTextInfo("Times-Roman", 9, "Black", true);
            tempCell = AddTextToCell("Arrival:", row5SummaryTable, textInfo, true);
            row5SummaryTable.Cells.Add(tempCell);

            textInfo = SetTextInfo("Times-Roman", 9, "Black", false);
            if (!isReturn)
            {
                tempCell = AddTextToCell(flightInfo.ArrivalDateandTimeDest.ToString(), row5SummaryTable, textInfo, false);
            }
            else
            {
                tempCell = AddTextToCell(flightInfo.ArrivalDateandTimeBack.ToString(), row5SummaryTable, textInfo, false);
            }

            row5SummaryTable.Cells.Add(tempCell);
        }
        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);
        }
Пример #23
0
        public static void Run()
        {
            // ExStart:AddTableOfContents
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_UtilityFeatures();

            // Create a PDF instance
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
            // Create a list section
            Aspose.Pdf.Generator.ListSection tocSection = new Aspose.Pdf.Generator.ListSection("Table Of Contents");
            // Set its list type as table of contents
            tocSection.ListType = ListType.TableOfContents;
            // Add the list section to the sections collection of the Pdf document
            pdf.Sections.Add(tocSection);

            // Define the format of the four levels list by setting the left margins and
            // Text format settings of each level
            tocSection.ListFormatArray.Length        = 4;
            tocSection.ListFormatArray[0].LeftMargin = 0;
            tocSection.ListFormatArray[0].TextInfo.IsTrueTypeFontBold   = true;
            tocSection.ListFormatArray[0].TextInfo.IsTrueTypeFontItalic = true;
            tocSection.ListFormatArray[1].LeftMargin                  = 10;
            tocSection.ListFormatArray[1].TextInfo.IsUnderline        = true;
            tocSection.ListFormatArray[1].TextInfo.FontSize           = 10;
            tocSection.ListFormatArray[2].LeftMargin                  = 20;
            tocSection.ListFormatArray[2].TextInfo.IsTrueTypeFontBold = true;
            tocSection.ListFormatArray[3].LeftMargin                  = 30;
            tocSection.ListFormatArray[3].TextInfo.IsTrueTypeFontBold = true;

            // Create a section in the Pdf document
            Aspose.Pdf.Generator.Section sec1 = pdf.Sections.Add();

            // Add four headings in the section
            for (int Level = 1; Level < 5; Level++)
            {
                Aspose.Pdf.Generator.Heading heading1 = new Aspose.Pdf.Generator.Heading(pdf, sec1, Level);
                Segment segment1 = new Segment(heading1);
                heading1.Segments.Add(segment1);
                heading1.IsAutoSequence = true;
                segment1.Content        = "this is heading of level ";
                segment1.Content       += Level.ToString();

                // Add the heading into Table Of Contents.
                heading1.IsInList = true;
                // Heading2.TOC = tocSection;
                sec1.Paragraphs.Add(heading1);
            }

            // Create a list section
            ListSection tocSection2 = new ListSection("Second Table Of Contents");

            // Set its list type as table of of contents
            tocSection2.ListType = ListType.TableOfContents;
            // Add the list section to the sections collection of the Pdf document
            pdf.Sections.Add(tocSection2);

            // Define the format of the four levels list by setting the left margins and
            // Text format settings of each level
            tocSection2.ListFormatArray.Length        = 4;
            tocSection2.ListFormatArray[0].LeftMargin = 0;
            tocSection2.ListFormatArray[0].TextInfo.IsTrueTypeFontBold   = true;
            tocSection2.ListFormatArray[0].TextInfo.IsTrueTypeFontItalic = true;
            tocSection2.ListFormatArray[1].LeftMargin                  = 10;
            tocSection2.ListFormatArray[1].TextInfo.IsUnderline        = true;
            tocSection2.ListFormatArray[1].TextInfo.FontSize           = 10;
            tocSection2.ListFormatArray[2].LeftMargin                  = 20;
            tocSection2.ListFormatArray[2].TextInfo.IsTrueTypeFontBold = true;
            tocSection2.ListFormatArray[3].LeftMargin                  = 30;
            tocSection2.ListFormatArray[3].TextInfo.IsTrueTypeFontBold = true;

            // Create a section in the Pdf document
            Aspose.Pdf.Generator.Section sec2 = pdf.Sections.Add();

            // Add four headings in the section
            for (int Level = 1; Level < 5; Level++)
            {
                Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf, sec1, Level);
                Segment segment2 = new Segment(heading2);
                heading2.Segments.Add(segment2);
                heading2.IsAutoSequence = true;
                segment2.Content        = "this is heading of level ";
                segment2.Content       += Level.ToString();

                // Add the heading into Table Of Contents.
                heading2.IsInList = true;
                // Add the heading elements to second ListSection
                heading2.TOC = tocSection2;
                // Add the heading obejct to paragraphs colelction of section2
                sec2.Paragraphs.Add(heading2);
            }

            dataDir = dataDir + "Multiple_TOC_out.pdf";
            // Save the resultant PDF document
            pdf.Save(dataDir);
            // ExEnd:AddTableOfContents
        }
        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);
        }
 protected void btnProcess_Click(object sender, EventArgs e)
 {
     Aspose.Pdf.Generator.Pdf pdf = GetCustomerLabels();
     pdf.Save("customerlabels.pdf", SaveType.OpenInAcrobat, Response);
     Response.End();
 }
        public static void Run()
        {
            // ExStart:AddTableOfContents
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_UtilityFeatures();

            // Create a PDF instance
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
            // Create a list section 
            Aspose.Pdf.Generator.ListSection tocSection = new Aspose.Pdf.Generator.ListSection("Table Of Contents");
            // Set its list type as table of contents
            tocSection.ListType = ListType.TableOfContents;
            // Add the list section to the sections collection of the Pdf document
            pdf.Sections.Add(tocSection);

            // Define the format of the four levels list by setting the left margins and
            // Text format settings of each level
            tocSection.ListFormatArray.Length = 4;
            tocSection.ListFormatArray[0].LeftMargin = 0;
            tocSection.ListFormatArray[0].TextInfo.IsTrueTypeFontBold = true;
            tocSection.ListFormatArray[0].TextInfo.IsTrueTypeFontItalic = true;
            tocSection.ListFormatArray[1].LeftMargin = 10;
            tocSection.ListFormatArray[1].TextInfo.IsUnderline = true;
            tocSection.ListFormatArray[1].TextInfo.FontSize = 10;
            tocSection.ListFormatArray[2].LeftMargin = 20;
            tocSection.ListFormatArray[2].TextInfo.IsTrueTypeFontBold = true;
            tocSection.ListFormatArray[3].LeftMargin = 30;
            tocSection.ListFormatArray[3].TextInfo.IsTrueTypeFontBold = true;

            // Create a section in the Pdf document
            Aspose.Pdf.Generator.Section sec1 = pdf.Sections.Add();

            // Add four headings in the section
            for (int Level = 1; Level < 5; Level++)
            {
                Aspose.Pdf.Generator.Heading heading1 = new Aspose.Pdf.Generator.Heading(pdf, sec1, Level);
                Segment segment1 = new Segment(heading1);
                heading1.Segments.Add(segment1);
                heading1.IsAutoSequence = true;
                segment1.Content = "this is heading of level ";
                segment1.Content += Level.ToString();

                // Add the heading into Table Of Contents. 
                heading1.IsInList = true;
                // Heading2.TOC = tocSection;
                sec1.Paragraphs.Add(heading1);
            }

            // Create a list section 
            ListSection tocSection2 = new ListSection("Second Table Of Contents");
            // Set its list type as table of of contents
            tocSection2.ListType = ListType.TableOfContents;
            // Add the list section to the sections collection of the Pdf document
            pdf.Sections.Add(tocSection2);

            // Define the format of the four levels list by setting the left margins and
            // Text format settings of each level
            tocSection2.ListFormatArray.Length = 4;
            tocSection2.ListFormatArray[0].LeftMargin = 0;
            tocSection2.ListFormatArray[0].TextInfo.IsTrueTypeFontBold = true;
            tocSection2.ListFormatArray[0].TextInfo.IsTrueTypeFontItalic = true;
            tocSection2.ListFormatArray[1].LeftMargin = 10;
            tocSection2.ListFormatArray[1].TextInfo.IsUnderline = true;
            tocSection2.ListFormatArray[1].TextInfo.FontSize = 10;
            tocSection2.ListFormatArray[2].LeftMargin = 20;
            tocSection2.ListFormatArray[2].TextInfo.IsTrueTypeFontBold = true;
            tocSection2.ListFormatArray[3].LeftMargin = 30;
            tocSection2.ListFormatArray[3].TextInfo.IsTrueTypeFontBold = true;

            // Create a section in the Pdf document
            Aspose.Pdf.Generator.Section sec2 = pdf.Sections.Add();

            // Add four headings in the section
            for (int Level = 1; Level < 5; Level++)
            {
                Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf, sec1, Level);
                Segment segment2 = new Segment(heading2);
                heading2.Segments.Add(segment2);
                heading2.IsAutoSequence = true;
                segment2.Content = "this is heading of level ";
                segment2.Content += Level.ToString();

                // Add the heading into Table Of Contents. 
                heading2.IsInList = true;
                // Add the heading elements to second ListSection
                heading2.TOC = tocSection2;
                // Add the heading obejct to paragraphs colelction of section2
                sec2.Paragraphs.Add(heading2);
            }     
           
            dataDir = dataDir + "Multiple_TOC_out.pdf";
            // Save the resultant PDF document
            pdf.Save(dataDir);
            // ExEnd:AddTableOfContents           
        }        
 protected void btnProcess_Click(object sender, EventArgs e)
 {
     Aspose.Pdf.Generator.Pdf pdf = GetProductsByCategory();
     pdf.Save("productsbycategory.pdf", SaveType.OpenInAcrobat, Response);
     Response.End();
 }
Пример #28
0
        private void PutSummary(Aspose.Pdf.Generator.Pdf pdf, PassengerInfo passengerInfo, FlightInfo flightInfo)
        {
            //create a  table to hold summary of the order
            Table summaryTable = new Table();

            Aspose.Pdf.Generator.Color color = new Aspose.Pdf.Generator.Color(111, 146, 188);
            summaryTable.Margin.Top   = 20;
            summaryTable.ColumnWidths = "60 80 80 80 80 80";
            summaryTable.DefaultCellTextInfo.FontSize = 10;
            summaryTable.DefaultCellBorder            = new BorderInfo((int)BorderSide.All, color);
            summaryTable.DefaultCellPadding.Bottom    = summaryTable.DefaultCellPadding.Top = 3;
            //add table to the first section/page
            Section section = pdf.Sections[0];

            section.Paragraphs.Add(summaryTable);
            //create row and add cells and contents
            Row row1SummaryTable = summaryTable.Rows.Add();

            Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo();
            tf1.FontSize  = 10;
            tf1.Color     = new Aspose.Pdf.Generator.Color("White");
            tf1.FontName  = "Helvetica-Bold";
            tf1.Alignment = AlignmentType.Center;
            Cell cell1Row1SummaryTable = row1SummaryTable.Cells.Add("Order ID", tf1);

            cell1Row1SummaryTable.BackgroundColor = color;

            Cell cell2Row1SummaryTable = row1SummaryTable.Cells.Add("Customer ID", tf1);

            cell2Row1SummaryTable.BackgroundColor = color;

            Cell cell3Row1SummaryTable = row1SummaryTable.Cells.Add("Agent ID", tf1);

            cell3Row1SummaryTable.BackgroundColor = color;

            Cell cell4Row1SummaryTable = row1SummaryTable.Cells.Add("Sales Person", tf1);

            cell4Row1SummaryTable.BackgroundColor = color;

            Cell cell5Row1SummaryTable = row1SummaryTable.Cells.Add("Required Date", tf1);

            cell5Row1SummaryTable.BackgroundColor = color;

            Cell cell6Row1SummaryTable = row1SummaryTable.Cells.Add("Shipped Date", tf1);

            cell6Row1SummaryTable.BackgroundColor = color;


            Row row2SummaryTable = summaryTable.Rows.Add();

            tf1           = new Aspose.Pdf.Generator.TextInfo();
            tf1.FontSize  = 9;
            tf1.Color     = new Aspose.Pdf.Generator.Color("Black");
            tf1.FontName  = "Times-Roman";
            tf1.Alignment = AlignmentType.Center;

            row2SummaryTable.Cells.Add("90234", tf1);
            row2SummaryTable.Cells.Add("3762", tf1);
            row2SummaryTable.Cells.Add("AU89", tf1);
            row2SummaryTable.Cells.Add("James Smith", tf1);
            row2SummaryTable.Cells.Add(DateTime.Now.Date.ToString(), tf1);
            row2SummaryTable.Cells.Add(DateTime.Now.Date.ToString(), tf1);
        }
Пример #29
0
 /// <summary>
 /// // generate pdf with using html text and replace with required fields in mailMerge document
 /// </summary>
 /// <param name="bodyText"></param>
 private void GeneratePdf(string bodyText)
 {
     dt = (DataTable)Session["CsvDataTable"];
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         bodyText = bodyText.Replace("Contact Person Name", dt.Rows[i][0].ToString());
         FilePath = Server.MapPath("~/uploads");
         Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
         Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
         Text title = new Text(bodyText);
         var info = new TextInfo();
         info.FontSize = 12;
         //info.IsTrueTypeFontBold = true;
         title.TextInfo = info;
         title.IsHtmlTagSupported = true;
         sec1.Paragraphs.Add(title);
         pdf1.Save(FilePath + "\\pdf\\" + dt.Rows[i][0].ToString() + ".pdf");
         bodyText = mailMergeHtml.Text;
     }
 }