groupdocs watermark maven – Zarządzanie znakami wodnymi diagramów w Javie

Zarządzanie znakami wodnymi w dokumentach jest niezbędne do ochrony własności intelektualnej i utrzymania integralności dokumentu. W tym samouczku pokażemy, jak używać groupdocs watermark maven do efektywnego ładowania, wyszukiwania i usuwania znaków wodnych z plików diagramów, takich jak .vsdx. Niezależnie od tego, czy tworzysz oprogramowanie korporacyjne, czy automatyzujesz przepływy pracy z dokumentami, opanowanie tych technik da Ci pełną kontrolę nad zarządzaniem znakami wodnymi diagramów.

Szybkie odpowiedzi

  • Jakiej biblioteki potrzebujesz? GroupDocs.Watermark for Java (available via Maven).
  • Jakie formaty diagramów są obsługiwane?.vsdx, .vdx, and other Visio formats.
  • Czy mogę wyszukiwać zarówno tekstowe, jak i graficzne znaki wodne? Yes – combine search criteria with or().
  • Czy wymagana jest licencja do produkcji? A valid GroupDocs.Watermark license is required.
  • Jak zintegrować to z Maven? Add the repository and dependency shown below.

Co to jest groupdocs watermark maven?

groupdocs watermark maven odnosi się do integracji opartej na Maven biblioteki GroupDocs.Watermark dla Javy. Deklarując bibliotekę w swoim pom.xml, Maven automatycznie rozwiązuje wszystkie wymagane pliki binarne, pozwalając skupić się na kodzie, który ładuje diagramy, wyszukuje znaki wodne i usuwa je programowo.

Dlaczego warto używać GroupDocs.Watermark do zarządzania znakami wodnymi diagramów?

  • Pełnofunkcyjne API – supports text, image, and shape watermarks across many diagram types.
  • Precyzyjne usuwanie – eliminates watermarks without corrupting the original diagram layout.
  • Skalowalne – suitable for batch processing large collections of diagrams.
  • Przyjazne Maven – simple dependency management, keeping your project clean.

Wymagania wstępne

  1. Java Development Kit (JDK) 8+ – ensures compatibility with the library.
  2. IDE – IntelliJ IDEA, Eclipse, or any Java‑compatible editor.
  3. GroupDocs.Watermark for Java – added via Maven (recommended) or direct JAR download.

Wymagane biblioteki i zależności

Konfiguracja Maven

Add the following configuration to your pom.xml file:

<repositories>
   <repository>
      <id>repository.groupdocs.com</id>
      <name>GroupDocs Repository</name>
      <url>https://releases.groupdocs.com/watermark/java/</url>
   </repository>
</repositories>

<dependencies>
   <dependency>
      <groupId>com.groupdocs</groupId>
      <artifactId>groupdocs-watermark</artifactId>
      <version>24.11</version>
   </dependency>
</dependencies>

Bezpośrednie pobranie

Alternatywnie pobierz najnowszą wersję z GroupDocs.Watermark for Java releases.

Uzyskanie licencji

  • Free Trial: Test the library with a trial license.
  • Temporary License: Request a short‑term key for evaluation.
  • Purchase: Obtain a production license for unlimited use.

Używanie groupdocs watermark maven do ładowania dokumentu diagramu

Ładowanie dokumentu diagramu jest pierwszym krokiem przed jakąkolwiek operacją na znakach wodnych. Poniżej znajduje się minimalny przykład, który tworzy instancję Watermarker z DiagramLoadOptions.

import com.groupdocs.watermark.Watermarker;
import com.groupdocs.watermark.options.DiagramLoadOptions;

public class LoadDiagramDocument {
    public static void main(String[] args) {
        String inputFilePath = "YOUR_DOCUMENT_DIRECTORY/diagram.vsdx";
        DiagramLoadOptions loadOptions = new DiagramLoadOptions();
        
        Watermarker watermarker = new Watermarker(inputFilePath, loadOptions);
        watermarker.close();
    }
}
  • Parameters:
    • inputFilePath – path to your .vsdx file.
    • loadOptions – lets you control how the diagram is parsed (e.g., password protection).

Wyszukiwanie znaków wodnych przy użyciu groupdocs watermark maven

Tekstowe znaki wodne

To locate text‑based watermarks, define a TextSearchCriteria and query the first page of the diagram.

import com.groupdocs.watermark.Watermarker;
import com.groupdocs.watermark.contents.DiagramContent;
import com.groupdocs.watermark.search.TextSearchCriteria;
import com.groupdocs.watermark.search.PossibleWatermarkCollection;

public class SearchTextWatermarks {
    public static void main(String[] args) throws Exception {
        String inputFilePath = "YOUR_DOCUMENT_DIRECTORY/diagram.vsdx";
        Watermarker watermarker = new Watermarker(inputFilePath);

        DiagramContent content = watermarker.getContent(DiagramContent.class);
        
        TextSearchCriteria textSearchCriteria = new TextSearchCriteria("Company Name");
        PossibleWatermarkCollection possibleWatermarks = content.getPages().get_Item(0).search(textSearchCriteria);

        watermarker.close();
    }
}
  • Key Methods:
    • TextSearchCriteria – specifies the exact text to look for.
    • PossibleWatermarkCollection – stores any matches found.

