protected void CreatePicture()
 {
     int width = (((int)this.Width.Value) * this.resolutiondpi) / 0x60;
     int height = (((int)this.Height.Value) * this.resolutiondpi) / 0x60;
     string encodebinarystr = "";
     string str = this.text;
     string checkStr = "";
     if (this.barType == BarType.PDF417)
     {
         str = this.text;
     }
     if (this.barType == BarType.PDF417)
     {
         encodebinarystr = this.GetPDF417Str(0x60, str);
     }
     else if (this.barType == BarType.DataMatrix)
     {
         encodebinarystr = this.GetDataMatrixStr(str);
     }
     else if (this.barType < BarType.PDF417)
     {
         LinearEncoder encoder = new LinearEncoder();
         encoder.narrowratio = this.ratio;
         if (((this.barType != BarType.Code39) && (this.barType != BarType.Code25)) && ((this.barType != BarType.I25) && (this.barType != BarType.Codabar)))
         {
             this.addcheckdigit = true;
         }
         string demoStr = null;
         string drawText = null;
         encodebinarystr = encoder.Encoding((int)this.barType, ref str, this.addcheckdigit, out checkStr, out demoStr, out drawText);
     }
     this.picture = new Bitmap(width, height);
     this.picture.SetResolution((float)this.resolutiondpi, (float)this.resolutiondpi);
     Graphics g = Graphics.FromImage(this.picture);
     if (this.barType == BarType.PDF417)
     {
         PDF417Image image = new PDF417Image();
         this.InitPDF417Img(ref this.picture, ref image, encodebinarystr, this.resolutiondpi, width, height);
         image.DrawPDF417(ref g);
     }
     else if (this.barType == BarType.DataMatrix)
     {
         DataMatrixImage datamatriximg = new DataMatrixImage();
         this.InitDataMatrixImg(ref this.picture, ref datamatriximg, encodebinarystr, this.resolutiondpi, width, height);
         datamatriximg.DrawDataMatrix(ref g);
     }
     else if (this.barType < BarType.PDF417)
     {
         LinearImage image3 = new LinearImage();
         this.InitLinearImg(ref this.picture, ref image3, checkStr, str, encodebinarystr, this.resolutiondpi, width, height);
         image3.DrawLinear(ref g);
     }
     g.Dispose();
 }
 private Bitmap GetPDF417Bitmap()
 {
     PDF417Image image = new PDF417Image();
     image.backcolor = this.backcolor;
     image.forecolor = this.forecolor;
     image.txtFont = new Font(this.fontname, (float) this.fontsize);
     image.moduleheight = this.moduleheight;
     image.modulewidth = this.modulewidth;
     image.symbolheight = this.symbolheight;
     image.symbolwidth = this.symbolwidth;
     image.bottomcomment = this.bottomcomment;
     image.bottomcommentbottommargin = this.bottomcommentbottommargin;
     image.bottomcommentleftmargin = this.bottomcommentleftmargin;
     image.leftmargin = this.leftmargin;
     image.topmargin = this.topmargin;
     image.topcomment = this.topcomment;
     image.topcommentleftmargin = this.topcommentleftmargin;
     image.topcommenttopmargin = this.topcommenttopmargin;
     image.encodebinarystr = this.GetPDF417Str();
     Bitmap bitmap = new Bitmap(this.symbolwidth, this.symbolheight);
     Graphics g = Graphics.FromImage(bitmap);
     image.DrawPDF417(ref g);
     g.Dispose();
     return bitmap;
 }
        private void InitPDF417Img(ref Bitmap outputBitmap, ref PDF417Image pdf417img, string encodebinarystr, int resolutiondpi, int width, int height)
        {
            pdf417img.encodebinarystr = encodebinarystr;
            pdf417img.backcolor = this.BackColor;
            pdf417img.forecolor = this.ForeColor;


            FontStyle style = FontStyle.Regular;
            style |= this.Font.Bold ? FontStyle.Bold : 0;
            style |= this.Font.Italic ? FontStyle.Italic : 0;
            style |= this.Font.Strikeout ? FontStyle.Strikeout : 0;
            style |= this.Font.Underline ? FontStyle.Underline : 0;
            pdf417img.txtFont = new Font(this.Font.Name, (float)this.Font.Size.Unit.Value, style);


            pdf417img.bottomcomment = this.bottomcomment;
            pdf417img.topcomment = this.topcomment;
            pdf417img.moduleheight = (int)Math.Round((double)(((this.moduleheight * resolutiondpi) * 1) / 1000));
            pdf417img.modulewidth = (int)Math.Round((double)(((this.modulewidth * resolutiondpi) * 1) / 1000));
            pdf417img.symbolheight = (((int)this.Height.Value) * resolutiondpi) / 0x60;
            pdf417img.symbolwidth = (((int)this.Width.Value) * resolutiondpi) / 0x60;
            pdf417img.bottomcommentbottommargin = (int)Math.Round((double)((this.bottomcommentbottommargin * resolutiondpi) / 1000));
            pdf417img.bottomcommentleftmargin = (int)Math.Round((double)((this.bottomcommentleftmargin * resolutiondpi) / 10000));
            pdf417img.leftmargin = (int)Math.Round((double)((this.leftmargin * resolutiondpi) / 1000));
            pdf417img.topmargin = (int)Math.Round((double)((this.topmargin * resolutiondpi) / 1000));
            pdf417img.topcommentleftmargin = (int)Math.Round((double)((this.topcommentleftmargin * resolutiondpi) / 1000));
            pdf417img.topcommenttopmargin = (int)Math.Round((double)((this.topcommenttopmargin * resolutiondpi) / 1000));
            switch (this.rotation)
            {
                case Rotation.Clockwise_Zero_Degree:
                    break;

                case Rotation.Clockwise_90_Degree:
                    outputBitmap.RotateFlip(RotateFlipType.Rotate90FlipNone);
                    return;

                case Rotation.Clockwise_180_Degree:
                    outputBitmap.RotateFlip(RotateFlipType.Rotate180FlipNone);
                    return;

                case Rotation.Clockwise_270_Degree:
                    outputBitmap.RotateFlip(RotateFlipType.Rotate270FlipNone);
                    break;

                default:
                    return;
            }
        }