Beispiel #1
0
 /* ----------------------------------------------------------------- */
 /// Constructor
 /* ----------------------------------------------------------------- */
 public UserSetting()
 {
     var registry = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(REG_ROOT);
     navi_ = (NavigationCondition)registry.GetValue(REG_NAVIGATION, NavigationCondition.Thumbnail);
     fit_ = (FitCondition)registry.GetValue(REG_FIT, FitCondition.Height);
     pos_.X = (int)registry.GetValue(REG_X, 30);
     pos_.Y = (int)registry.GetValue(REG_Y, 30);
     size_.Width = (int)registry.GetValue(REG_WIDTH, 0);
     size_.Height = (int)registry.GetValue(REG_HEIGHT, 0);
     thumb_width_ = (int)registry.GetValue(REG_THUMBWIDTH, 0);
     menu_ = ((int)registry.GetValue(REG_MENU, 1) != 0);
     adobe_ = ((int)registry.GetValue(REG_ADOBE, 1) != 0);
 }
        /* ----------------------------------------------------------------- */
        ///
        /// Open
        ///
        /// <summary>
        /// 指定された PDF ファイルを開いて,最初のページを描画する.
        /// MEMO: パスの記憶場所を検討中.現在は,Parent.Tag を利用
        /// している.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        public static void Open(Canvas canvas, string path, string password, FitCondition which)
        {
            if (canvas == null)
            {
                return;
            }
            var engine = canvas.Tag as CanvasEngine;

            if (engine != null)
            {
                CanvasPolicy.Close(canvas);
            }

            var core = new PDF();

            engine             = new CanvasEngine(core);
            canvas.Tag         = engine;
            core.UseMuPDF      = true;
            core.UserPassword  = password;
            core.OwnerPassword = password;

            if (core.LoadPDF(path))
            {
                core.CurrentPage = 1;
                if (which == FitCondition.Height)
                {
                    core.FitToHeight(canvas.Parent.Handle);
                    core.Zoom = core.Zoom - 1; // 暫定
                }
                else if (which == FitCondition.Width)
                {
                    core.FitToWidth(canvas.Parent.Handle);
                    core.Zoom = core.Zoom - 1; // 暫定
                }
                else
                {
                    core.Zoom = 100;
                }
                canvas.Parent.Text = System.IO.Path.GetFileNameWithoutExtension(path);
                canvas.Parent.Tag  = path;
                CanvasPolicy.AsyncRender(canvas, true);
            }
        }
 /* ----------------------------------------------------------------- */
 /// Open
 /* ----------------------------------------------------------------- */
 public static void Open(Canvas canvas, string path, FitCondition which)
 {
     CanvasPolicy.Open(canvas, path, "", which);
 }
Beispiel #4
0
 /* ----------------------------------------------------------------- */
 /// UpdateFitCondtion
 /* ----------------------------------------------------------------- */
 private void UpdateFitCondition(FitCondition which)
 {
     setting_.Fit = which;
     this.FitToWidthButton.Checked = ((setting_.Fit & FitCondition.Width) != 0);
     this.FitToPageButton.Checked = ((setting_.Fit & FitCondition.Height) != 0);
 }
 /* ----------------------------------------------------------------- */
 /// Open
 /* ----------------------------------------------------------------- */
 public static void Open(Canvas canvas, string path, FitCondition which)
 {
     CanvasPolicy.Open(canvas, path, "", which);
 }
        /* ----------------------------------------------------------------- */
        ///
        /// Open
        /// 
        /// <summary>
        /// 指定された PDF ファイルを開いて,最初のページを描画する.
        /// MEMO: パスの記憶場所を検討中.現在は,Parent.Tag を利用
        /// している.
        /// </summary>
        /// 
        /* ----------------------------------------------------------------- */
        public static void Open(Canvas canvas, string path, string password, FitCondition which)
        {
            if (canvas == null) return;
            var engine = canvas.Tag as CanvasEngine;
            if (engine != null) CanvasPolicy.Close(canvas);

            var core = new PDF();
            engine = new CanvasEngine(core);
            canvas.Tag = engine;
            core.UseMuPDF = true;
            core.UserPassword = password;
            core.OwnerPassword = password;

            if (core.LoadPDF(path)) {
                core.CurrentPage = 1;
                if (which == FitCondition.Height) {
                    core.FitToHeight(canvas.Parent.Handle);
                    core.Zoom = core.Zoom - 1; // 暫定
                }
                else if (which == FitCondition.Width) {
                    core.FitToWidth(canvas.Parent.Handle);
                    core.Zoom = core.Zoom - 1; // 暫定
                }
                else core.Zoom = 100;
                canvas.Parent.Text = System.IO.Path.GetFileNameWithoutExtension(path);
                canvas.Parent.Tag = path;
                CanvasPolicy.AsyncRender(canvas, true);
            }
        }