Example #1
0
        private void informationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PdfInformation info = pdfViewer1.Document.GetInformation();
            StringBuilder sz = new StringBuilder();
            sz.AppendLine($"Author: {info.Author}");
            sz.AppendLine($"Creator: {info.Creator}");
            sz.AppendLine($"Keywords: {info.Keywords}");
            sz.AppendLine($"Producer: {info.Producer}");
            sz.AppendLine($"Subject: {info.Subject}");
            sz.AppendLine($"Title: {info.Title}");
            sz.AppendLine($"Create Date: {info.CreationDate}");
            sz.AppendLine($"Modified Date: {info.ModificationDate}");

            MessageBox.Show(sz.ToString(), "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        private void AddSpecificationTable(Document doc, PdfInformation result)
        {
            doc.Add(Chunk.NEWLINE);
            PdfPTable table  = new PdfPTable(5);
            PdfPCell  header = new PdfPCell(new Phrase("Specification List "));

            header.Colspan             = 5;
            header.HorizontalAlignment = 0;
            header.BackgroundColor     = new Color(173, 216, 230);
            table.AddCell(header);

            float[] widths = new float[] { 50f, 150f, 90f, 90f, 200f };
            table.SetWidths(widths);

            PdfPCell h1 = new PdfPCell(new Phrase("Item "));

            h1.BackgroundColor = new Color(225, 240, 245);

            PdfPCell h2 = new PdfPCell(new Phrase("Product "));

            h2.BackgroundColor = new Color(225, 240, 245);

            PdfPCell h3 = new PdfPCell(new Phrase("Frequency "));

            h3.BackgroundColor = new Color(225, 240, 245);

            PdfPCell h4 = new PdfPCell(new Phrase("Impedence "));

            h4.BackgroundColor = new Color(225, 240, 245);

            PdfPCell h5 = new PdfPCell(new Phrase("Product details "));

            h5.BackgroundColor = new Color(225, 240, 245);

            Cable              cable = db.Cables.Where(x => x.Id == result.CableId).SingleOrDefault();
            LeftConnectorType  lct   = db.LeftConnectorTypes.Where(x => x.Id == result.LeftConnectorTypeId).SingleOrDefault();
            RightConnectorType rct   = db.RightConnectorTypes.Where(x => x.Id == result.RightConnectorTypeId).SingleOrDefault();

            table.AddCell(h1);
            table.AddCell(h2);
            table.AddCell(h3);
            table.AddCell(h4);
            table.AddCell(h5);

            table.AddCell("1");
            table.AddCell("Cable");
            table.AddCell(cable.OperationFreq);
            table.AddCell(cable.Impediments);
            table.AddCell(cable.ProductDetails);

            table.AddCell("2");
            table.AddCell("Connector Type Left");
            table.AddCell(lct.InterfaceFreq);
            table.AddCell(lct.Impediment);
            table.AddCell(lct.ProductDetails);


            table.AddCell("3");
            table.AddCell("Connector Type Right");
            table.AddCell(rct.InterfaceFreq);
            table.AddCell(rct.Impediment);
            table.AddCell(rct.ProductDetails);

            doc.Add(table);
        }
        private void AddPartsListTable(Document doc, PdfInformation result)
        {
            doc.Add(Chunk.NEWLINE);
            PdfPTable table  = new PdfPTable(5);
            PdfPCell  header = new PdfPCell(new Phrase("Parts List "));

            header.Colspan             = 5;
            header.HorizontalAlignment = 0;
            header.BackgroundColor     = new Color(173, 216, 230);
            table.AddCell(header);

            float[] widths = new float[] { 50f, 130f, 70f, 180f, 150f };
            table.SetWidths(widths);

            PdfPCell h1 = new PdfPCell(new Phrase("Item "));

            h1.BackgroundColor = new Color(225, 240, 245);

            PdfPCell h2 = new PdfPCell(new Phrase("Product "));

            h2.BackgroundColor = new Color(225, 240, 245);

            PdfPCell h3 = new PdfPCell(new Phrase("Quantity "));

            h3.BackgroundColor = new Color(225, 240, 245);

            PdfPCell h4 = new PdfPCell(new Phrase("Description "));

            h4.BackgroundColor = new Color(225, 240, 245);

            PdfPCell h5 = new PdfPCell(new Phrase("Huber + Suhner Type "));

            h5.BackgroundColor = new Color(225, 240, 245);

            Cable              cable = db.Cables.Where(x => x.Id == result.CableId).SingleOrDefault();
            LeftConnectorType  lct   = db.LeftConnectorTypes.Where(x => x.Id == result.LeftConnectorTypeId).SingleOrDefault();
            RightConnectorType rct   = db.RightConnectorTypes.Where(x => x.Id == result.RightConnectorTypeId).SingleOrDefault();

            table.AddCell(h1);
            table.AddCell(h2);
            table.AddCell(h3);
            table.AddCell(h4);
            table.AddCell(h5);

            table.AddCell("1");
            table.AddCell("Cable");
            table.AddCell(result.Length + " " + result.Unit);
            table.AddCell(cable.Description);
            table.AddCell(cable.Type);

            table.AddCell("2");
            table.AddCell("Connector Type Left");
            table.AddCell(" 1 Pce ");
            table.AddCell("Straight Plug");
            table.AddCell(lct.Type);


            table.AddCell("3");
            table.AddCell("Connector Type Right");
            table.AddCell(" 1 Pce ");
            table.AddCell("Straight Plug");
            table.AddCell(rct.Type);

            doc.Add(table);
        }