1. Products
  2.   eBook
  3.   .NET
  4.   FB2Library
 
  

.NET Library for .FB2 Documents Creation

Open Source .NET Library to Create, Access, Read, edit and convert .FB2 EBooks inside C# apps.

FB2Library is a Cross-Platform very valuable open source .NET library for working with .FB2 (Fiction Book) EBooks. FB2 ebook file format is very popular in Russia and is widely acceptable. It was developed by Dmitry Gribov of FictionBook in Russia. It is based on XML format and contains special tags for describing each element of the book. The project is written on C# and requires.NET 4.0 Client Uses Visual Studio 2012 to compile.

The FB2Library library is very easy to work with and provides very useful features for reading editing or converting the EBooks file format. Users can easily add new books to their library, organize them by author, genre, or other criteria, and search for specific books using keywords. The software also includes a built-in reader that allows users to read their e-books in a comfortable and customizable environment.

FB2Library also has the ability to export books in several formats such as HTML, plain text, RTF, and ePub. This makes it easy for users to convert their e-books for use on other devices or platforms. FB2Library's user interface is simple and easy to use, making it accessible to users of all skill levels. It's also regularly updated, which ensures compatibility with the latest operating systems and devices.

Previous Next

Getting Started with FB2Library

The recommended way to install FB2Library is using NuGet. Please use the following command a smooth installation.

Install FB2Library via NuGet

 Install-Package FB2Library

You can also install it manually; download the latest release files directly from GitHub repository.

Create & Convert FB2 File via .NET API

The open source FB2Library has included complete functionality for creating new FB2 book from the scratch inside .NET applications. It is also possible to convert FB2 to various supported formats. The library has included various useful features for FB2 book creations, such as add book title, add book author name, insert text and images, add annotations and so on. The library allows to add separate chapters for the book with ease. The following example shows how users can convert FB2 book using C# .NET.

How to Convert FB2 To Bitmap Image via C# Library

public async Task ConvertToBitmapImage(byte[] image)
{
	// converting stream
	InMemoryRandomAccessStream ras = new InMemoryRandomAccessStream();
	var memoryStream = new MemoryStream(image);
	await memoryStream.CopyToAsync(ras.AsStreamForWrite());

	// create BitmapImage
	var bitmapImage = new BitmapImage();
	await bitmapImage.SetSourceAsync(ras);
	return bitmapImage;
}

How to Read FB2 file via .NET API

The open source FB2Library allows software developers to access, load and read FB2 files inside their .NET applications. The library has provided various methods for reading FB2 documents. You can read from the stream or read it from string with just a couple of lines of C# code. The library takes Fb2 file content as a string and read the content of the file. The following examples shows how developers can load and Read Fb2 file from the string.

Read Fb2 File from String via C# Library

public Task ReadAsync(string xml)
 {
     return Task.Factory.StartNew(() =>
     {
         var file = new FB2File();
         var fb2Document = XDocument.Parse(xml);
         file.Load(fb2Document, false);
         return file;
     });
 }