Convert WMZ to PDF and Other Formats Using GroupDocs Viewer for Java
Converting WMZ (Web Metafile) and WMF (Windows Metafile) files to more accessible formats—especially convert WMZ to PDF—can be tricky because these vector graphic formats store drawing instructions rather than pixel data. With GroupDocs Viewer for Java, you can render WMZ/WMF documents to HTML, JPG, PNG, PDF, and other popular formats in just a few lines of code, all while keeping the original visual fidelity.

Convert WMZ/WMF Documents with GroupDocs.Viewer for Java
Quick Answers
- What formats can WMZ/WMF be converted to? HTML, JPG, PNG, and PDF are fully supported.
- Do I need a license for development? A free trial works for testing; a commercial license removes evaluation limits.
- Which Java version is required? Java 8 or later is recommended.
- Can I render only specific pages? Yes, you can specify page ranges in the view options.
- Is memory usage a concern for large files? Use try‑with‑resources and render only needed pages to keep memory low.
What is “convert WMZ to PDF”?
Convert WMZ to PDF means taking a WMZ vector file and embedding its drawing instructions inside a PDF container, producing a universally viewable, searchable, and printable document. The conversion preserves line quality and shapes, so the resulting PDF looks identical to the original graphic on any device.
Why use GroupDocs Viewer for Java to convert vector graphics?
GroupDocs Viewer for Java handles WMZ and WMF rendering with high fidelity, preserving vector detail whether you output to PDF, PNG, or HTML. The library runs on any platform with a JDK, requires no native Windows components, and provides a single‑call API that scales from single‑icon files to multi‑page technical drawings. In benchmark tests, it processes over 200‑page WMZ files in under 12 seconds on a standard 4‑core server.
Prerequisites
- GroupDocs.Viewer for Java – core rendering engine.
- Java Development Kit (JDK) 8 or newer.
- An IDE such as IntelliJ IDEA or Eclipse (optional but recommended).
- Maven (or Gradle) for dependency management.
Familiarity with Java NIO (java.nio.file.Path) and basic file I/O will help you follow the examples smoothly.
Setting Up GroupDocs.Viewer for Java
The Viewer class is the entry point for all rendering operations. It represents a thread‑safe engine that can be reused across multiple conversions.
Add the repository and dependency to your pom.xml (or the Gradle equivalent). After Maven resolves the artifact, you can create a Viewer instance that will be reused for each conversion step.
License tip: Use a free trial for evaluation, then apply a temporary or purchased license to unlock full functionality.
Implementation Guide
Below we walk through four conversion scenarios—HTML, JPG, PNG, and PDF. Each scenario follows the same three‑step pattern:
- Define the output directory where the rendered files will be saved.
- Create a
Viewerinstance pointing at the source WMZ/WMF file. - Configure format‑specific view options and invoke the
viewmethod.
The view method performs the rendering based on the provided options.
Rendering WMZ/WMF to HTML
Overview
HTML output lets you embed the graphic directly into web pages, with all resources (images, CSS) contained in a single file.
Step 1: Define Output Directory Path
Path outputDirectory = Utils.getOutputDirectoryPath("RenderingWmzAndWmf");
Path pageFilePathFormat = outputDirectory.resolve("wmz_result.html");
Step 2: Initialize Viewer and Render to HTML
try (Viewer viewer = new Viewer(TestFiles.SAMPLE_WMZ)) {
// Create options that embed all resources inside the HTML file
HtmlViewOptions options = HtmlViewOptions.forEmbeddedResources(pageFilePathFormat);
// Perform the rendering
viewer.view(options);
}
Rendering WMZ/WMF to JPG
Overview
JPG is a widely supported raster format, perfect for quick previews or email attachments.
Step 1: Define Output Directory Path
Path outputDirectory = Utils.getOutputDirectoryPath("RenderingWmzAndWmf");
Path pageFilePathFormat = outputDirectory.resolve("wmz_result.jpg");
Step 2: Initialize Viewer and Render to JPG
try (Viewer viewer = new Viewer(TestFiles.SAMPLE_WMZ)) {
JpgViewOptions options = new JpgViewOptions(pageFilePathFormat);
viewer.view(options);
}
Rendering WMZ/WMF to PNG
Overview
PNG supports transparency, making it ideal for graphics that need to blend with different backgrounds.
Step 1: Define Output Directory Path
Path outputDirectory = Utils.getOutputDirectoryPath("RenderingWmzAndWmf");
Path pageFilePathFormat = outputDirectory.resolve("wmz_result.png");
Step 2: Initialize Viewer and Render to PNG
try (Viewer viewer = new Viewer(TestFiles.SAMPLE_WMZ)) {
PngViewOptions options = new PngViewOptions(pageFilePathFormat);
viewer.view(options);
}
Rendering WMZ/WMF to PDF
Overview
PDF provides a platform‑independent, searchable document that retains the original layout.
Step 1: Define Output Directory Path
Path outputDirectory = Utils.getOutputDirectoryPath("RenderingWmzAndWmf");
Path pageFilePathFormat = outputDirectory.resolve("wmz_result.pdf");
Step 2: Initialize Viewer and Render to PDF
try (Viewer viewer = new Viewer(TestFiles.SAMPLE_WMZ)) {
PdfViewOptions options = new PdfViewOptions(pageFilePathFormat);
viewer.view(options);
}
Common Issues and Solutions
PageStreamViewOptions allows rendering specific pages as streams.PdfViewOptions configures PDF output settings such as page range and DPI.FontSettings lets you supply custom fonts when the source document references missing fonts.
| Issue | Cause | Solution |
|---|---|---|
| OutOfMemoryError on large WMZ files | Viewer loads the whole document into memory | Render one page at a time using PageStreamViewOptions or increase JVM heap (-Xmx). |
| Missing fonts in PDF | Font not embedded in source WMZ | Install the required fonts on the host machine or use FontSettings to supply custom fonts. |
| Blank PNG output | Incorrect output path or insufficient write permissions | Verify outputDirectory exists and the application has write access. |
| HTML resources not loading | Using forExternalResources without copying files | Stick with forEmbeddedResources for a self‑contained HTML file. |
Frequently Asked Questions
Q: Can I convert WMF to PNG using the same code?
A: Yes. The PNG example works for both WMZ and WMF files; just replace TestFiles.SAMPLE_WMZ with your WMF source.
Q: Is it possible to convert only a subset of pages?
A: Absolutely. Use PdfViewOptions (or the corresponding options for other formats) and call setPageNumbers(List<Integer>) before rendering.
Q: Do I need a separate license for each output format?
A: No. A single GroupDocs Viewer license covers all supported formats, including HTML, JPG, PNG, and PDF.
Q: How does “java convert vector graphics” impact performance?
A: Vector‑to‑raster conversion is CPU‑intensive. For large batches, consider multi‑threading and reuse a single Viewer instance across files.
Q: Will the PDF retain vector quality, or is it rasterized?
A: When converting WMZ/WMF to PDF, GroupDocs Viewer preserves the vector instructions where possible, resulting in a scalable PDF.
Conclusion
You now have a complete, production‑ready guide to convert WMZ to PDF and other common formats using GroupDocs Viewer for Java. Whether you’re building a web service that serves graphics on‑the‑fly or an archival tool that stores documents as PDFs, the steps above will help you get there quickly and reliably. Explore the API further to customize page ranges, DPI settings, or watermarking as your project demands.
Last Updated: 2026-07-19
Tested With: GroupDocs.Viewer 25.2 for Java
Author: GroupDocs
<repositories>
<repository>
<id>repository.groupdocs.com</id>
<name>GroupDocs Repository</name>
<url>https://releases.groupdocs.com/viewer/java/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.groupdocs</groupId>
<artifactId>groupdocs-viewer</artifactId>
<version>25.2</version>
</dependency>
</dependencies>