OneNote-Dokument als Bild speichern
Contents
[
Hide
Show
]Speichern eines Dokuments in einem Bildformat
Wie funktioniert das?
Mit der von der API bereitgestellten Speichermethode können Sie das Dokument in Bildformaten speichern. Die folgenden drei überladenen Elemente bieten die Möglichkeit, das Dokument in Bildformaten zu speichern.
- save(string)
- save(string, ImageSaveOptions)
- save(string, SaveFormat)
Speichern eines Dokuments als Bild im BMP-Format mit ImageSaveOptions
1 // The path to the documents directory.
2 String dataDir = Utils.getSharedDataDir(SaveOneNoteDocToStream.class) + "load/";
3
4 // Load the document into Aspose.Note.
5 Document oneFile = new Document(dataDir + "Aspose.one");
6
7 dataDir = dataDir + "SaveToBmpImageUsingImageSaveOptions_out.bmp";
8
9 // Save the document.
10 oneFile.save(dataDir, new ImageSaveOptions(SaveFormat.Bmp));
Speichern eines Dokuments als Bild im Jpeg-Format mit SaveFormat
1 // The path to the documents directory.
2 String dataDir = Utils.getSharedDataDir(SaveOneNoteDocToStream.class) + "load/";
3
4 // Load the document into Aspose.Note.
5 Document oneFile = new Document(dataDir + "Aspose.one");
6
7 dataDir = dataDir + "SaveToJpegImageUsingSaveFormat_out.jpg";
8
9 // Save the document.
10 oneFile.save(dataDir, SaveFormat.Jpeg);
Speichern eines Dokuments als Bild im TIFF-Format mit JPEG-Kompression
1 // The path to the documents directory.
2 String dataDir = Paths.get(Utils.getSharedDataDir(SaveOneNoteDocToStream.class), "load").toString();
3
4 // Load the document into Aspose.Note.
5 Document oneFile = new Document(Paths.get(dataDir, "Aspose.one").toString());
6
7 ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Tiff);
8 options.setTiffCompression(TiffCompression.Jpeg);
9 options.setQuality(93);
10
11 oneFile.save(Paths.get(dataDir,"SaveToTiffUsingJpegCompression.tiff").toString(), options);
Speichern eines Dokuments als Bild im TIFF-Format mit PackBits-Kompression
1 // The path to the documents directory.
2 String dataDir = Paths.get(Utils.getSharedDataDir(SaveOneNoteDocToStream.class), "load").toString();
3
4 // Load the document into Aspose.Note.
5 Document oneFile = new Document(Paths.get(dataDir, "Aspose.one").toString());
6
7 ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Tiff);
8 options.setTiffCompression(TiffCompression.PackBits);
9
10 oneFile.save(Paths.get(dataDir, "SaveToTiffUsingPackBitsCompression.tiff").toString(), options);
Speichern eines Dokuments als Graustufenbild
1 // The path to the documents directory.
2 String dataDir = Utils.getSharedDataDir(SaveOneNoteDocToStream.class) + "load/";
3
4 // Load the document into Aspose.Note.
5 Document oneFile = new Document(dataDir + "Aspose.one");
6
7 dataDir = dataDir + "SaveAsGrayscaleImage_out.png";
8
9 ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Png);
10 options.setColorMode(ColorMode.GrayScale);
11
12 // Save the document.
13 oneFile.save(dataDir, options);
Speichern eines Dokuments als Binärbild mit festem Schwellenwert
1 // The path to the documents directory.
2 String dataDir = Utils.getSharedDataDir(SaveOneNoteDocToStream.class) + "load/";
3
4 // Load the document into Aspose.Note.
5 Document oneFile = new Document(dataDir + "Aspose.one");
6
7 dataDir = dataDir + "SaveToBinaryImageUsingFixedThreshold_out.png";
8
9 ImageBinarizationOptions binarizationOptions = new ImageBinarizationOptions();
10 binarizationOptions.setBinarizationMethod(BinarizationMethod.FixedThreshold);
11 binarizationOptions.setBinarizationThreshold(123);
12
13 ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Png);
14 options.setColorMode(ColorMode.BlackAndWhite);
15 options.setBinarizationOptions(binarizationOptions);
16
17 // Save the document as gif.
18 oneFile.save(dataDir, options);
Speichern eines Dokuments als Binärbild mit der Methode von Otsu
1 // The path to the documents directory.
2 String dataDir = Utils.getSharedDataDir(SaveOneNoteDocToStream.class) + "load/";
3
4 // Load the document into Aspose.Note.
5 Document oneFile = new Document(dataDir + "Aspose.one");
6
7 dataDir = dataDir + "SaveToBinaryImageUsingOtsuMethod_out.png";
8
9 ImageBinarizationOptions binarizationOptions = new ImageBinarizationOptions();
10 binarizationOptions.setBinarizationMethod(BinarizationMethod.Otsu);
11
12 ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Png);
13 options.setColorMode(ColorMode.BlackAndWhite);
14 options.setBinarizationOptions(binarizationOptions);
15
16 // Save the document.
17 oneFile.save(dataDir, options);
Speichern eines Dokuments als Binärbild im TIFF-Format unter Verwendung der Faxkomprimierung der CCITT-Gruppe 3.
1 // The path to the documents directory.
2 String dataDir = Paths.get(Utils.getSharedDataDir(SaveOneNoteDocToStream.class), "load").toString();
3
4 // Load the document into Aspose.Note.
5 Document oneFile = new Document(Paths.get(dataDir, "Aspose.one").toString());
6
7 ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Tiff);
8 options.setColorMode(ColorMode.BlackAndWhite);
9 options.setTiffCompression(TiffCompression.Ccitt3);
10
11 oneFile.save(Paths.get(dataDir, "SaveToTiffUsingCcitt3Compression.tiff").toString(), options);