/* private void PrintReportHeader(PdfPTable table, Image gif, int columns)
         * {
         *   PdfPTable images = new PdfPTable(1);
         *   PdfPTable headerDetails = new PdfPTable(1);
         *
         *   Image barcodeGif = getBarCodeImage();
         *   PdfPCell subCell = new PdfPCell(gif);
         *   subCell.Border = Rectangle.NO_BORDER;
         *   images.AddCell(new PdfPCell(subCell));
         *
         *   subCell = new PdfPCell(barcodeGif);
         *   subCell.Border = Rectangle.NO_BORDER;
         *   images.AddCell(new PdfPCell(subCell));
         *
         *   //  Heading - Row 1
         *   PdfPCell cell = new PdfPCell(images);
         *   cell.Border = Rectangle.NO_BORDER;
         *   cell.HorizontalAlignment = Element.ALIGN_LEFT;
         *   cell.VerticalAlignment = Element.ALIGN_TOP;
         *   cell.PaddingLeft = -10;
         *   cell.Colspan = 4;
         *   table.AddCell(cell);
         *
         *   subCell = new PdfPCell(new PdfPCell(new Paragraph("Date: " + _shopDT.ToShortDateString())));
         *   subCell.Border = Rectangle.NO_BORDER;
         *   headerDetails.AddCell(subCell);
         *   subCell = new PdfPCell(new PdfPCell(new Paragraph("From: " + _storeName +  "#" + _storeNumber)));
         *   subCell.Border = Rectangle.NO_BORDER;
         *   headerDetails.AddCell(subCell);
         *   subCell = new PdfPCell(new PdfPCell(new Paragraph("Destination: CATCO")));
         *   subCell.Border = Rectangle.NO_BORDER;
         *   headerDetails.AddCell(subCell);
         *   subCell = new PdfPCell(new PdfPCell(new Paragraph("Employee: " + _userName)));
         *   subCell.Border = Rectangle.NO_BORDER;
         *   headerDetails.AddCell(subCell);
         *
         *   cell = new PdfPCell(headerDetails);
         *   cell.Border = Rectangle.NO_BORDER;
         *   cell.HorizontalAlignment = Element.ALIGN_LEFT;
         *   cell.VerticalAlignment = Element.ALIGN_TOP;
         *   cell.Colspan = 2;
         *   table.AddCell(cell);
         *
         *   // heading - Row 2
         *   cell = new PdfPCell(new Paragraph(_reportTitle, _reportFontLargeBold));
         *   cell.Border = Rectangle.NO_BORDER;
         *   cell.HorizontalAlignment = Element.ALIGN_CENTER;
         *   cell.VerticalAlignment = Element.ALIGN_TOP;
         *   cell.Padding = 20f;
         *   cell.Colspan = columns;
         *   table.AddCell(cell);
         *
         *   // Heading - Row 3
         *   cell = new PdfPCell(new Paragraph("Transfer #" + _transferNumber));
         *   cell.Border = Rectangle.NO_BORDER;
         *   cell.HorizontalAlignment = Element.ALIGN_LEFT;
         *   cell.VerticalAlignment = Element.ALIGN_TOP;
         *   cell.Padding = 20f;
         *   cell.Colspan = columns;
         *   table.AddCell(cell);
         *
         *   _document.Add(table);
         * }*/

        private Image getBarCodeImage()
        {
            System.Drawing.Image barcodeImage = Barcode.DoEncode(EncodingType.CODE128C, _transferNumber);
            Image barcodeGif = Image.GetInstance(barcodeImage, BaseColor.WHITE);

            barcodeGif.ScaleAbsoluteHeight(35);
            barcodeGif.ScaleAbsoluteWidth(200);
            return(barcodeGif);
        }
Пример #2
0
        private void PrintReportHeader(PdfPTable table, Image gif, int columns)
        {
            PdfPTable images        = new PdfPTable(1);
            PdfPTable headerDetails = new PdfPTable(1);

            var   barcodeImage = Barcode.DoEncode(EncodingType.CODE128C, _transferNumber);
            Image barcodeGif   = Image.GetInstance(barcodeImage, BaseColor.WHITE);

            barcodeGif.ScaleAbsoluteHeight(35);
            barcodeGif.ScaleAbsoluteWidth(200);

            PdfPCell subCell = new PdfPCell(gif);

            subCell.Border = Rectangle.NO_BORDER;
            images.AddCell(new PdfPCell(subCell));

            subCell        = new PdfPCell(barcodeGif);
            subCell.Border = Rectangle.NO_BORDER;
            images.AddCell(new PdfPCell(subCell));

            //  Heading - Row 1
            PdfPCell cell = new PdfPCell(images);

            cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            cell.PaddingLeft         = -10;
            cell.Colspan             = 4;
            table.AddCell(cell);

            subCell        = new PdfPCell(new PdfPCell(new Paragraph("Date: " + _shopDT.ToShortDateString(), _reportFont)));
            subCell.Border = Rectangle.NO_BORDER;
            headerDetails.AddCell(subCell);
            subCell        = new PdfPCell(new PdfPCell(new Paragraph("From: " + _storeName + "#" + _storeNumber, _reportFont)));
            subCell.Border = Rectangle.NO_BORDER;
            headerDetails.AddCell(subCell);
            subCell        = new PdfPCell(new PdfPCell(new Paragraph("Destination: CATCO", _reportFont)));
            subCell.Border = Rectangle.NO_BORDER;
            headerDetails.AddCell(subCell);
            subCell        = new PdfPCell(new PdfPCell(new Paragraph("Employee ID#: " + _userName, _reportFont)));
            subCell.Border = Rectangle.NO_BORDER;
            headerDetails.AddCell(subCell);

            cell        = new PdfPCell(headerDetails);
            cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            cell.Colspan             = 2;
            table.AddCell(cell);

            // heading - Row 2
            cell        = new PdfPCell(new Paragraph("Transfer Out Report", _reportFontLargeBold));
            cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            cell.Padding             = 20f;
            cell.Colspan             = columns;
            table.AddCell(cell);

            // Heading - Row 3
            cell        = new PdfPCell(new Paragraph("Transfer #" + _transferNumber, _reportFont));
            cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            cell.Padding             = 20f;
            cell.Colspan             = columns;
            table.AddCell(cell);

            _document.Add(table);
        }