Extract metadata from EPUB eBook

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Parser MCP server lets your agent work with files on your machine; they are never uploaded. It runs in Docker: replace /path/to/documents with the folder it may use.

claude mcp add groupdocs-parser -- docker run --rm -i -v /path/to/documents:/data ghcr.io/groupdocs-parser/parser-net-mcp:latest
Folders, licensing and more →

To extract metadata from EPUB e-books GetMetadata method is used. This method allows to extract the following metadata:

NameDescription
titleThe title of the e-book.
subjectThe subject of the e-book.
authorThe name of the e-book’s author.
languageThe language of the e-book.
published-dateThe published date of the e-book.
descriptionThe description of the e-book.
publisherThe publisher of the e-book.
copyrightsThe copyrights of the e-book.

Here are the steps to extract metadata from EPUB e-book:

  • Instantiate Parser object for the initial e-book;
  • Call GetMetadata method and obtain collection of document metadata objects;
  • Iterate through the collection and get metadata names and values.
Warning
GetMetadata method returns null value if metadata extraction isn’t supported for the document. For example, metadata extraction isn’t supported for Zip archive. Therefore, for Zip archive GetMetadata method returns null. If EPUB e-book has no metadata, GetMetadata method returns an empty collection.

The following example demonstrates how to extract metadata from EPUB e-book:

// Create an instance of Parser class
using(Parser parser = new Parser(filePath))
{
    // Extract metadata from the e-book
    IEnumerable<MetadataItem> metadata = parser.GetMetadata();
 
    // Iterate over metadata items
    foreach(MetadataItem item in metadata)
    {
        // Print the item name and value
        Console.WriteLine(string.Format("{0}: {1}", item.Name, item.Value));
    }
}

More resources

GitHub examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free online document parser App

Along with full featured .NET library we provide simple, but powerful free Apps.

You are welcome to parse documents and extract data from PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, Emails and more with our free online Free Online Document Parser App.