How to custom the DPI when render .docx/.xlsx etc to PNG/JPG

Hi,

I found the DPI(resolution) of text is a little bit too low, How can I increase it?

Thanks & Regards
Aray

Hi @ArayCN

For the most accurate answer we need a little bit more info from you, because the answer on your question depends on what exact document format you want to process with the GroupDocs.Viewer. In general, there is no some single option, common for all formats, which is responsible for the DPI ā€” every format family is unique and thus has its own options. Some format families allow to specify the DPI, while another ā€” do not. But, basically, all four view options, including the JpgViewOptions and PngViewOptions (responsible for saving input document to the JPEG and PNG formats respectively) are inherited from the ViewOptions abstract class, which, in turn, is inherited from another BaseViewOptions abstract class. And the BaseViewOptions contains format-specific options, where for some formats the DPI can be found and specified.

In particular, for the Spreadsheet it is a PresentationOptions.Resolution property (more on this here), for PDF it is a PdfOptions.ImageQuality property (more on this here and here), and so on. In some cases, like for WordProcessing format family (DOC, DOCX, DOCM, RTF etc) in order to increase the output image quality you need to enlarge the dimensions of the output image files (see here). Also when output image format is JPEG, there is a JpgViewOptions.Quality property.

P.S. Regarding the answer from the Professionalize.Discourse bot, located above - please ignore it. The API, provided by the bot in its source code sample, does not exist, so those code will not compile at all.

With best regards,
Denis

Hi @Professionalize.Discourse

Thank you. But I did not find any DPI property in PngViewOptions & JpgViewOptions, including the setter setDpi.

I use Java version of groupdocs-viewer 24.8.

Thanks & Regards.
Aray

@ArayCN

Iā€™m sorry for the inconvenience. There is no DPI property. This response was generated by our AI agent Professionalize.Discourse that should help with providing suggestions but sometimes it produces unexpected output like in this case.

Let me remove this post to avoid further confusion.