Μετατροπή PST σε HTML, JPG, PNG, PDF χρησιμοποιώντας το GroupDocs.Viewer για Java

Αναζητάτε να convert pst to html ή άλλες μορφές όπως JPG, PNG ή PDF; Με τη δυναμική βιβλιοθήκη GroupDocs.Viewer for Java, αυτή η εργασία είναι απλή και αποδοτική. Σε αυτό το σεμινάριο θα μάθετε πώς να αποδίδετε αρχεία Outlook PST/OST σε φιλικό προς το web HTML, αρχεία εικόνας ή ένα ενιαίο PDF, καθιστώντας τα αρχεία email σας εύκολα προς κοινή χρήση και αρχειοθέτηση.

Μετατροπή PST/OST σε HTML, JPG, PNG, PDF με το GroupDocs.Viewer για Java

Μετατροπή PST/OST σε HTML, JPG, PNG, PDF με το GroupDocs.Viewer για Java

Τι θα μάθετε

  • Πώς να ρυθμίσετε το GroupDocs.Viewer for Java σε ένα έργο Maven.
  • Οδηγίες βήμα‑βήμα για java convert pst αρχεία σε HTML, JPG, PNG και PDF.
  • Συμβουλές διαμόρφωσης για βέλτιστη απόδοση και κοινά προβλήματα.

Γρήγορες Απαντήσεις

  • What library handles PST conversion? GroupDocs.Viewer for Java.
  • Can I convert PST to PDF directly? Yes, using PdfViewOptions.
  • Is a license required for production? A valid GroupDocs license is needed.
  • Which Java version is supported? JDK 8 or higher.
  • Do I need to extract attachments manually? No, the viewer renders them automatically.

Τι είναι το GroupDocs.Viewer για Java;

Το GroupDocs.Viewer για Java είναι ένα API διακομιστή‑πλευράς που φορτώνει πάνω από 100 μορφές εγγράφων και email και τα αποδίδει σε HTML, εικόνα ή PDF χωρίς εξωτερικό λογισμικό. Επεξεργάζεται αρχεία PST έως 2 GB διατηρώντας τη χρήση μνήμης κάτω από 200 MB.

Πώς να μετατρέψετε pst σε html χρησιμοποιώντας το GroupDocs.Viewer για Java;

Φορτώστε το αρχείο PST με new Viewer("source.pst"), διαμορφώστε το HtmlViewOptions ώστε να δείχνει σε φάκελο εξόδου και καλέστε viewer.view(htmlOptions). Το API εξάγει κάθε email, διατηρεί τη μορφοποίηση, τα συνημμένα και τα μεταδεδομένα, και γράφει ξεχωριστή σελίδα HTML για κάθε μήνυμα — όλα σε μία κλήση μεθόδου.

Γιατί να επιλέξετε το GroupDocs.Viewer;

  • High‑fidelity rendering – 99.9 % of email content (including rich‑text bodies, tables, and embedded images) is reproduced accurately.
  • Multiple output formats – One API call can generate HTML, JPG, PNG, or PDF, covering 50+ export options.
  • Zero external dependencies – No need for Outlook, Exchange Server, or third‑party converters; everything runs inside your Java runtime.

Προαπαιτούμενα

  • GroupDocs.Viewer for Java – version 25.2 or later.
  • Java Development Kit (JDK) – 8 or newer.
  • Maven for dependency management.
  • Basic Java knowledge and familiarity with Maven.

Ρύθμιση του GroupDocs.Viewer για Java

Viewer είναι η βασική κλάση στο GroupDocs.Viewer για Java που φορτώνει ένα έγγραφο και το αποδίδει στη επιλεγμένη μορφή. Προσθέστε το αποθετήριο GroupDocs και την εξάρτηση στο pom.xml σας:

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

Απόκτηση Άδειας

  • Free trial – explore all features without cost.
  • Temporary license – extend evaluation time if needed.
  • Full license – required for production deployments.

Βασική Αρχικοποίηση

Viewer instances are lightweight; you can reuse a single instance for many files to minimise object‑creation overhead.

import com.groupdocs.viewer.Viewer;
import com.groupdocs.viewer.options.HtmlViewOptions;

public class PSTToHTML {
    public static void main(String[] args) {
        // Initialize Viewer with a sample PST file path
        try (Viewer viewer = new Viewer("YOUR_DOCUMENT_DIRECTORY/SAMPLE_PST")) {
            HtmlViewOptions options = HtmlViewOptions.forEmbeddedResources("output_directory/PST_result.html");
            viewer.view(options);
        }
    }
}

