Пример #1
0
        /// <summary>
        /// 初始化设置图签
        /// </summary>
        /// <param name="file"></param>
        public AddPdfTagFrm(SignFile file) : this()
        {
            if (file == null)
            {
                return;
            }

            _file           = file;
            btnUp.Visible   = false;
            btnNext.Visible = false;
        }
Пример #2
0
        /// <summary>
        /// 设置标记
        /// </summary>
        /// <param name="position"></param>
        /// <param name="oldPath"></param>
        /// <param name="signedPath"></param>
        private static void SetSign(string oldPath, string signedPath, Point position)
        {
            if (string.IsNullOrWhiteSpace(oldPath))
            {
                throw new ArgumentException(nameof(oldPath));
            }

            if (string.IsNullOrWhiteSpace(signedPath))
            {
                throw new ArgumentException(nameof(signedPath));
            }

            if (!File.Exists(oldPath))
            {
                throw new FileNotFoundException(nameof(oldPath));
            }

            if (!File.Exists(signedPath))
            {
                throw new FileNotFoundException(nameof(signedPath));
            }

            var fileInfo = new FileInfo(oldPath);

            if (fileInfo.IsReadOnly)
            {
                fileInfo.IsReadOnly = false;
            }

            const string link = "http://www.bing.com";

            var signFile = new SignFile(oldPath, signedPath);

            signFile.AddSign(link, position);
            fileInfo = new FileInfo(signedPath);

            if (fileInfo.IsReadOnly)
            {
                fileInfo.IsReadOnly = false;
            }

            fileInfo.Delete();
        }