public void SetDocumentProperties(PDFDocumentProperties pdfDocproperties, bool readOnly) { _titleTextBox.Text = pdfDocproperties.Title; _authorTextBox.Text = pdfDocproperties.Author; _subjectTextBox.Text = pdfDocproperties.Subject; _keywordsTextBox.Text = pdfDocproperties.Keywords; _creatorTextBox.Text = pdfDocproperties.Creator; _producerTextBox.Text = pdfDocproperties.Producer; _createdDateTimePicker.Value = FixDate(_createdDateTimePicker, pdfDocproperties.Created); _createdTextBox.Text = _createdDateTimePicker.Value.ToString(_createdDateTimePicker.CustomFormat); _modifiedDateTimePicker.Value = FixDate(_modifiedDateTimePicker, pdfDocproperties.Modified); _modifiedTextBox.Text = _modifiedDateTimePicker.Value.ToString(_modifiedDateTimePicker.CustomFormat); if (readOnly) { _titleTextBox.ReadOnly = true; _authorTextBox.ReadOnly = true; _subjectTextBox.ReadOnly = true; _keywordsTextBox.ReadOnly = true; _creatorTextBox.ReadOnly = true; _producerTextBox.ReadOnly = true; _createdTextBox.ReadOnly = true; _createdDateTimePicker.Visible = false; _modifiedTextBox.ReadOnly = true; _modifiedDateTimePicker.Visible = false; } else { _createdTextBox.Visible = false; _modifiedTextBox.Visible = false; } }
public void UpdateDocumentProperties(PDFDocumentProperties pdfDocproperties) { pdfDocproperties.Title = _titleTextBox.Text; pdfDocproperties.Author = _authorTextBox.Text; pdfDocproperties.Subject = _subjectTextBox.Text; pdfDocproperties.Keywords = _keywordsTextBox.Text; pdfDocproperties.Creator = _creatorTextBox.Text; pdfDocproperties.Producer = _producerTextBox.Text; pdfDocproperties.Created = _createdDateTimePicker.Value; pdfDocproperties.Modified = _modifiedDateTimePicker.Value; }
public void SetDocument(PDFFile document, bool showCompatibilityLevel, bool showSecurityOptions, bool showOptimizationOptions, bool showInitialViewOptions, int firstPageNumber, int lastPageNumber) { _showSecurityOptions = showSecurityOptions; _showOptimizationOptions = showOptimizationOptions; _showInitialViewOptions = showInitialViewOptions; _compatibilityLevelComboBox.Visible = showCompatibilityLevel; _compatibilityLevelLabel.Visible = showCompatibilityLevel; _compatibilityLevelComboBox.SelectedItem = document.CompatibilityLevel; if (document.DocumentProperties != null) { _documentPropertiesControl.SetDocumentProperties(document.DocumentProperties, false); } else { PDFDocumentProperties documentProps = new PDFDocumentProperties(); documentProps.Created = DateTime.Now; documentProps.Modified = DateTime.Now; _documentPropertiesControl.SetDocumentProperties(documentProps, false); } if (showSecurityOptions) { _updateSecurityOptionsCheckBox.Checked = document.SecurityOptions != null; if (document.SecurityOptions != null) { _securityOptionsControl.SetSecurityOptions(document.SecurityOptions); } else { PDFSecurityOptions securityOptions = new PDFSecurityOptions(); securityOptions.PrintEnabled = true; securityOptions.HighQualityPrintEnabled = true; securityOptions.CopyEnabled = true; securityOptions.EditEnabled = true; securityOptions.AnnotationsEnabled = true; securityOptions.AssemblyEnabled = true; securityOptions.EncryptionMode = PDFEncryptionMode.RC40Bit; _securityOptionsControl.SetSecurityOptions(securityOptions); } _securityOptionsControl.SetCompatibilityLevel(document.CompatibilityLevel); } #if LEADTOOLS_V19_OR_LATER if (showOptimizationOptions) { _updateOptimizationOptionsCheckBox.Checked = document.OptimizerOptions != null; if (document.OptimizerOptions != null) { _optimizerOptionsControl.SetOptimizerOptions(document.OptimizerOptions); } else { PDFOptimizerOptions optimizerOptions = new PDFOptimizerOptions(); optimizerOptions.AutoOptimizerMode = PDFAutoOptimizerMode.Customized; optimizerOptions.ColorImageDownsamplingMode = PDFDownsamplingMode.Average; optimizerOptions.ColorImageDownsampleFactor = 1.5; optimizerOptions.ColorImageDPI = 150; optimizerOptions.ColorImageCompression = RasterImageFormat.Jpeg; optimizerOptions.GrayImageDownsamplingMode = PDFDownsamplingMode.Average; optimizerOptions.GrayImageDownsampleFactor = 1.5; optimizerOptions.GrayImageDPI = 150; optimizerOptions.GrayImageCompression = RasterImageFormat.RawFlate; optimizerOptions.MonoImageDownsamplingMode = PDFDownsamplingMode.Average; optimizerOptions.MonoImageDownsampleFactor = 1.5; optimizerOptions.MonoImageDPI = 150; optimizerOptions.MonoImageCompression = RasterImageFormat.FaxG4; _optimizerOptionsControl.SetOptimizerOptions(optimizerOptions); } } if (showInitialViewOptions) { _updateInitialViewOptionsCheckBox.Checked = document.InitialViewOptions != null; int totalPages = (lastPageNumber == -1) ? document.Pages.Count - firstPageNumber + 1 : lastPageNumber - firstPageNumber + 1; if (document.InitialViewOptions != null) { _initialViewOptionsControl.SetInitialViewOptions(document.InitialViewOptions, totalPages); } else { PDFInitialViewOptions initialViewOptions = new PDFInitialViewOptions(); initialViewOptions.AutoPrint = false; initialViewOptions.CenterWindow = false; initialViewOptions.DisplayDocTitle = false; initialViewOptions.FitWindow = false; initialViewOptions.HideMenubar = false; initialViewOptions.HideToolbar = false; initialViewOptions.HideWindowUI = false; initialViewOptions.PageFitType = PDFPageFitType.Default; initialViewOptions.PageLayoutType = PDFPageLayoutType.OneColumnDisplay; initialViewOptions.PageModeType = PDFPageModeType.PageOnly; initialViewOptions.PageNumber = 1; initialViewOptions.Position = new PDFPoint(0, 0); initialViewOptions.ZoomPercent = 0; _initialViewOptionsControl.SetInitialViewOptions(initialViewOptions, totalPages); } } #endif // #if LEADTOOLS_V19_OR_LATER UpdateUIState(showSecurityOptions, showOptimizationOptions, showInitialViewOptions); }