Beispiel #1
0
        public void WriteIdentificationHeader(string fileName, string masterAccession, string reportNo)
        {
            Image         image      = Image.FromFile(fileName);
            int           pageCount  = image.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page);
            List <Bitmap> bitmapList = new List <Bitmap>();

            for (int i = 0; i < pageCount; i++)
            {
                image.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, i);
                MemoryStream byteStream = new MemoryStream();
                image.Save(byteStream, System.Drawing.Imaging.ImageFormat.Bmp);

                Bitmap newBitmap = new Bitmap(Image.FromStream(byteStream));
                System.Drawing.Graphics graphicImage = System.Drawing.Graphics.FromImage(newBitmap);
                graphicImage.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

                Rectangle rectangle = new Rectangle(5, 5, 325, 100);
                graphicImage.FillRectangle(System.Drawing.Brushes.White, rectangle);
                graphicImage.DrawRectangle(new System.Drawing.Pen(System.Drawing.Color.Black, 1), rectangle);
                graphicImage.DrawString("MAN" + masterAccession, new System.Drawing.Font("OCRAMCE", 20, System.Drawing.FontStyle.Regular), System.Drawing.Brushes.Black, new System.Drawing.PointF(30, 25));
                graphicImage.DrawString("RPT" + reportNo, new System.Drawing.Font("OCRAMCE", 20, System.Drawing.FontStyle.Regular), System.Drawing.Brushes.Black, new System.Drawing.PointF(30, 60));
                bitmapList.Add(newBitmap);
            }

            image.Dispose();

            YellowstonePathology.Business.TifDocument tifDocument = new TifDocument();
            tifDocument.FileName = fileName;
            tifDocument.Create(bitmapList);
        }
Beispiel #2
0
        public void WriteIdentificationHeader(string fileName, string masterAccession, string reportNo)
        {
            Image image = Image.FromFile(fileName);
            int pageCount = image.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page);
            List<Bitmap> bitmapList = new List<Bitmap>();

            for (int i = 0; i < pageCount; i++)
            {
                image.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, i);
                MemoryStream byteStream = new MemoryStream();
                image.Save(byteStream, System.Drawing.Imaging.ImageFormat.Bmp);

                Bitmap newBitmap = new Bitmap(Image.FromStream(byteStream));
                System.Drawing.Graphics graphicImage = System.Drawing.Graphics.FromImage(newBitmap);
                graphicImage.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

                Rectangle rectangle = new Rectangle(5, 5, 325, 100);
                graphicImage.FillRectangle(System.Drawing.Brushes.White, rectangle);
                graphicImage.DrawRectangle(new System.Drawing.Pen(System.Drawing.Color.Black, 1), rectangle);
                graphicImage.DrawString("MAN" + masterAccession, new System.Drawing.Font("OCRAMCE", 20, System.Drawing.FontStyle.Regular), System.Drawing.Brushes.Black, new System.Drawing.PointF(30, 25));
                graphicImage.DrawString("RPT" + reportNo, new System.Drawing.Font("OCRAMCE", 20, System.Drawing.FontStyle.Regular), System.Drawing.Brushes.Black, new System.Drawing.PointF(30, 60));
                bitmapList.Add(newBitmap);
            }

            image.Dispose();

            YellowstonePathology.Business.TifDocument tifDocument = new TifDocument();
            tifDocument.FileName = fileName;
            tifDocument.Create(bitmapList);
        }