Enum SaveFormat

Enum SaveFormat

Namespace: Aspose.Note
Assembly: Aspose.Note.dll (25.6.0)

Indicates the format in which the document is saved.

public enum SaveFormat
{
   Docx = 16,
   FlatOpcml = 24,
   FlatOpcmlStrict = 32,
   WordProcessingML = 8,
   OpenDocumentText = 7,
   RichTextFormat = 9,
   Html = 5,
   Mhtml = 20,
   Text = 4,
   Dtf = 14,
   Odt = 6,
   Pdf = 12,
   Xps = 18,
   Svg = 22,
   Emf = 10,
   Emz = 13,
   Wml = 2,
   WmlPart = 3,
   Mobipocket = 1,
   Txt,
   FixedLayout,
   Dlb,
   Djvu,
   Xpsx,
   XamlFixup,
   OneNote = 11
}

Fields

Bmp = 2

Specifies that the output is a BMP file.

Gif = 4

Specifies that the output is a GIF file.

Html = 8

Specifies that the output is a HTML file.

Jpeg = 3

Specifies that the output is a JPEG file.

One = 7

Specifies that the output is a OneNote file.

Pdf = 6

Specifies that the output is a PDF file.

Png = 1

Specifies that the output is a PNG file.

Tiff = 5

Specifies that the output is a TIFF file.

Examples

Shows how to save a document using SaveFormat enumeration.

string inputFile = "Sample1.one";
   string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   string outputFile = "SaveDocToOneNoteFormatUsingSaveFormat_out.one";
   Document document = new Document(dataDir + inputFile);
   document.Save(dataDir + outputFile, SaveFormat.One);

Shows how to save a document in pdf format using default settings.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   string dataDir = dataDir + "SaveWithDefaultSettings_out.pdf";
   oneFile.Save(dataDir, SaveFormat.Pdf);

Shows how to save a document as image in Jpeg format using SaveFormat.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "\\Aspose.one");
   string dataDirWithOutputPath = dataDir + "\\";
   oneFile.Save(dataDirWithOutputPath + "SaveToJpegImageUsingSaveFormat_out.jpg", SaveFormat.Jpeg);

Shows how to save a document in gif format.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   string dataDirGif = dataDir + "SaveToImageDefaultOptions_out.gif";
   oneFile.Save(dataDirGif, SaveFormat.Gif);
   string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   string dataDirGif = dataDir + "SaveToImageDefaultOptions_out.gif";
   oneFile.Save(
       dataDirGif,
       SaveFormat.Gif
   );

Shows how to set a image quality when saving document as image in JPEG format.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document(dataDir + "Aspose.one");
   string dataDir_new = dataDir + "SetOutputImageResolution_out.jpg";
   doc.Save(dataDir_new, new ImageSaveOptions { Quality = 100, SaveFormat = SaveFormat.Jpeg });

Shows how to save a document as image in Bmp format using ImageSaveOptions.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   string dataDirWithOutputPath = dataDir + "SaveToBmpImageUsingImageSaveOptions_out.bmp";
   oneFile.Save(dataDirWithOutputPath, new ImageSaveOptions { SaveFormat = SaveFormat.Bmp });

Shows how to set a image resolution when saving document as image.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document(dataDir + "Aspose.one");
   string dataDirWithOutputImagePath = dataDir + "SetOutputImageResolution_out.jpg";
   doc.Save(dataDirWithOutputImagePath,
            new ImageSaveOptions() { SaveFormat = SaveFormat.Jpeg, Resolution = 220 });

Shows how to save a document as grayscale image.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   string dataDirWithOutputPath = dataDir + "\\SaveAsGrayscaleImage_out.png";
   oneFile.Save(dataDirWithOutputPath, new ImageSaveOptions { SaveFormat = SaveFormat.Png, ColorMode = ColorMode.GrayScale });

Shows how to save a document as image in Tiff format using PackBits compression.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));
   var dst = Path.Combine(dataDir, "SaveToTiffUsingPackBitsCompression.tiff");
   oneFile.Save(dst, new ImageSaveOptions()
   {
      SaveFormat = SaveFormat.Tiff,
      TiffCompression = TiffCompression.PackBits
   });

Shows how to save a document as image in Tiff format using Jpeg compression.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));
   var dst = Path.Combine(dataDir, "SaveToTiffUsingJpegCompression.tiff");
   oneFile.Save(dst, new ImageSaveOptions()
   {
      SaveFormat = SaveFormat.Tiff,
      TiffCompression = TiffCompression.Jpeg,
      Quality = 93
   });

Shows how to save a document as image in Tiff format using CCITT Group 3 fax compression.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));
   var dst = Path.Combine(dataDir, "SaveToTiffUsingCcitt3Compression.tiff");
   oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
   {
      ColorMode = ColorMode.BlackAndWhite,
      TiffCompression = TiffCompression.Ccitt3
   });

Shows how to save a document as binary image using Otsu’s method.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   string dataDirWithOutputPath = dataDir + @"\SaveToBinaryImageUsingOtsuMethod_out.png";
   oneFile.Save(dataDirWithOutputPath, new ImageSaveOptions(SaveFormat.Png)
   {
      ColorMode = ColorMode.BlackAndWhite,
      BinarizationOptions = new ImageBinarizationOptions()
      {
         BinarizationMethod = BinarizationMethod.Otsu,
      }
   });

Shows how to save a document as binary image using fixed threshold.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   dataDir += "SaveToBinaryImageUsingFixedThreshold_out.png";
   oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
   {
      ColorMode = ColorMode.BlackAndWhite,
      BinarizationOptions = new ImageBinarizationOptions()
      {
         BinarizationMethod = BinarizationMethod.FixedThreshold,
         BinarizationThreshold = 123
      }
   });
 English