JpgViewOptions

Inheritance: java.lang.Object, com.groupdocs.viewer.options.BaseViewOptions, com.groupdocs.viewer.options.ViewOptions

All Implemented Interfaces: com.groupdocs.viewer.options.IMaxSizeOptions

public class JpgViewOptions extends ViewOptions implements IMaxSizeOptions

Provides options for rendering documents into JPG format.

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.

Constructors

Constructor Description
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() Initializes a new instance of JpgViewOptions with “p_{0}.jpg” as the file path format for the output files.
JpgViewOptions(String filePathFormat) Initializes a new instance of the JpgViewOptions class.
JpgViewOptions(Path filePathFormat) Initializes a new instance of the JpgViewOptions class.

Methods

Method Description
getMaxWidth() Gets the maximum width of an output image in pixels.
setMaxWidth(int maxWidth) Sets the maximum width of an output image in pixels.
getMaxHeight() Gets the maximum height of an output image in pixels.
setMaxHeight(int maxHeight) Sets the maximum height of an output image in pixels.
getQuality() Gets the quality of the output image.
setQuality(byte value) Sets the quality of the output image.
isExtractText() Enables text extraction.
setExtractText(boolean value) Enables or disables text extraction.
getWidth() Gets the width of the output image in pixels.
setWidth(int value) Sets the width of the output image in pixels.
getHeight() Gets the height of the output image in pixels.
setHeight(int value) Sets the height of the output image in pixels.
getPageStreamFactory() Gets the factory that implements methods for creating and releasing the output page stream.
getDocumentSavingCallback() Gets the callback to estimate the saving progress of a Words or Email document.
setDocumentSavingCallback(IDocumentSavingCallback documentSavingCallback) Sets the callback to estimate the saving progress of a Words or Email document.

JpgViewOptions(CreatePageStream createPageStream)

public JpgViewOptions(CreatePageStream createPageStream)

Initializes a new instance of the JpgViewOptions class.

For the code example, see the documentation.

Parameters:

Parameter Type Description
createPageStream CreatePageStream The method that instantiates the stream used to write the output page data.

JpgViewOptions(CreatePageStream createPageStream, ReleasePageStream releasePageStream)

public JpgViewOptions(CreatePageStream createPageStream, ReleasePageStream releasePageStream)

Initializes a new instance of the JpgViewOptions class.

For the code example, see the documentation.

Parameters:

Parameter Type Description
createPageStream CreatePageStream The method that instantiates the stream used to write the output page data.
releasePageStream ReleasePageStream The method that releases the stream created by the method assigned to the delegate passed to the createPageStream parameter.

JpgViewOptions(PageStreamFactory pageStreamFactory)

public JpgViewOptions(PageStreamFactory pageStreamFactory)

Initializes a new instance of the JpgViewOptions class.

For the code example, see the documentation.

Parameters:

Parameter Type Description
pageStreamFactory PageStreamFactory The factory that implements methods for creating and releasing the output page stream.

JpgViewOptions()

public 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.

JpgViewOptions(String filePathFormat)

public JpgViewOptions(String filePathFormat)

Initializes a new instance of the JpgViewOptions class.

For the code example, see the documentation.

Parameters:

Parameter Type Description
filePathFormat java.lang.String The file path format, e.g., ‘page_{0}.jpg’.

JpgViewOptions(Path filePathFormat)

public JpgViewOptions(Path filePathFormat)

Initializes a new instance of the JpgViewOptions class.

For the code example, see the documentation.

Parameters:

Parameter Type Description
filePathFormat java.nio.file.Path The file path format, e.g., ‘page_{0}.jpg’.

getMaxWidth()

public 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).setWidth(int) property, this property is ignored.

Returns: int - the maximum width of an output image.

setMaxWidth(int maxWidth)

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).setWidth(int) property, this property is ignored.

Parameters:

Parameter Type Description
maxWidth int The maximum width of an output image.

getMaxHeight()

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).setHeight(int) property, this property is ignored.

Returns: int - the maximum height of an output image.

setMaxHeight(int maxHeight)

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).setHeight(int) property, this property is ignored.

Parameters:

Parameter Type Description
maxHeight int The maximum height of an output image.

getQuality()

public 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.

Returns: byte - the quality of the output image.

setQuality(byte value)

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.

Parameters:

Parameter Type Description
value byte The quality of the output image.

isExtractText()

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.

Returns: boolean - true if text extraction is enabled, false otherwise.

setExtractText(boolean value)

public 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.

Parameters:

Parameter Type Description
value boolean true to enable text extraction, false to disable it.

getWidth()

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).setMaxWidth(int) property is ignored.

Returns: int - the width of the output image.

setWidth(int value)

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).setMaxWidth(int) property is ignored.

Parameters:

Parameter Type Description
value int The width of the output image.

getHeight()

public 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).setMaxHeight(int) property is ignored.

Returns: int - the height of the output image.

setHeight(int value)

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).setMaxHeight(int) property is ignored.

Parameters:

Parameter Type Description
value int The height of the output image.

getPageStreamFactory()

public final PageStreamFactory getPageStreamFactory()

Gets the factory that implements methods for creating and releasing the output page stream.

Returns: PageStreamFactory - the factory for the output page stream.

getDocumentSavingCallback()

public IDocumentSavingCallback getDocumentSavingCallback()

Gets the callback to estimate the saving progress of a Words or Email document.

Returns: com.groupdocs.viewer.domain.documents.converting.tohtml.utils.IDocumentSavingCallback - the callback to estimate the document saving progress.

setDocumentSavingCallback(IDocumentSavingCallback documentSavingCallback)

public void setDocumentSavingCallback(IDocumentSavingCallback documentSavingCallback)

Sets the callback to estimate the saving progress of a Words or Email document.

Parameters:

Parameter Type Description
documentSavingCallback com.groupdocs.viewer.domain.documents.converting.tohtml.utils.IDocumentSavingCallback The callback to estimate the document saving progress.