Cuminas DjVu SDK for .NET Framework
Save in Indirect Format

Save in Indirect Format

The following sample loads a DjVu file and save it in indirect format.

indirect.cs
Copy Code
using System;
using DjVu;
namespace IndirectSave
{
  class IndirectSave
  {
    static void Main(string[] args)
    {
      // TODO: ADD app's license script here or REMOVE the following line
      LicenseManager.LicenseScript = "......";

      using (Document doc = new Document(args[0]))
      {
        // The following will remove satellite files
        // doc.MakeIndirectFriendly();
       
        doc.SaveAsIndirect(args[1]);
      }
    }
  }
}

In certain cases, you don't want satellite files, which do not correspond to any page (such as dictionaries, thumbnails and shared annotation), you can use Document.MakeIndirectFriendly Method to remove such files.

The Alternative Way

Although the following code does not save the directory index file, it saves each page to an independent file.

savepxp.cs
Copy Code
using System;
using DjVu;
namespace SavePageByPage
{
  class SavePageByPage
  {
    static void Main(string[] args)
    {
      // TODO: ADD app's license script here or REMOVE the following line
      LicenseManager.LicenseScript = "......"; 

      using (Document doc = new Document(args[0]))
      {
        for (int i = 0; i < doc.Pages.Count; i++)
        {
          string name = string.Format("{0}.djvu", i + 1);
          doc.Pages[i].SaveAs(name);
        }
      }
    }
  }
}
See Also
Send Feedback