Exemple #1
0
        private void OptionsNextPage()
        {
            OperationItem operationItem = GetCurrentOperation();
            string        viewFileName;

            if (operationItem.DestinationMustExist)
            {
                viewFileName = _destinationDocument.FileName;
            }
            else
            {
                viewFileName = _destinationFileName != null ? _destinationFileName : _sourceDocument.FileName;
            }

            if (operationItem.DestinationMustExist)
            {
                _optionsConvertOptionsControl.UpdateDocument(_destinationDocument);
            }
            else
            {
                _optionsConvertOptionsControl.UpdateDocument(_sourceDocument);
            }

            try
            {
                using (WaitCursor wait = new WaitCursor())
                {
                    switch (operationItem.Operation)
                    {
                    case Operation.UpdateProperties:
                        _sourceDocument.SetDocumentProperties(_destinationFileName);
                        break;

                    case Operation.ConvertToPDFA:
                        _sourceDocument.ConvertToPDFA(_destinationFileName);
                        break;

                    case Operation.Linearize:
                        _sourceDocument.Linearize(_destinationFileName);
                        break;

                    case Operation.Convert:
                        _sourceDocument.Convert(_firstPageNumber, _lastPageNumber, _destinationFileName);
                        break;

                    case Operation.Merge:
                        string[] sourceFiles = new string[_sourceFilesListBox.Items.Count];
                        for (int i = 0; i < _sourceFilesListBox.Items.Count; i++)
                        {
                            sourceFiles[i] = _sourceFilesListBox.Items[i].ToString();
                        }

                        _sourceDocument.MergeWith(sourceFiles, _destinationFileName);
                        break;

                    case Operation.DeletePages:
                        _sourceDocument.DeletePages(_firstPageNumber, _lastPageNumber, _destinationFileName);
                        break;

                    case Operation.ExtractPages:
                        _sourceDocument.ExtractPages(_firstPageNumber, _lastPageNumber, _destinationFileName);
                        break;

                    case Operation.InsertPages:
                        _destinationDocument.InsertPagesFrom(_insertPageNumber, _sourceDocument, _firstPageNumber, _lastPageNumber);
                        break;

                    case Operation.Distill:
                        _sourceDocument.Distill(_distillerOptions, _destinationFileName);
                        break;

                    case Operation.InitialView:
                        _sourceDocument.SetInitialView(_destinationFileName);
                        break;

                    case Operation.Optimizer:
                        _sourceDocument.Optimize(_destinationFileName);
                        break;

                    case Operation.DigitalSignature:
                        if (!HasDigitalSignatureSupport(this))
                        {
                            return;
                        }

                        _sourceDocument.SignDocument(_destinationFileNameTextBox.Text, _signatureFileNameTextBox.Text, _filePasswordTextBox.Text);
                        break;

                    default:
                        break;
                    }
                }

                System.Diagnostics.Process.Start(viewFileName);
            }
            catch (Exception ex)
            {
                Messager.ShowError(this, ex);
            }
        }