Οδηγός Υλοποίησης

The following sections walk you through rendering PST/OST files into each supported format.

Απόδοση εγγράφων PST/OST σε HTML

Βήμα 1: Ρύθμιση φακέλου εξόδου

Define a folder where the HTML pages will be written. GroupDocs creates a sub‑folder for each email to keep assets organized.

Path outputDirectory = Paths.get("YOUR_OUTPUT_DIRECTORY");
Path pageFilePathFormat = outputDirectory.resolve("PST_result.html");

Βήμα 2: Διαμόρφωση επιλογών φόρτωσης

LoadOptions lets you specify password handling, resource‑loading timeouts, and selective page rendering. Setting a timeout of 30 seconds works well for most server environments.

LoadOptions loadOptions = new LoadOptions();
loadOptions.setResourceLoadingTimeout(100);

Βήμα 3: Ορισμός επιλογών προβολής HTML

HtmlViewOptions specifies the output folder, resource handling, and optional CSS settings for HTML conversion.

try (Viewer viewer = new Viewer("YOUR_DOCUMENT_DIRECTORY/SAMPLE_PST", loadOptions)) {
    HtmlViewOptions options = HtmlViewOptions.forEmbeddedResources(pageFilePathFormat);
    viewer.view(options);
}

Βήμα 4: Αρχικοποίηση Viewer και απόδοση HTML

Create a Viewer object, pass the PST file path, and call view with the HtmlViewOptions. The API automatically iterates through all messages inside the PST and generates a tidy HTML hierarchy.

try (Viewer viewer = new Viewer("YOUR_DOCUMENT_DIRECTORY/SAMPLE_PST", loadOptions)) {
    HtmlViewOptions options = HtmlViewOptions.forEmbeddedResources(pageFilePathFormat);
    viewer.view(options);
}

Απόδοση εγγράφων PST/OST σε JPG

Βήμα 1: Ρύθμιση φακέλου εξόδου

Create a dedicated folder for JPG snapshots; each email will become one or more image files depending on its length.

Path outputDirectory = Paths.get("YOUR_OUTPUT_DIRECTORY");
Path pageFilePathFormat = outputDirectory.resolve("PST_result_{0}.jpg");

Βήμα 2: Διαμόρφωση επιλογών φόρτωσης

The same LoadOptions used for HTML can be reused here, ensuring consistent password handling across formats.

LoadOptions loadOptions = new LoadOptions();
loadOptions.setResourceLoadingTimeout(100);

Βήμα 3: Ορισμός επιλογών προβολής JPG

JpgViewOptions controls image resolution, quality, and output folder for JPEG conversion.

try (Viewer viewer = new Viewer("YOUR_DOCUMENT_DIRECTORY/SAMPLE_PST", loadOptions)) {
    JpgViewOptions options = new JpgViewOptions(pageFilePathFormat);
    viewer.view(options);
}

Βήμα 4: Αρχικοποίηση Viewer και απόδοση JPG

Use viewer.view(jpgOptions) to generate high‑quality JPEG files ready for web preview.

try (Viewer viewer = new Viewer("YOUR_DOCUMENT_DIRECTORY/SAMPLE_PST", loadOptions)) {
    JpgViewOptions options = new JpgViewOptions(pageFilePathFormat);
    viewer.view(options);
}

Απόδοση εγγράφων PST/OST σε PNG

Βήμα 1: Ρύθμιση φακέλου εξόδου

PNG output is useful when you need lossless quality for archiving or OCR processing.

Path outputDirectory = Paths.get("YOUR_OUTPUT_DIRECTORY");
Path pageFilePathFormat = outputDirectory.resolve("PST_result_{0}.png");

Βήμα 2: Διαμόρφωση επιλογών φόρτωσης

No additional settings are required beyond the password and timeout configuration.

LoadOptions loadOptions = new LoadOptions();
loadOptions.setResourceLoadingTimeout(100);

Βήμα 3: Ορισμός επιλογών προβολής PNG

PngViewOptions allows you to set a transparent background and output folder for lossless PNG images.

try (Viewer viewer = new Viewer("YOUR_DOCUMENT_DIRECTORY/SAMPLE_PST", loadOptions)) {
    PngViewOptions options = new PngViewOptions(pageFilePathFormat);
    viewer.view(options);
}

