public class DownsampleOptions
extends java.lang.Object
To learn more, visit the Save a Document documentation article.
Examples:
Shows how to change the resolution of images in the PDF document.
Document doc = new Document(getMyDir() + "Images.docx");
// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions options = new PdfSaveOptions();
// By default, Aspose.Words downsample all images in a document that we save to PDF to 220 ppi.
Assert.assertTrue(options.getDownsampleOptions().getDownsampleImages());
Assert.assertEquals(220, options.getDownsampleOptions().getResolution());
Assert.assertEquals(0, options.getDownsampleOptions().getResolutionThreshold());
doc.save(getArtifactsDir() + "PdfSaveOptions.DownsampleOptions.Default.pdf", options);
// Set the "Resolution" property to "36" to downsample all images to 36 ppi.
options.getDownsampleOptions().setResolution(36);
// Set the "ResolutionThreshold" property to only apply the downsampling to
// images with a resolution that is above 128 ppi.
options.getDownsampleOptions().setResolutionThreshold(128);
// Only the first two images from the document will be downsampled at this stage.
doc.save(getArtifactsDir() + "PdfSaveOptions.DownsampleOptions.LowerResolution.pdf", options);
| Modifier and Type | Method and Description |
|---|---|
boolean |
getDownsampleImages()
Specifies whether images should be downsampled.
|
int |
getResolution()
Specifies the resolution in pixels per inch which the images should be downsampled to.
|
int |
getResolutionThreshold()
Specifies the threshold resolution in pixels per inch.
|
void |
setDownsampleImages(boolean value)
Specifies whether images should be downsampled.
|
void |
setResolution(int value)
Specifies the resolution in pixels per inch which the images should be downsampled to.
|
void |
setResolutionThreshold(int value)
Specifies the threshold resolution in pixels per inch.
|
public boolean getDownsampleImages()
Remarks:
The default value is true.
Examples:
Shows how to change the resolution of images in the PDF document.
Document doc = new Document(getMyDir() + "Images.docx");
// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions options = new PdfSaveOptions();
// By default, Aspose.Words downsample all images in a document that we save to PDF to 220 ppi.
Assert.assertTrue(options.getDownsampleOptions().getDownsampleImages());
Assert.assertEquals(220, options.getDownsampleOptions().getResolution());
Assert.assertEquals(0, options.getDownsampleOptions().getResolutionThreshold());
doc.save(getArtifactsDir() + "PdfSaveOptions.DownsampleOptions.Default.pdf", options);
// Set the "Resolution" property to "36" to downsample all images to 36 ppi.
options.getDownsampleOptions().setResolution(36);
// Set the "ResolutionThreshold" property to only apply the downsampling to
// images with a resolution that is above 128 ppi.
options.getDownsampleOptions().setResolutionThreshold(128);
// Only the first two images from the document will be downsampled at this stage.
doc.save(getArtifactsDir() + "PdfSaveOptions.DownsampleOptions.LowerResolution.pdf", options);
boolean value.public void setDownsampleImages(boolean value)
Remarks:
The default value is true.
Examples:
Shows how to change the resolution of images in the PDF document.
Document doc = new Document(getMyDir() + "Images.docx");
// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions options = new PdfSaveOptions();
// By default, Aspose.Words downsample all images in a document that we save to PDF to 220 ppi.
Assert.assertTrue(options.getDownsampleOptions().getDownsampleImages());
Assert.assertEquals(220, options.getDownsampleOptions().getResolution());
Assert.assertEquals(0, options.getDownsampleOptions().getResolutionThreshold());
doc.save(getArtifactsDir() + "PdfSaveOptions.DownsampleOptions.Default.pdf", options);
// Set the "Resolution" property to "36" to downsample all images to 36 ppi.
options.getDownsampleOptions().setResolution(36);
// Set the "ResolutionThreshold" property to only apply the downsampling to
// images with a resolution that is above 128 ppi.
options.getDownsampleOptions().setResolutionThreshold(128);
// Only the first two images from the document will be downsampled at this stage.
doc.save(getArtifactsDir() + "PdfSaveOptions.DownsampleOptions.LowerResolution.pdf", options);
value - The corresponding boolean value.public int getResolution()
Remarks:
The default value is 220 ppi.
Examples:
Shows how to change the resolution of images in the PDF document.
Document doc = new Document(getMyDir() + "Images.docx");
// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions options = new PdfSaveOptions();
// By default, Aspose.Words downsample all images in a document that we save to PDF to 220 ppi.
Assert.assertTrue(options.getDownsampleOptions().getDownsampleImages());
Assert.assertEquals(220, options.getDownsampleOptions().getResolution());
Assert.assertEquals(0, options.getDownsampleOptions().getResolutionThreshold());
doc.save(getArtifactsDir() + "PdfSaveOptions.DownsampleOptions.Default.pdf", options);
// Set the "Resolution" property to "36" to downsample all images to 36 ppi.
options.getDownsampleOptions().setResolution(36);
// Set the "ResolutionThreshold" property to only apply the downsampling to
// images with a resolution that is above 128 ppi.
options.getDownsampleOptions().setResolutionThreshold(128);
// Only the first two images from the document will be downsampled at this stage.
doc.save(getArtifactsDir() + "PdfSaveOptions.DownsampleOptions.LowerResolution.pdf", options);
int value.public void setResolution(int value)
Remarks:
The default value is 220 ppi.
Examples:
Shows how to change the resolution of images in the PDF document.
Document doc = new Document(getMyDir() + "Images.docx");
// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions options = new PdfSaveOptions();
// By default, Aspose.Words downsample all images in a document that we save to PDF to 220 ppi.
Assert.assertTrue(options.getDownsampleOptions().getDownsampleImages());
Assert.assertEquals(220, options.getDownsampleOptions().getResolution());
Assert.assertEquals(0, options.getDownsampleOptions().getResolutionThreshold());
doc.save(getArtifactsDir() + "PdfSaveOptions.DownsampleOptions.Default.pdf", options);
// Set the "Resolution" property to "36" to downsample all images to 36 ppi.
options.getDownsampleOptions().setResolution(36);
// Set the "ResolutionThreshold" property to only apply the downsampling to
// images with a resolution that is above 128 ppi.
options.getDownsampleOptions().setResolutionThreshold(128);
// Only the first two images from the document will be downsampled at this stage.
doc.save(getArtifactsDir() + "PdfSaveOptions.DownsampleOptions.LowerResolution.pdf", options);
value - The corresponding int value.public int getResolutionThreshold()
Remarks:
The default value is 0.
Examples:
Shows how to change the resolution of images in the PDF document.
Document doc = new Document(getMyDir() + "Images.docx");
// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions options = new PdfSaveOptions();
// By default, Aspose.Words downsample all images in a document that we save to PDF to 220 ppi.
Assert.assertTrue(options.getDownsampleOptions().getDownsampleImages());
Assert.assertEquals(220, options.getDownsampleOptions().getResolution());
Assert.assertEquals(0, options.getDownsampleOptions().getResolutionThreshold());
doc.save(getArtifactsDir() + "PdfSaveOptions.DownsampleOptions.Default.pdf", options);
// Set the "Resolution" property to "36" to downsample all images to 36 ppi.
options.getDownsampleOptions().setResolution(36);
// Set the "ResolutionThreshold" property to only apply the downsampling to
// images with a resolution that is above 128 ppi.
options.getDownsampleOptions().setResolutionThreshold(128);
// Only the first two images from the document will be downsampled at this stage.
doc.save(getArtifactsDir() + "PdfSaveOptions.DownsampleOptions.LowerResolution.pdf", options);
int value.public void setResolutionThreshold(int value)
Remarks:
The default value is 0.
Examples:
Shows how to change the resolution of images in the PDF document.
Document doc = new Document(getMyDir() + "Images.docx");
// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions options = new PdfSaveOptions();
// By default, Aspose.Words downsample all images in a document that we save to PDF to 220 ppi.
Assert.assertTrue(options.getDownsampleOptions().getDownsampleImages());
Assert.assertEquals(220, options.getDownsampleOptions().getResolution());
Assert.assertEquals(0, options.getDownsampleOptions().getResolutionThreshold());
doc.save(getArtifactsDir() + "PdfSaveOptions.DownsampleOptions.Default.pdf", options);
// Set the "Resolution" property to "36" to downsample all images to 36 ppi.
options.getDownsampleOptions().setResolution(36);
// Set the "ResolutionThreshold" property to only apply the downsampling to
// images with a resolution that is above 128 ppi.
options.getDownsampleOptions().setResolutionThreshold(128);
// Only the first two images from the document will be downsampled at this stage.
doc.save(getArtifactsDir() + "PdfSaveOptions.DownsampleOptions.LowerResolution.pdf", options);
value - The corresponding int value.