DEV Community

GroupDocs
GroupDocs

Posted on

Proficiently Manipulate Metadata in your Password Protected Documents using Java API

Online file sharing services these days are commonly used by the average Internet user and people rely upon such services for sharing their documents everyday. We freely distribute our legal, professional, image and other types of files over the Internet, with hard copies fast becoming a thing of the past. This also means that we regularly come across encrypted or password-protected files, which ensure document security and satisfaction on end user’s part.

Software development process has evolved enough to include algorithms for manipulating various types of data inside a protected document. GrouDocs.Metadata for Java API is one such solution, offering application developers the ability to work with the metadata of password-protected Microsoft Word, Excel, PowerPoint and PDF documents on Java platform. In addition to this, the Java document metadata API provides enhanced memory utilization when processing DOCX and PPTX file formats and supports more metadata keys in DOC and DOCX formats plus much more.

Following code snippet demonstrates working with password protected Microsoft Word document:

// For complete examples and data files, please go to https://github.com/groupdocs-metadata/GroupDocs.Metadata-for-.NET
LoadOptions loadOptions = new LoadOptions("password");
try (DocFormat format = new DocFormat(Common.mapSourceFilePath(protectedFilePath), loadOptions))
{
// Working with the password-protected document
format.cleanMetadata();
format.save(Common.mapDestinationFilePath(protectedFilePath));
}

Similarly, more code snippets follow, showing how to access password protected PowerPoint, Excel and PDF documents respectively.

Microsoft PowerPoint presentations:

https://github.com/groupdocs-metadata/GroupDocs.Metadata-for-.NET
LoadOptions loadOptions = new LoadOptions("password");
try (PptFormat format = new PptFormat(Common.mapSourceFilePath(protectedFilePath), loadOptions))
{
// Working with the password-protected document
format.cleanMetadata();
format.save(Common.mapDestinationFilePath(protectedFilePath));
}

Microsoft Excel spreadsheets:

LoadOptions loadOptions = new LoadOptions("password");
try (XlsFormat format = new XlsFormat(Common.mapSourceFilePath(protectedFilePath), loadOptions))
{
// Working with the password-protected document
format.cleanMetadata();
format.save(Common.mapDestinationFilePath(protectedFilePath));
}

PDF documents:

LoadOptions loadOptions = new LoadOptions("password");
try (PdfFormat format = new PdfFormat(Common.mapSourceFilePath(protectedFilePath), loadOptions))
{
// Working with the password-protected document
format.cleanMetadata();
format.save(Common.mapDestinationFilePath(protectedFilePath));
}

Read more – http://bit.ly/2LL2tvV

Top comments (0)