public class CdrImage extends VectorMultipageImage implements ICdrImage
The Cdr image.
Image
,
ICdrImage
The 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()
Gets the default page.
|
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.
|
getHeightF, getSizeF, getWidthF
canLoad, canLoad, canLoad, canLoad, canSave, create, getBackgroundColor, getBounds, getBufferSizeHint, getContainer, getFileFormat, getFileFormat, getFittingRectangle, getFittingRectangle, getInterruptMonitor, getOriginalOptions, getPalette, getProgressEventHandler, getProgressEventHandlerInfo, getProportionalHeight, getProportionalWidth, getSize, hasBackgroundColor, isAutoAdjustPalette, load, load, load, load, load, load, resize, resizeHeightProportionally, resizeHeightProportionally, resizeHeightProportionally, resizeWidthProportionally, resizeWidthProportionally, resizeWidthProportionally, save, save, save, save, save, save, save, setAutoAdjustPalette, setBackgroundColor, setBackgroundColor, setBufferSizeHint, setInterruptMonitor, setPalette
getDataStreamContainer, save, save, save, save
close, dispose, getDisposed
public 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)
public Image getDefaultPage()
Gets the default page.
Value: The default page.getDefaultPage
in interface IMultipageImage
getDefaultPage
in class VectorMultipageImage
public boolean isCached()
Gets a value indicating whether object's data is cached currently and no data readig is required.
isCached
in class VectorMultipageImage
public int getBitsPerPixel()
Gets the image bits per pixel count.
getBitsPerPixel
in class VectorMultipageImage
public int getWidth()
Gets the image width.
getWidth
in interface IObjectWithBounds
getWidth
in class VectorMultipageImage
public int getHeight()
Gets the image height.
getHeight
in interface IObjectWithBounds
getHeight
in class VectorMultipageImage
public final int getPageCount()
Gets the page count.
getPageCount
in interface IMultipageImage
getPageCount
in class VectorMultipageImage
public final Image[] getPages()
Gets the pages.
getPages
in interface IMultipageImage
getPages
in class VectorMultipageImage
The 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 ICdrImage
public long getFileFormat()
Gets a value of file format
getFileFormat
in class Image
public 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 IMultipageImage
getPageExportingAction
in class VectorMultipageImage
public 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 IMultipageImage
setPageExportingAction
in class VectorMultipageImage
value
- the page exporting action.public ImageOptionsBase getDefaultOptions(Object[] args)
Gets the default options.
getDefaultOptions
in class Image
args
- 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 VectorMultipageImage
The 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 VectorMultipageImage
newWidth
- 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 VectorMultipageImage
newWidth
- 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 VectorMultipageImage
rotateFlipType
- 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 VectorMultipageImage
palette
- 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 supported