public class JpgViewOptions extends ViewOptions implements IMaxSizeOptions
The JpgViewOptions class encapsulates additional settings and parameters that can be used to control the rendering of documents into JPG format in the GroupDocs.Viewer component.
Example usage:
JpgViewOptions options = new JpgViewOptions();
options.setMaxWidth(1920);
options.setMaxHeight(1080);
options.setQuality((byte) 96);
options.setRenderComments(true);
try (Viewer viewer = new Viewer("document.docx")) {
viewer.view(options);
// Use the viewer object for further operations
}
Note: The JpgViewOptions class implements the IMaxSizeOptions interface to specify the maximum size of the output JPG images.
Viewer,
ViewOptions,
IMaxSizeOptions| Constructor and Description |
|---|
JpgViewOptions()
Initializes a new instance of
JpgViewOptions with "p_{0}.jpg" as the file path format for the output files. |
JpgViewOptions(CreatePageStream createPageStream)
Initializes a new instance of the
JpgViewOptions class. |
JpgViewOptions(CreatePageStream createPageStream,
ReleasePageStream releasePageStream)
Initializes a new instance of the
JpgViewOptions class. |
JpgViewOptions(PageStreamFactory pageStreamFactory)
Initializes a new instance of the
JpgViewOptions class. |
JpgViewOptions(Path filePathFormat)
Initializes a new instance of the
JpgViewOptions class. |
JpgViewOptions(String filePathFormat)
Initializes a new instance of the
JpgViewOptions class. |
| Modifier and Type | Method and Description |
|---|---|
com.groupdocs.viewer.domain.documents.converting.tohtml.utils.IDocumentSavingCallback |
getDocumentSavingCallback()
Gets the callback to estimate the saving progress of a Words or Email document.
|
int |
getHeight()
Gets the height of the output image in pixels.
|
int |
getMaxHeight()
Gets the maximum height of an output image in pixels.
|
int |
getMaxWidth()
Gets the maximum width of an output image in pixels.
|
PageStreamFactory |
getPageStreamFactory()
Gets the factory that implements methods for creating and releasing the output page stream.
|
byte |
getQuality()
Gets the quality of the output image.
|
int |
getWidth()
Gets the width of the output image in pixels.
|
boolean |
isExtractText()
Enables text extraction.
|
void |
setDocumentSavingCallback(com.groupdocs.viewer.domain.documents.converting.tohtml.utils.IDocumentSavingCallback documentSavingCallback)
Sets the callback to estimate the saving progress of a Words or Email document.
|
void |
setExtractText(boolean value)
Enables or disables text extraction.
|
void |
setHeight(int value)
Sets the height of the output image in pixels.
|
void |
setMaxHeight(int maxHeight)
Sets the maximum height of an output image in pixels.
|
void |
setMaxWidth(int maxWidth)
Sets the maximum width of an output image in pixels.
|
void |
setQuality(byte value)
Sets the quality of the output image.
|
void |
setWidth(int value)
Sets the width of the output image in pixels.
|
getPageRotations, getWatermark, isPageRotationsInitialized_Internal, rotatePage, setWatermarkgetArchiveOptions, getCadOptions, getDefaultFontName, getEmailOptions, getMailStorageOptions, getOutlookOptions, getPdfOptions, getPresentationOptions, getProjectManagementOptions, getSpreadsheetOptions, getTextOptions, getVisioRenderingOptions, getWebDocumentOptions, getWordProcessingOptions, isCadOptionsInitialized_Internal, isRemoveComments, isRenderComments, isRenderHiddenPages, isRenderNotes, setArchiveOptions, setCadOptions, setDefaultFontName, setEmailOptions, setMailStorageOptions, setOutlookOptions, setPdfOptions, setPresentationOptions, setProjectManagementOptions, setRemoveComments, setRenderComments, setRenderHiddenPages, setRenderNotes, setSpreadsheetOptions, setTextOptions, setVisioRenderingOptions, setWebDocumentOptions, setWordProcessingOptionspublic JpgViewOptions()
Initializes a new instance of JpgViewOptions with "p_{0}.jpg" as the file path format for the output files.
The output files will be placed into the current working directory of the application.
For the code example, see the documentation.
public JpgViewOptions(CreatePageStream createPageStream)
Initializes a new instance of the JpgViewOptions class.
For the code example, see the documentation.
createPageStream - The method that instantiates the stream used to write the output page data.IllegalArgumentException - If the createPageStream parameter is null.CreatePageStreampublic JpgViewOptions(CreatePageStream createPageStream, ReleasePageStream releasePageStream)
Initializes a new instance of the JpgViewOptions class.
For the code example, see the documentation.
createPageStream - The method that instantiates the stream used to write the output page data.releasePageStream - The method that releases the stream created by the method assigned to the delegate passed to the createPageStream parameter.IllegalArgumentException - If the createPageStream or releasePageStream parameters are null.CreatePageStreampublic JpgViewOptions(PageStreamFactory pageStreamFactory)
Initializes a new instance of the JpgViewOptions class.
For the code example, see the documentation.
pageStreamFactory - The factory that implements methods for creating and releasing the output page stream.IllegalArgumentException - If the pageStreamFactory parameter is null.PageStreamFactorypublic JpgViewOptions(Path filePathFormat)
Initializes a new instance of the JpgViewOptions class.
For the code example, see the documentation.
filePathFormat - The file path format, e.g., 'page_{0}.jpg'.IllegalArgumentException - If the filePathFormat parameter is null or empty.public JpgViewOptions(String filePathFormat)
Initializes a new instance of the JpgViewOptions class.
For the code example, see the documentation.
filePathFormat - The file path format, e.g., 'page_{0}.jpg'.IllegalArgumentException - If the filePathFormat parameter is null or empty.public com.groupdocs.viewer.domain.documents.converting.tohtml.utils.IDocumentSavingCallback getDocumentSavingCallback()
Gets the callback to estimate the saving progress of a Words or Email document.
IDocumentSavingCallbackpublic final int getHeight()
Gets the height of the output image in pixels.
Use this property to set the output image height (in pixels). For code example, see the documentation.
If you set this property, the setMaxHeight(int) property is ignored.
public int getMaxHeight()
Gets the maximum height of an output image in pixels.
Use this property to set the maximum output image height (in pixels). For code example, see the documentation.
If you set the setHeight(int) property, this property is ignored.
getMaxHeight in interface IMaxSizeOptionspublic int getMaxWidth()
Gets the maximum width of an output image in pixels.
Use this property to set the maximum output image width (in pixels). For code example, see the documentation.
If you set the setWidth(int) property, this property is ignored.
getMaxWidth in interface IMaxSizeOptionspublic final PageStreamFactory getPageStreamFactory()
PageStreamFactorypublic final byte getQuality()
Gets the quality of the output image.
Note: Use this property to adjust images quality. The value must be between 1 (minimum quality) and 100. The default value is 90. For code example, see the documentation.
public final int getWidth()
Gets the width of the output image in pixels.
Use this property to set the output image width (in pixels). For code example, see the documentation.
If you set this property, the setMaxWidth(int) property is ignored.
public final boolean isExtractText()
Enables text extraction.
Note: Use this property to get the text contained in a source document and its coordinates. Then you can use this data to add a selectable text over the image or to implement a text search in image-based rendering. For code example, see the documentation.
true if text extraction is enabled, false otherwise.public void setDocumentSavingCallback(com.groupdocs.viewer.domain.documents.converting.tohtml.utils.IDocumentSavingCallback documentSavingCallback)
Sets the callback to estimate the saving progress of a Words or Email document.
documentSavingCallback - The callback to estimate the document saving progress.IDocumentSavingCallbackpublic final void setExtractText(boolean value)
Enables or disables text extraction.
Note: Use this property to get the text contained in a source document and its coordinates. Then you can use this data to add a selectable text over the image or to implement a text search in image-based rendering. For code example, see the documentation.
value - true to enable text extraction, false to disable it.public final void setHeight(int value)
Sets the height of the output image in pixels.
Use this property to set the output image height (in pixels). For code example, see the documentation.
If you set this property, the setMaxHeight(int) property is ignored.
value - The height of the output image.public void setMaxHeight(int maxHeight)
Sets the maximum height of an output image in pixels.
Use this property to set the maximum output image height (in pixels). For code example, see the documentation.
If you set the setHeight(int) property, this property is ignored.
setMaxHeight in interface IMaxSizeOptionsmaxHeight - The maximum height of an output image.public void setMaxWidth(int maxWidth)
Sets the maximum width of an output image in pixels.
Use this property to set the maximum output image width (in pixels). For code example, see the documentation.
If you set the setWidth(int) property, this property is ignored.
setMaxWidth in interface IMaxSizeOptionsmaxWidth - The maximum width of an output image.public final void setQuality(byte value)
Sets the quality of the output image.
Note: Use this property to adjust images quality. The value must be between 1 (minimum quality) and 100. The default value is 90. For code example, see the documentation.
value - The quality of the output image.public final void setWidth(int value)
Sets the width of the output image in pixels.
Use this property to set the output image width (in pixels). For code example, see the documentation.
If you set this property, the setMaxWidth(int) property is ignored.
value - The width of the output image.Copyright © 2025. All rights reserved.