예제 #1
0
        /* ----------------------------------------------------------------- */
        ///
        /// SaveOne
        ///
        /// <summary>
        /// Saves the specified page.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private void SaveOne(PdfReader reader, int pagenum, string dest)
        {
            var kv = WriterFactory.Create(dest, Metadata, UseSmartCopy, IO);

            kv.Value.Set(Encryption);
            kv.Key.Open();
            kv.Value.AddPage(kv.Value.GetImportedPage(reader, pagenum));
            kv.Key.Close();
            kv.Value.Close();
        }
예제 #2
0
 /* ----------------------------------------------------------------- */
 ///
 /// Finalize
 ///
 /// <summary>
 /// Adds some additional metadata to the merged document.
 /// </summary>
 ///
 /* ----------------------------------------------------------------- */
 private void Finalize(string src, string dest)
 {
     using (var reader = ReaderFactory.Create(src))
         using (var writer = WriterFactory.Create(dest, reader, IO))
         {
             writer.Writer.Outlines = Bookmarks;
             writer.Set(Metadata, reader.Info);
             writer.Writer.Set(Encryption);
             if (Metadata.Version.Minor >= 5)
             {
                 writer.SetFullCompression();
             }
         }
 }
예제 #3
0
        /* ----------------------------------------------------------------- */
        ///
        /// Merge
        ///
        /// <summary>
        /// Merges pages and save the document to the specified path.
        /// </summary>
        ///
        /// <remarks>
        /// 注釈等を含めて完全にページ内容をコピーするため、いったん
        /// PdfCopy クラスを用いて全ページを結合します。セキュリティ設定や
        /// 文書プロパティ等の情報は生成された PDF に対して付加します。
        /// </remarks>
        ///
        /* ----------------------------------------------------------------- */
        private void Merge(string dest)
        {
            var kv = WriterFactory.Create(dest, Metadata, UseSmartCopy, IO);

            kv.Key.Open();
            Bookmarks.Clear();

            foreach (var page in Pages)
            {
                AddPage(page, kv.Value);
            }

            kv.Value.Set(Attachments);
            kv.Key.Close();
            kv.Value.Close();
        }