Пример #1
0
        public static void DeletePages(string file, int[] pageNumbers)
        {
            try
            {
                if (String.IsNullOrEmpty(file) ||
                    !File.Exists(file) ||
                    pageNumbers == null)
                {
                    throw new ArgumentException("Invalid parameter");
                }

                if (pageNumbers.Length == 0)
                {
                    return;
                }

                using (Aspose.Edit edit = new Aspose.Edit(file))
                {
                    edit.DeletePages(pageNumbers);
                    edit.Save(file);
                } 
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
                throw;
            }
        }
Пример #2
0
        public static int PageCount(string file)
        {
            try
            {
                if (String.IsNullOrEmpty(file) ||
                    !File.Exists(file))
                {
                    throw new ArgumentException("Invalid parameter");
                }

                using (Aspose.Edit edit = new Aspose.Edit())
                {
                    return edit.PageCount(file);
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
                throw;
            }
        }
Пример #3
0
        public static void Combine(string[] source, string target)
        {
            try
            {
                if (source == null ||
                    source.Length == 0 || 
                    String.IsNullOrEmpty(target))
                {
                    throw new ArgumentException("Invalid parameter");
                }

                using (Aspose.Edit edit = new Aspose.Edit())
                {
                    edit.Combine(source, target);
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
                throw;
            }
        }