Graficzne znaki wodne

If your diagram contains logo or picture watermarks, use ImageDctHashSearchCriteria to compare against a reference image.

import com.groupdocs.watermark.Watermarker;
import com.groupdocs.watermark.contents.DiagramContent;
import com.groupdocs.watermark.search.ImageDctHashSearchCriteria;
import com.groupdocs.watermark.search.PossibleWatermarkCollection;

public class SearchImageWatermarks {
    public static void main(String[] args) throws Exception {
        String inputFilePath = "YOUR_DOCUMENT_DIRECTORY/diagram.vsdx";
        String imagePath = "YOUR_DOCUMENT_DIRECTORY/logo.png";
        
        Watermarker watermarker = new Watermarker(inputFilePath);
        DiagramContent content = watermarker.getContent(DiagramContent.class);

        ImageDctHashSearchCriteria imageSearchCriteria = new ImageDctHashSearchCriteria(imagePath);
        PossibleWatermarkCollection possibleWatermarks = content.getPages().get_Item(0).search(imageSearchCriteria);

        watermarker.close();
    }
}
  • Key Methods:
    • ImageDctHashSearchCriteria – creates a perceptual hash of the reference image for robust matching.

Usuwanie znaków wodnych

Once you’ve identified unwanted watermarks, you can clear them and save a clean copy of the diagram.

import com.groupdocs.watermark.Watermarker;
import com.groupdocs.watermark.contents.DiagramContent;
import com.groupdocs.watermark.search.TextSearchCriteria;
import com.groupdocs.watermark.search.ImageDctHashSearchCriteria;
import com.groupdocs.watermark.search.PossibleWatermarkCollection;

public class RemoveWatermarks {
    public static void main(String[] args) throws Exception {
        String inputFilePath = "YOUR_DOCUMENT_DIRECTORY/diagram.vsdx";
        String outputFilePath = "YOUR_OUTPUT_DIRECTORY/updated_diagram.vsdx";

        Watermarker watermarker = new Watermarker(inputFilePath);
        DiagramContent content = watermarker.getContent(DiagramContent.class);

        TextSearchCriteria textSearchCriteria = new TextSearchCriteria("Company Name");
        ImageDctHashSearchCriteria imageSearchCriteria = new ImageDctHashSearchCriteria("YOUR_DOCUMENT_DIRECTORY/logo.png");

        PossibleWatermarkCollection possibleWatermarks = content.getPages().get_Item(0).search(textSearchCriteria.or(imageSearchCriteria));
        possibleWatermarks.clear();

        watermarker.save(outputFilePath);
        watermarker.close();
    }
}
  • Key Method: clear() removes every watermark found by the combined criteria, leaving the diagram intact.

Praktyczne zastosowania

  1. Enterprise Software Integration – Embed watermark management into business apps to protect proprietary diagrams.
  2. Content Management Systems (CMS) – Automate detection and removal of unauthorized logos before publishing.
  3. Legal Document Workflows – Add or strip watermarks at different stages of contract processing.

Typowe problemy i rozwiązywanie

  • License errors: Ensure the license file is correctly referenced before creating a Watermarker.
  • Large files: Use streaming APIs or increase JVM heap size (-Xmx2g) for diagrams > 100 MB.
  • Missing watermarks: Verify that the search criteria (text case, image similarity threshold) match the actual watermark content.

Najczęściej zadawane pytania

Q: Czy mogę wyszukiwać zarówno tekst i obrazy jednocześnie?
A: Yes. Combine criteria with or() as shown in the removal example.

Q: Czy bezpieczne jest usuwanie znaków wodnych bez zmiany układu diagramu?
A: Absolutely. The API precisely targets watermark objects, preserving all other diagram elements.

Q: Jakie formaty diagramów obsługuje GroupDocs.Watermark?
A: It supports Visio formats like .vsdx, .vdx, as well as other vector diagram types.

Q: Jak mogę efektywnie przetwarzać setki diagramów?
A: Implement a batch loop, reuse a single Watermarker instance when possible, and consider parallel processing with Java’s ExecutorService.

Q: Czy mogę zintegrować wykrywanie znaków wodnych w pipeline CI/CD?
A: Yes. Include the Java snippets in your build scripts (e.g., Maven plugins or Gradle tasks) to validate diagrams before deployment.

Podsumowanie

By leveraging groupdocs watermark maven, you gain a powerful, Maven‑managed way to load, search, and remove watermarks from diagram files using Java. This capability strengthens document security, streamlines content workflows, and scales effortlessly across large document collections.


Ostatnia aktualizacja: 2025-12-19
Testowano z: GroupDocs.Watermark 24.11 for Java
Autor: GroupDocs