Βήμα 4: Αρχικοποίηση Viewer και απόδοση PNG

Instantiate viewer.view(pngOptions) to produce PNG snapshots of each email.

try (Viewer viewer = new Viewer("YOUR_DOCUMENT_DIRECTORY/SAMPLE_PST", loadOptions)) {
    PngViewOptions options = new PngViewOptions(pageFilePathFormat);
    viewer.view(options);
}

Απόδοση εγγράφων PST/OST σε PDF

Βήμα 1: Ρύθμιση φακέλου εξόδου

A single PDF file per PST simplifies legal‑review workflows and reduces storage overhead.

Path outputDirectory = Paths.get("YOUR_OUTPUT_DIRECTORY");
Path pageFilePathFormat = outputDirectory.resolve("PST_result.pdf");

Βήμα 2: Διαμόρφωση επιλογών φόρτωσης

When converting to PDF, you may want to enable setEmbedFonts(true) to guarantee visual fidelity on any machine.

LoadOptions loadOptions = new LoadOptions();
loadOptions.setResourceLoadingTimeout(100);

Βήμα 3: Ορισμός επιλογών προβολής PDF

PdfViewOptions lets you choose compression level, embed fonts, and set the output file name for PDF conversion.

try (Viewer viewer = new Viewer("YOUR_DOCUMENT_DIRECTORY/SAMPLE_PST", loadOptions)) {
    PdfViewOptions options = new PdfViewOptions(pageFilePathFormat);
    viewer.view(options);
}

Βήμα 4: Αρχικοποίηση Viewer και απόδοση PDF

Create PdfViewOptions, optionally choose a compression level, and call viewer.view(pdfOptions). The API merges all emails into one searchable PDF document.

try (Viewer viewer = new Viewer("YOUR_DOCUMENT_DIRECTORY/SAMPLE_PST", loadOptions)) {
    PdfViewOptions options = new PdfViewOptions(pageFilePathFormat);
    viewer.view(options);
}

Πρακτικές Εφαρμογές

  • Email Archiving: Μετατρέψτε μεγάλα αρχεία PST σε αναζητήσιμο HTML ή PDF για συμμόρφωση.
  • Document Management Systems: Αποθηκεύστε τα μετατρεπόμενα αρχεία σε συστήματα που δέχονται μόνο PDF, PNG ή JPG.
  • Collaboration Platforms: Μοιραστείτε τα μετατρεπόμενα email ως εικόνες στο Slack ή Teams.
  • Legal Review: Παρέχετε στα δικαστήρια PDF εκδόσεις των αποδεικτικών email.
  • Backup Strategies: Διατηρήστε ελαφριές στιγμιότυπες PNG ή JPG κρίσιμων μηνυμάτων.

Παραμέτρους Απόδοσης

  • Resource Management: Reuse Viewer instances when processing multiple files to reduce overhead.
  • Memory Tuning: Adjust loadOptions.setResourceLoadingTimeout based on server capacity.
  • Asynchronous Processing: Offload conversion to background threads for responsive UIs.

Συχνές Ερωτήσεις

Q: Πώς μπορώ να convert pst to pdf με την ίδια βάση κώδικα;
A: Use PdfViewOptions as shown in the PDF rendering section; the rest of the code remains identical.

Q: Can GroupDocs.Viewer handle encrypted PST files?
A: Yes, provide the password via LoadOptions.setPassword("yourPassword") before rendering.

Q: What is the difference between java convert pst to PNG vs JPG?
A: PNG preserves lossless quality, ideal for screenshots, while JPG offers smaller file sizes for email previews.

Q: Is there a way to how to convert pst files in bulk?
A: Wrap the rendering logic in a loop that iterates over a directory of PST files; reuse the same Viewer configuration for each file.

Q: Does the API support converting PST files larger than 1 GB?
A: Yes, GroupDocs.Viewer streams data and can process files up to 2 GB without loading the entire archive into memory.

Συμπέρασμα

You now have a complete, production‑ready guide to convert pst to html, JPG, PNG, and PDF using GroupDocs.Viewer for Java. By following the steps above you can integrate email conversion into any Java‑based workflow, improve accessibility, and meet compliance requirements.


Τελευταία Ενημέρωση: 2026-07-19
Δοκιμάστηκε Με: GroupDocs.Viewer for Java 25.2
Συγγραφέας: GroupDocs

Σχετικά Μαθήματα