EPUB Metadata Editing using C# .NET

An EPUB file is a digital ebook format that contains text, images, and multimedia elements, formatted using standard web technologies like HTML and CSS. EPUB metadata refers to essential information embedded within EPUB files, including details like title, author, publisher, and language, enabling accurate cataloging and organization of digital ebooks. In this article, we will discuss how to programmatically read, edit, and update EPUB metadata values including the Dublin Core set of items using C#.

Following are quick links to the covered topics:

.NET API for Metadata Editing

GroupDocs.Metadata provides .NET API to automate metadata management of various file formats within .NET applications. The API allows to read, update, add, clean, and remove the metadata for many file formats. Today, we will use this API to deal with metadata of eBooks having EPUB format.

You can download the DLLs or MSI installer from the downloads section or install the API in your .NET application via NuGet.

PM> Install-Package GroupDocs.Metadata

Modifying EPUB Metadata with C#

If you want to change EPUB metadata properties as a .NET developer, here’s how you can do it:

  • Load the EPUB eBook using the Metadata class.
  • Extract the metadata root package using the GetRootPackage method.
  • Now you can easily fetch to view all the metadata properties of the EPUB package.
  • Update the property values as required.
  • Save the eBook file with the updated metadata values using the Save method.

Here are the short pieces of C# code that show the above steps to read and update the EPUB metadata properties:

Read EPUB Metadata

Update EPUB Metadata

The following C# source code fetches and updates the EPUB metadata properties of the EPUB file.

Modifying EPUB Dublin Core Metadata with C#

Dublin Core metadata is a set few items that describes the physical and digital resources. You can easily change the Dublin Core metadata properties using very similar C# code.

Read Dublin Core

The following few lines are extracting Dublin Core metadata items to analyze:

Update Dublin Core

Then you can change specific Dublin Core properties accordingly as shown in the code below:

Getting a Free License

If you want to experience the joy of this API at its full capacity, you can get a temporary license for free.

Conclusion

In this article, we explored the world of EPUB metadata manipulation. First, we explore how to programmatically read and edit EPUB metadata properties using C#. Then we did the same for the Dublin Core set of items for the eBooks.

For detailed API information, readers are encouraged to consult the API reference, GitHub repository & documentation.

Questions and further discussions can be directed to the provided forum.

See Also