Adjust page size
GroupDocs.Viewer allows setting output page size for rendering Email messages into HTML, PDF, and images. To enable this feature, the setPageSize(…) property of the EmailOptions class is used. The following are the pages sizes that are supported and provided in setPageSize(…) enumeration:
- PageSize.UNSPECIFIED - The default, unspecified page size
- PageSize.LETTER - The size of the Letter page in points is 792 × 612
- PageSize.LEDGER - The size of the Ledger page in points is 1224 × 792
- PageSize.A0 - The size of the A0 page in points is 3371 × 2384
- PageSize.A1 - The size of the A1 page in points is 2384 × 1685
- PageSize.A2 - The size of the A2 page in points is 1684 × 1190
- PageSize.A3 - The size of the A3 page in points is 1190 × 842
- PageSize.A4 - The size of the A4 page in points is 842 × 595
The following are the steps to set size for email message:
- Create HtmlViewOptions, JpgViewOptions, PngViewOptions or PdfViewOptions object;
- Set setPageSize(…) value;
- Call view(…) method.
Viewer viewer = new Viewer("sample.msg");
PdfViewOptions viewOptions = new PdfViewOptions();
viewOptions.getEmailOptions().setPageSize(PageSize.A4);
viewer.view(viewOptions);
viewer.close();
More resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Viewer for Java examples, plugins, and showcase
- Document Viewer for .NET App WebForms UI Modern Example
- Document Viewer for Java App Dropwizard UI Modern Example
- Document Viewer for Java Spring UI Example
- GroupDocs.Viewer for .NET samples, plugins and showcase
- Document Viewer for .NET MVC UI Example
Free Online App
Along with full-featured Java library we provide simple but powerful free Apps. You are welcome to view Word, PDF, Excel, PowerPoint documents with free to use online GroupDocs Viewer App.