public class PngViewOptions extends ViewOptions implements IMaxSizeOptions
The PngViewOptions class encapsulates additional settings and parameters that can be used to control the rendering of documents into PNG format in the GroupDocs.Viewer component.
Example usage:
PngViewOptions options = new PngViewOptions();
options.setHeight(1080);
options.setWidth(1920);
options.setRenderComments(true);
options.setRenderComments(true);
try (Viewer viewer = new Viewer("document.docx")) {
viewer.view(options);
// Use the viewer object for further operations
}
Note: The PngViewOptions class implements the IMaxSizeOptions interface to specify the maximum size of the output PNG images. For details, see this page and its children.
Viewer,
ViewOptions,
IMaxSizeOptions| Constructor and Description |
|---|
PngViewOptions()
Initializes new instance of
PngViewOptions class. |
PngViewOptions(CreatePageStream createPageStream)
Initializes a new instance of the
PngViewOptions class. |
PngViewOptions(CreatePageStream createPageStream,
ReleasePageStream releasePageStream)
Initializes a new instance of the
PngViewOptions class. |
PngViewOptions(PageStreamFactory pageStreamFactory)
Initializes a new instance of the
PngViewOptions class. |
PngViewOptions(Path filePathFormat)
Initializes a new instance of the
PngViewOptions class. |
PngViewOptions(String filePathFormat)
Initializes a new instance of the
PngViewOptions class. |
| Modifier and Type | Method and Description |
|---|---|
com.groupdocs.viewer.domain.documents.converting.tohtml.utils.IDocumentSavingCallback |
getDocumentSavingCallback()
Retrieves the callback for estimating the saving progress of a document.
|
int |
getHeight()
Returns the height of the output image in pixels.
|
int |
getMaxHeight()
Returns the maximum height of an output image in pixels.
|
int |
getMaxWidth()
Returns the maximum width of an output image in pixels.
|
int |
getWidth()
Returns the width of the output image in pixels.
|
boolean |
isExtractText()
Determines whether text extraction is enabled.
|
void |
setDocumentSavingCallback(com.groupdocs.viewer.domain.documents.converting.tohtml.utils.IDocumentSavingCallback documentSavingCallback)
Sets the callback for estimating the saving progress of a 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 |
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, isRenderComments, isRenderHiddenPages, isRenderNotes, setArchiveOptions, setCadOptions, setDefaultFontName, setEmailOptions, setMailStorageOptions, setOutlookOptions, setPdfOptions, setPresentationOptions, setProjectManagementOptions, setRenderComments, setRenderHiddenPages, setRenderNotes, setSpreadsheetOptions, setTextOptions, setVisioRenderingOptions, setWebDocumentOptions, setWordProcessingOptionspublic PngViewOptions()
Initializes new instance of PngViewOptions class.
This constructor initializes new instance of PngViewOptions
with "p_{0}.png" as file path format for the output files.
The output files will be placed into current working directory of the application.
For the code example, see the documentation.
public PngViewOptions(CreatePageStream createPageStream)
Initializes a new instance of the PngViewOptions class.
For the code example, see the documentation.
createPageStream - The method that instantiates the stream used to write the output page data.public PngViewOptions(CreatePageStream createPageStream, ReleasePageStream releasePageStream)
Initializes a new instance of the PngViewOptions 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 createPageStream parameter.public PngViewOptions(PageStreamFactory pageStreamFactory)
Initializes a new instance of the PngViewOptions class.
For the code example, see the documentation.
pageStreamFactory - The factory that implements methods for creating and releasing the output page stream.IllegalArgumentException - Thrown when pageStreamFactory is null.public PngViewOptions(Path filePathFormat)
Initializes a new instance of the PngViewOptions class.
For example, if the file path format is 'page_{0}.png', the output files will be named as 'page_1.png', 'page_2.png', and so on, based on the page number. For the code example, see the documentation.
filePathFormat - The file path format, e.g., 'page_{0}.png'.IllegalArgumentException - Thrown when the filePathFormat is null or empty.public PngViewOptions(String filePathFormat)
Initializes a new instance of the PngViewOptions class.
For example, if the file path format is 'page_{0}.png', the output files will be named as 'page_1.png', 'page_2.png', and so on, based on the page number.
Note: It is important to note that the output files will be placed into the current working directory of the application. For the code example, see the documentation.
filePathFormat - The file path format, e.g., 'page_{0}.png'.IllegalArgumentException - Thrown when the filePathFormat is null or empty.public com.groupdocs.viewer.domain.documents.converting.tohtml.utils.IDocumentSavingCallback getDocumentSavingCallback()
Retrieves the callback for estimating the saving progress of a document.
public final int getHeight()
Returns 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
public int getMaxHeight()
Returns 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
getMaxHeight in interface IMaxSizeOptionspublic int getMaxWidth()
Returns 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
getMaxWidth in interface IMaxSizeOptionspublic final int getWidth()
Returns 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
public final boolean isExtractText()
Determines whether text extraction is enabled.
This option might be useful when you want to add a selectable text layer over the image. 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 for estimating the saving progress of a document.
documentSavingCallback - The callback to estimate the document saving progress.public final void setExtractText(boolean value)
Enables or disables text extraction.
This option might be useful when you want to add a selectable text layer over the image.
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
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
setMaxHeight in interface IMaxSizeOptionsmaxHeight - The maximum height of the 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
setMaxWidth in interface IMaxSizeOptionsmaxWidth - The maximum width 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
value - The width of the output image.Copyright © 2024. All rights reserved.