Exemple #1
0
        internal override  ActionPropertySet BuildActionProperties(string sourceFilePath)
        {
            var temp = new PDFCleanActionPropertySet();
            var result = new ActionPropertySet(temp);

            result[PDFCleanOption.Bookmarks].Value = true;
            result[PDFCleanOption.Properties].Value = true;
            result[PDFCleanOption.Attachments].Value = true;
            result[PDFCleanOption.Markups].Value = true;

            foreach (PdfMetadataType mdt in m_metadataExclusions)
            {
                string contentType = mdt.ToString();
                IActionProperty prop = null;
                if (result.TryGetValue(contentType, out prop))
                {
                    result[contentType].Value = false;
                }
            }
            
            if (!string.IsNullOrEmpty(sourceFilePath))
            {
                var fileType = ValidateFileType(sourceFilePath);
                result.SystemProperties.Add("FileType", new ActionProperty("FileType", FileTypeBridge.GetFileType(fileType)));
            }

            return result;
        }
        /// <summary>
        /// This method copies out some properties so they are not merged by IAction3's.
        /// IAction3 impls should be agnostic of properties that *we* rely on but which are irrelevant to 3rd parties.
        /// </summary>
        /// <param name="set">The original set, which may or may not contain 'engine' specific properties</param>
        /// <param name="protectedSet">Any engine-specific props will be filtered out into this set.</param>
        private ActionPropertySet CopyOutEngineProperties(ActionPropertySet set)
        {
            ActionPropertySet protectedSet = new ActionPropertySet();

            foreach (string propName in m_engineProperties)
            {
                IActionProperty prop;
                if (set.TryGetValue(propName, out prop))
                {
                    set.Remove(propName);
                    protectedSet[propName] = prop;
                }
            }

            return protectedSet;
        }