Showcase project – Demonstrates how to open a password‑protected DOCX file with GroupDocs.Editor for Java, remove the protection and save the unlocked document.
The sample program performs the following steps:
- Loads a GroupDocs.Editor license (if a license file is present).
- Opens
resources/input/sample.docxusing the password supplied in the code. - Saves an unlocked copy of the document to
resources/output/unlocked_sample.docx.
The purpose of this project is to illustrate the Edit password‑protected DOCX use‑case for developers evaluating the GroupDocs.Editor library.
- Java Development Kit (JDK) 8 or higher
- Maven 3.6+ (any recent version will work)
- Internet connection for Maven to download GroupDocs dependencies
GroupDocs.Editor is a commercial product. To run the example without evaluation restrictions you need a license file.
- Temporary license: Visit https://purchase.groupdocs.com/temporary-license/ to obtain a free 30‑day temporary license.
- Placement: Put the license file (e.g.,
GroupDocs.Editor.lic) in the project root directory (the same folder that containspom.xml). - Without a license: The library works in evaluation mode – you will see watermarks and certain limitations.
project-root/
├─ pom.xml
├─ GroupDocs.Editor.lic (optional – place your license here)
├─ resources/
│ ├─ input/
│ │ └─ sample.docx (placeholder – replace with your own file)
│ └─ output/ (generated files will appear here)
└─ src/
└─ main/java/com/groupdocs/editor/examples/EditPasswordProtectedDocx.java
Note: Replace
sample.docxwith a password‑protected DOCX file you want to test.
-
Clone the repository (or copy the files into a new folder).
git clone https://github.com/your-repo/groupdocs-editor-java-edit-password-protected-docx.git cd groupdocs-editor-java-edit-password-protected-docx -
Place your license file (optional).
- Put
GroupDocs.Editor.licinto the project root.
- Put
-
Add your password‑protected DOCX to
resources/input/and rename it tosample.docx(or edit the path in the code). -
Build the project.
mvn clean compile
5Check the result – the unlocked document will be created at resources/output/unlocked_sample.docx.
- Password: Modify the
passwordvariable inEditPasswordProtectedDocx.mainto match your document’s password. - Input/Output Paths: Change
inputPathandoutputPathvariables if you prefer different locations or filenames. - Saving to another format: Adjust
ISaveOptions(e.g.,PdfSaveOptions) to convert the document while unlocking.
- License not found: Ensure the license file name matches the one referenced in
loadLicenseand that it resides in the project root. - File not found: Verify that
resources/input/sample.docxexists and the path is correct (relative to the project root). - Incorrect password: The library will throw an exception; double‑check the password string.
Feel free to fork the repository, make improvements, or add more examples that showcase other GroupDocs.Editor capabilities.
This is a demonstration project for GroupDocs.Editor. It is intentionally minimal to keep the focus on the featured functionality.