public class PdfOptions extends ImageOptionsBase
The PDF options.
The following example shows how to convert a multipage vector image to PDF format in general way without referencing to a particular image type.
String dir = "C:\\aspose.imaging\\net\\misc\\ImagingReleaseQATester\\Tests\\testdata\\2548";
String inputFilePath = (dir + "Multipage.cdr");
String outputFilePath = (dir + "Multipage.cdr.pdf");
com.aspose.imaging.ImageOptionsBase exportOptions = new com.aspose.imaging.imageoptions.PdfOptions();
try (com.aspose.imaging.Image image = com.aspose.imaging.Image.load(inputFilePath))
{
exportOptions.setMultiPageOptions(null);
// Export only first two pages to the corresponding pages of the output PDF document.
com.aspose.imaging.IMultipageImage multipageImage = (image instanceof com.aspose.imaging.IMultipageImage) ? (com.aspose.imaging.IMultipageImage) image : null;
if (multipageImage != null && (multipageImage.getPages() != null && multipageImage.getPageCount() > 2))
{
exportOptions.setMultiPageOptions(new com.aspose.imaging.imageoptions.MultiPageOptions(new com.aspose.imaging.IntRange(0, 2)));
}
if (image instanceof com.aspose.imaging.VectorImage)
{
com.aspose.imaging.imageoptions.VectorRasterizationOptions defaultOptions = (com.aspose.imaging.imageoptions.VectorRasterizationOptions) image.getDefaultOptions(new Object[]{Color.getWhite(), image.getWidth(), image.getHeight()});
exportOptions.setVectorRasterizationOptions(defaultOptions);
defaultOptions.setTextRenderingHint(com.aspose.imaging.TextRenderingHint.SingleBitPerPixel);
defaultOptions.setSmoothingMode(com.aspose.imaging.SmoothingMode.None);
}
image.save(outputFilePath, exportOptions);
}
| Constructor and Description |
|---|
PdfOptions()
Initializes a new instance of the
PdfOptions class. |
| Modifier and Type | Method and Description |
|---|---|
SizeF |
getPageSize()
Gets the size of the page.
|
PdfCoreOptions |
getPdfCoreOptions()
The PDF core options
|
PdfDocumentInfo |
getPdfDocumentInfo()
Gets or sets metadata for document.
|
boolean |
isUseOriginalImageResolution()
Gets a value indicating to use the original image DPI resolution
|
boolean |
isUseOriginalImageSize()
Deprecated.
Please use
PdfOptions.isUseOriginalImageResolution() instead. |
void |
setPageSize(SizeF value)
Sets the size of the page.
|
void |
setPdfCoreOptions(PdfCoreOptions value)
The PDF core options
|
void |
setPdfDocumentInfo(PdfDocumentInfo value)
Gets or sets metadata for document.
|
void |
setUseOriginalImageResolution(boolean value)
Sets a value indicating to use the original image DPI resolution
|
void |
setUseOriginalImageSize(boolean useOriginalImageSize)
Deprecated.
Please use
PdfOptions.setUseOriginalImageResolution(boolean) instead. |
deepClone, getBufferSizeHint, getFullFrame, getMultiPageOptions, getPalette, getProgressEventHandler, getResolutionSettings, getSource, getVectorRasterizationOptions, getXmpData, isKeepMetadata, setBufferSizeHint, setFullFrame, setKeepMetadata, setMultiPageOptions, setPalette, setProgressEventHandler, setResolutionSettings, setSource, setVectorRasterizationOptions, setXmpDataclose, dispose, getDisposedpublic PdfOptions()
Initializes a new instance of the PdfOptions class.
public final boolean isUseOriginalImageResolution()
Gets a value indicating to use the original image DPI resolution
Value: Indicator to use the original image DPI resolutionpublic final void setUseOriginalImageResolution(boolean value)
Sets a value indicating to use the original image DPI resolution
Value: Indicator to use the original image DPI resolutionvalue - a value indicating to use the original image DPI resolutionpublic PdfDocumentInfo getPdfDocumentInfo()
Gets or sets metadata for document.
public void setPdfDocumentInfo(PdfDocumentInfo value)
Gets or sets metadata for document.
public PdfCoreOptions getPdfCoreOptions()
The PDF core options
public void setPdfCoreOptions(PdfCoreOptions value)
The PDF core options
public final SizeF getPageSize()
Gets the size of the page.
Value: The size of the page.public final void setPageSize(SizeF value)
Sets the size of the page.
Value: The size of the page.value - the size of the page.@Deprecated public boolean isUseOriginalImageSize()
PdfOptions.isUseOriginalImageResolution() instead.Gets a value indicating to use the original image DPI resolution
Value: Indicator to use the original image DPI resolution@Deprecated public void setUseOriginalImageSize(boolean useOriginalImageSize)
PdfOptions.setUseOriginalImageResolution(boolean) instead.Sets a value indicating to use the original image DPI resolution WILL BE REMOVED SINCE 25.3
Value: Indicator to use the original image DPI resolutionuseOriginalImageSize - a value indicating to use the original image DPI resolutionCopyright (c) 2008-2025 Aspose Pty Ltd. All Rights Reserved.