Cuminas DjVu SDK for .NET Framework
MergePages(Document,ChunkNameRenameHandler,Boolean,Boolean) Method
Example 



Document to mege into this document.
Delegate to rename the chunk file names on chunk file name confliction.
Whether the merge process should process bookmark (NAVM chunk) or not.
Whether the merge process should process annotation (ANTz/ANTa chunk) or not.
Merges the specified document to this document.
Syntax
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)

Parameters

mergee
Document to mege into this document.
renameHandler
Delegate to rename the chunk file names on chunk file name confliction.
processBookmark
Whether the merge process should process bookmark (NAVM chunk) or not.
processAnno
Whether the merge process should process annotation (ANTz/ANTa chunk) or not.
Remarks

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.

Example
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);
    }
}
Requirements

Target Platforms: Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

Reference

Document Class
Document Members
Overload List

Send Feedback