Ejemplo n.º 1
0
        public PdfShrinker(FileInfo fileToShrink, ShrinkOptions options)
        {
            ChangeStatus(PdfShrinkStatus.Initialising, 0);
            _OriginalFile = fileToShrink;
            _ShrinkOptions = options;

            _OriginalAccess = fileToShrink.LastAccessTime;
            _OriginalCreation = fileToShrink.CreationTime;
            _OriginalModified = fileToShrink.LastWriteTime;
            _OriginalAttributes = fileToShrink.Attributes;

            OriginalSize = fileToShrink.Length;
            OriginalFullName = fileToShrink.FullName;
            OriginalName = fileToShrink.Name;
        }
Ejemplo n.º 2
0
        private void Process()
        {
            List<PdfShrinker> shrinkers = new List<PdfShrinker>();

            ShrinkOptions options = new ShrinkOptions()
            {
                EncodingQuality = (int)(JpegEncoding * 100),
                NewFolder = NewPath,
                SaveOption = Overwrite ? SaveOption.Overwrite : SaveOption.SaveNew,
                RetainAccessedDate = PreserveAccessed,
                RetainAttributes = PreserveAttributes,
                RetainCreationDate = PreserveCreation,
                RetainModifiedDate = PreserveModified
            };

            foreach (SelectedFileInfo file in PdfFiles)
            {
                shrinkers.Add(new PdfShrinker(new FileInfo(file.FullName), options));
            }

            ProcessingView view = new ProcessingView();
            view.DataContext = new ProcessingViewModel
                (shrinkers, ThreadCount, view, ShowReport);
            view.Show();
            CloseWindow();
        }