DEV Community

GroupDocs
GroupDocs

Posted on

1

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

API Trace View

How I Cut 22.3 Seconds Off an API Call with Sentry πŸ•’

Struggling with slow API calls? Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more β†’

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs