public class CdrImage extends VectorMultipageImage implements ICdrImage
The Cdr image.
Image,
ICdrImageThe following example shows how to cache all pages of a CDR image.
String dir = "c:\\temp\\";
// Load an image from a CDR file.
com.aspose.imaging.fileformats.cdr.CdrImage image = (com.aspose.imaging.fileformats.cdr.CdrImage) com.aspose.imaging.Image.load(dir + "sample.cdr");
try {
// This call caches only the default page.
image.cacheData();
// Cache all pages so that no additional data loading will be performed from the underlying data stream.
for (com.aspose.imaging.fileformats.cdr.CdrImagePage page : image.getPages()) {
page.cacheData();
}
} finally {
image.dispose();
}
| Constructor and Description |
|---|
CdrImage(InputStream stream,
LoadOptions loadOptions)
Initializes a new instance of the
CdrImage class. |
CdrImage(com.aspose.ms.System.IO.Stream stream,
LoadOptions loadOptions) |
| Modifier and Type | Method and Description |
|---|---|
void |
cacheData()
Caches the data and ensures no additional data loading will be performed from the underlying
DataStreamSupporter.DataStreamContainer(DataStreamSupporter.getDataStreamContainer()/DataStreamSupporter.setDataStreamContainer_internalized(com.aspose.imaging.StreamContainer)). |
int |
getBitsPerPixel()
Gets the image bits per pixel count.
|
CdrDocument |
getCdrDocument()
Gets the CDR document.
|
ImageOptionsBase |
getDefaultOptions(Object[] args)
Gets the default options.
|
Image |
getDefaultPage()
Deprecated.
Please use getPages()[index]
|
long |
getFileFormat()
Gets a value of file format
|
int |
getHeight()
Gets the image height.
|
int |
getPageCount()
Gets the page count.
|
PageExportingAction |
getPageExportingAction()
Gets the page exporting action.
|
Image[] |
getPages()
Gets the pages.
|
int |
getWidth()
Gets the image width.
|
boolean |
isCached()
Gets a value indicating whether object's data is cached currently and no data readig is required.
|
void |
resize(int newWidth,
int newHeight,
ImageResizeSettings settings)
Resizes the image.
|
void |
resize(int newWidth,
int newHeight,
int resizeType)
Resizes the image.
|
void |
rotateFlip(int rotateFlipType)
Rotates, flips, or rotates and flips the image.
|
void |
setPageExportingAction(PageExportingAction value)
Sets the page exporting action.
|
void |
setPalette(IColorPalette palette,
boolean updateColors)
Sets the image palette.
|
getEmbeddedImagesgetHeightF, getSizeF, getWidthFcanLoad, canLoad, canLoad, canLoad, canSave, create, create, create, getBackgroundColor, getBounds, getBufferSizeHint, getContainer, getFileFormat, getFileFormat, getFittingRectangle, getFittingRectangle, getInterruptMonitor, getOriginalOptions, getPalette, getProgressEventHandler, getProgressEventHandlerInfo, getProportionalHeight, getProportionalWidth, getSize, hasBackgroundColor, isAutoAdjustPalette, isUsePalette, load, load, load, load, load, load, resize, resizeHeightProportionally, resizeHeightProportionally, resizeHeightProportionally, resizeWidthProportionally, resizeWidthProportionally, resizeWidthProportionally, save, save, save, save, save, save, save, save, setAutoAdjustPalette, setBackgroundColor, setBackgroundColor, setBufferSizeHint, setInterruptMonitor, setPalettegetDataStreamContainer, save, save, saveclose, dispose, getDisposedpublic CdrImage(InputStream stream, LoadOptions loadOptions)
Initializes a new instance of the CdrImage class.
stream - The stream.loadOptions - The load options.com.aspose.ms.System.IndexOutOfRangeException - This document not be contained pagespublic CdrImage(com.aspose.ms.System.IO.Stream stream,
LoadOptions loadOptions)
@Deprecated public Image getDefaultPage()
Gets the default page.
getDefaultPage in interface IMultipageImagepublic boolean isCached()
Gets a value indicating whether object's data is cached currently and no data readig is required.
isCached in class VectorMultipageImagepublic int getBitsPerPixel()
Gets the image bits per pixel count.
getBitsPerPixel in class VectorMultipageImagepublic int getWidth()
Gets the image width.
getWidth in interface IObjectWithBoundsgetWidth in class VectorMultipageImagepublic int getHeight()
Gets the image height.
getHeight in interface IObjectWithBoundsgetHeight in class VectorMultipageImagepublic final int getPageCount()
Gets the page count.
getPageCount in interface IMultipageImagepublic final Image[] getPages()
Gets the pages.
getPages in interface IMultipageImageThe following example shows how to export a single page of CDR document to PDF.
int pageNumber = 0;
String dir = "c:\\aspose.imaging\\java\\issues\\1445'\\";
String inputCdrFileName = dir + "tiger.cdr";
String outputPdfFileName = dir + "tiger.cdr.page" + pageNumber + ".pdf";
com.aspose.imaging.fileformats.cdr.CdrImage image = (com.aspose.imaging.fileformats.cdr.CdrImage) com.aspose.imaging.Image.load(inputCdrFileName);
try {
com.aspose.imaging.Image imagePage = image.getPages()[pageNumber];
com.aspose.imaging.imageoptions.PdfOptions pdfOptions = new com.aspose.imaging.imageoptions.PdfOptions();
com.aspose.imaging.imageoptions.CdrRasterizationOptions rasterizationOptions = new com.aspose.imaging.imageoptions.CdrRasterizationOptions();
rasterizationOptions.setTextRenderingHint(com.aspose.imaging.TextRenderingHint.SingleBitPerPixel);
rasterizationOptions.setSmoothingMode(com.aspose.imaging.SmoothingMode.None);
rasterizationOptions.setPageWidth(image.getWidth());
rasterizationOptions.setPageHeight(image.getHeight());
pdfOptions.setVectorRasterizationOptions(rasterizationOptions);
imagePage.save(outputPdfFileName, pdfOptions);
}
finally {
image.close();
}
public final CdrDocument getCdrDocument()
Gets the CDR document.
getCdrDocument in interface ICdrImagepublic long getFileFormat()
Gets a value of file format
getFileFormat in class ImageFileFormatpublic PageExportingAction getPageExportingAction()
Gets the page exporting action. Please note that setting this method will automatically release page resources after it is executed. It will be executed just before each page is saved.
Value: The page exporting action.getPageExportingAction in interface IMultipageImagegetPageExportingAction in class VectorMultipageImagepublic void setPageExportingAction(PageExportingAction value)
Sets the page exporting action. Please note that setting this method will automatically release page resources after it is executed. It will be executed just before each page is saved.
Value: The page exporting action.setPageExportingAction in interface IMultipageImagesetPageExportingAction in class VectorMultipageImagevalue - the page exporting action.public ImageOptionsBase getDefaultOptions(Object[] args)
Gets the default options.
getDefaultOptions in class Imageargs - The arguments.public void cacheData()
Caches the data and ensures no additional data loading will be performed from the underlying
DataStreamSupporter.DataStreamContainer(DataStreamSupporter.getDataStreamContainer()/DataStreamSupporter.setDataStreamContainer_internalized(com.aspose.imaging.StreamContainer)).
cacheData in class VectorMultipageImageThe following example shows how to cache all pages of a CDR image.
String dir = "c:\\temp\\";
// Load an image from a CDR file.
com.aspose.imaging.fileformats.cdr.CdrImage image = (com.aspose.imaging.fileformats.cdr.CdrImage) com.aspose.imaging.Image.load(dir + "sample.cdr");
try {
// This call caches only the default page.
image.cacheData();
// Cache all pages so that no additional data loading will be performed from the underlying data stream.
for (com.aspose.imaging.fileformats.cdr.CdrImagePage page : image.getPages()) {
page.cacheData();
}
} finally {
image.dispose();
}
public void resize(int newWidth,
int newHeight,
int resizeType)
Resizes the image.
resize in class VectorMultipageImagenewWidth - The new width.newHeight - The new height.resizeType - The resize type.com.aspose.ms.System.NotImplementedException - method is not supportedpublic void resize(int newWidth,
int newHeight,
ImageResizeSettings settings)
Resizes the image.
resize in class VectorMultipageImagenewWidth - The new width.newHeight - The new height.settings - The resize settings.com.aspose.ms.System.NotImplementedException - method is not supportedpublic void rotateFlip(int rotateFlipType)
Rotates, flips, or rotates and flips the image.
rotateFlip in class VectorMultipageImagerotateFlipType - Type of the rotate flip.com.aspose.ms.System.NotImplementedException - method is not supportedpublic void setPalette(IColorPalette palette, boolean updateColors)
Sets the image palette.
setPalette in class VectorMultipageImagepalette - The palette to set.updateColors - if set to true colors will be updated according to the new palette; otherwise color
indexes remain unchanged. Note that unchanged indexes may crash the image on loading if some indexes have no
corresponding palette entries.com.aspose.ms.System.NotImplementedException - method is not supportedCopyright (c) 2008-2022 Aspose Pty Ltd. All Rights Reserved.