예제 #1
0
        // initialization
        private void OnLoad(object sender, EventArgs e)
        {
            ViewStreamButton.Enabled   = false;
            ViewContentsButton.Enabled = false;
            RotateRightButton.Enabled  = false;
            RotateLeftButton.Enabled   = false;
            TextDisplayButton.Enabled  = false;
            HexDisplayButton.Enabled   = false;
            switch (Mode)
            {
            case DisplayMode.PdfSummary:
                Text                     = string.Format("PDF File {0} Summary", SafeFileName);
                DisplayString            = Reports.PdfFileSummary(Reader);
                DisplayBox.Text          = DisplayString;
                HexDisplayButton.Enabled = ByteArray != null;
                break;

            case DisplayMode.ObjectSummary:
                Text                     = string.Format("Object No {0} Summary", ReaderObject.ObjectNumber);
                DisplayString            = Reports.ObjectSummary(ReaderObject);
                DisplayBox.Text          = DisplayString;
                HexDisplayButton.Enabled = ByteArray != null;
                if (ReaderObject.ObjectType == ObjectType.Stream || ReaderObject.PdfObjectType == "/Page")
                {
                    ViewStreamButton.Enabled   = true;
                    ViewContentsButton.Enabled = true;
                }
                break;

            case DisplayMode.Stream:
                Text                     = string.Format("Object No. {0} Stream", ReaderObject.ObjectNumber);
                DisplayString            = Reports.ByteArrayToString(ByteArray);
                DisplayBox.Text          = DisplayString;
                HexDisplayButton.Enabled = true;
                break;

            case DisplayMode.Contents:
                Text                     = string.Format("Object No. {0} Contents", ReaderObject.ObjectNumber);
                DisplayString            = Reports.ByteArrayToString(ByteArray);
                DisplayBox.Text          = DisplayString;
                HexDisplayButton.Enabled = true;
                break;

            case DisplayMode.Image:
                Image = new Bitmap(new MemoryStream(ByteArray));
                DisplayBox.Visible = false;
                ImageMode          = true;
                OnResize(this, null);
                RotateRightButton.Enabled = true;
                RotateLeftButton.Enabled  = true;
                HexDisplayButton.Enabled  = true;
                TextDisplayButton.Text    = "Image";
                break;
            }

            // load to display box
            DisplayBox.Select(0, 0);
            DisplayBox.BackColor = Color.White;
            DisplayBox.ForeColor = Color.Black;
            DisplayBox.ReadOnly  = true;
            OnResize(this, null);
            if (Mode == DisplayMode.Stream)
            {
                Rectangle Rect = Bounds;
                Rect.X += 16;
                Rect.Y += 32;
                Bounds  = Rect;
            }
            return;
        }