DjVu Namespace > Document Class > MergePages Method : MergePages(Document,ChunkNameRenameHandler,Boolean,Boolean) Method |
Public Overloads Sub MergePages( _ ByVal mergee As Document, _ ByVal renameHandler As ChunkNameRenameHandler, _ ByVal processBookmark As Boolean, _ ByVal processAnno As Boolean _ )
Dim instance As Document Dim mergee As Document Dim renameHandler As ChunkNameRenameHandler Dim processBookmark As Boolean Dim processAnno As Boolean instance.MergePages(mergee, renameHandler, processBookmark, processAnno)
public void MergePages( Document mergee, ChunkNameRenameHandler renameHandler, bool processBookmark, bool processAnno )
public: void MergePages( Document^ mergee, ChunkNameRenameHandler^ renameHandler, bool processBookmark, bool processAnno )
Merging two documents is not a simple task. A document may have bookmarks and annotations besides its pages. Because the pages are normally identified by their names and if both of the documents have the pages of conflicting names, simply moving the pages may break bookmarks, links and other document consistencies.
This method takes care of such complicated things automatically and is the recommended way to merge documents.
using System; using System.IO; using DjVu; class DocMerge { static void Main() { using (Document doc1 = new Document("merger.djvu")) { using (Document doc2 = new Document("mergee.djvu")) { doc1.MergePages(doc2, chunkRename, true, true); doc1.SaveAs("result.djvu"); } } } static string chunkRename(string oldName, Chunk chunk, int trial) { string body = Path.GetFileName(oldName); string ext = Path.GetExtension(oldName); // filename.djvu -> filename-N.djvu return string.Format("{0}-{1}{2}", body, trial, ext); } }
Target Platforms: Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family