Skip to content

Latest commit

 

History

History
98 lines (64 loc) · 3.54 KB

File metadata and controls

98 lines (64 loc) · 3.54 KB

groupdocs-editor-java-edit-password-protected-docx

Showcase project – Demonstrates how to open a password‑protected DOCX file with GroupDocs.Editor for Java, remove the protection and save the unlocked document.


Overview

The sample program performs the following steps:

  1. Loads a GroupDocs.Editor license (if a license file is present).
  2. Opens resources/input/sample.docx using the password supplied in the code.
  3. 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.


Prerequisites

  • Java Development Kit (JDK) 8 or higher
  • Maven 3.6+ (any recent version will work)
  • Internet connection for Maven to download GroupDocs dependencies

License

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 contains pom.xml).
  • Without a license: The library works in evaluation mode – you will see watermarks and certain limitations.

Project Structure

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.docx with a password‑protected DOCX file you want to test.


Setup & Run

  1. 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
  2. Place your license file (optional).

    • Put GroupDocs.Editor.lic into the project root.
  3. Add your password‑protected DOCX to resources/input/ and rename it to sample.docx (or edit the path in the code).

  4. Build the project.

    mvn clean compile

5Check the result – the unlocked document will be created at resources/output/unlocked_sample.docx.


Customisation

  • Password: Modify the password variable in EditPasswordProtectedDocx.main to match your document’s password.
  • Input/Output Paths: Change inputPath and outputPath variables if you prefer different locations or filenames.
  • Saving to another format: Adjust ISaveOptions (e.g., PdfSaveOptions) to convert the document while unlocking.

Troubleshooting

  • License not found: Ensure the license file name matches the one referenced in loadLicense and that it resides in the project root.
  • File not found: Verify that resources/input/sample.docx exists and the path is correct (relative to the project root).
  • Incorrect password: The library will throw an exception; double‑check the password string.

Contribution

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.