Buscar pacotes, repositórios e categorias de apps

Detalhes do pacotev2.1.0

epub

Parser de Epub para Dart. Adequado para uso em servidores, na Web ou no Flutter

Downloads em 30 dias
333
Curtidas
54
Pontos Pub
35

Instalar pacote

flutter pub add epub

Visão geral do pacote

Orientação gerada a partir de informações públicas. Apenas para referência.

O pacote epub é uma biblioteca Dart para análise e leitura de arquivos EPUB, projetado para funcionar em ambientes de servidor, web e Flutter. Permite que desenvolvedores extraiam conteúdo, metadados e estrutura de documentos EPUB de forma programática. O pacote suporta formatos EPUB padrão e fornece acesso a capítulos, imagens e informações de formatação. Ideal para aplicações que exigem processamento de livros eletrônicos, como leitores, conversores ou sistemas de gerenciamento de conteúdo.

Casos de uso

  • Lendo arquivos EPUB em aplicativos Flutter
  • Análise de e-books no servidor
  • Convertendo conteúdo EPUB para outros formatos
  • Construindo aplicativos de leitor de e-books
  • Extraindo metadados de e-books

Principais recursos

  • Suporta o formato EPUB padrão
  • Compatibilidade multiplataforma
  • Extrai capítulos, imagens e metadados
  • Leve e eficiente
  • Open-source com manutenção ativa

Indicado para

  • Aplicativos móveis Flutter que precisam de suporte a e-books
  • processamento de e-books no lado do servidor
  • Ferramentas de leitor eletrônico baseadas na web
  • plataformas de agregação de conteúdo
  • software educacional ou de publicação

Considerações

  • Limitado à análise de EPUB (sem gravação)
  • Requer arquivos EPUB válidos
  • Nenhum mecanismo de renderização embutido
  • Depende de dependências externas para exibição
  • Não otimizado para EPUBs muito grandes

README original

Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.

dart-epub

Build Status

Epub Reader and Writer for Dart inspired by this fantastic C# Epub Reader

This does not rely on the dart:io package in any way, so it is avilable for both desktop and web-based implementations

Installing

Add the package to the dependencies section of your pubspec.yaml

dependencies:
  epub: ^2.0.0

Example


//Get the epub into memory somehow
String fileName = "hittelOnGoldMines.epub";
String fullPath = path.join(io.Directory.current.path, fileName);
var targetFile = new io.File(fullPath);
List<int> bytes = await targetFile.readAsBytes();


// Opens a book and reads all of its content into memory
EpubBook epubBook = await EpubReader.readBook(bytes);
            
// COMMON PROPERTIES

// Book's title
String title = epubBook.Title;

// Book's authors (comma separated list)
String author = epubBook.Author;

// Book's authors (list of authors names)
List<String> authors = epubBook.AuthorList;

// Book's cover image (null if there is no cover)
Image coverImage = epubBook.CoverImage;

            
// CHAPTERS

// Enumerating chapters
epubBook.Chapters.forEach((EpubChapter chapter) {
  // Title of chapter
  String chapterTitle = chapter.Title;
              
  // HTML content of current chapter
  String chapterHtmlContent = chapter.HtmlContent;

  // Nested chapters
  List<EpubChapter> subChapters = chapter.SubChapters;
});

            
// CONTENT

// Book's content (HTML files, stlylesheets, images, fonts, etc.)
EpubContent bookContent = epubBook.Content;

            
// IMAGES

// All images in the book (file name is the key)
Map<String, EpubByteContentFile> images = bookContent.Images;

EpubByteContentFile firstImage = images.values.first;

// Content type (e.g. EpubContentType.IMAGE_JPEG, EpubContentType.IMAGE_PNG)
EpubContentType contentType = firstImage.ContentType;

// MIME type (e.g. "image/jpeg", "image/png")
String mimeContentType = firstImage.ContentMimeType;

// HTML & CSS

// All XHTML files in the book (file name is the key)
Map<String, EpubTextContentFile> htmlFiles = bookContent.Html;

// All CSS files in the book (file name is the key)
Map<String, EpubTextContentFile> cssFiles = bookContent.Css;

// Entire HTML content of the book
htmlFiles.values.forEach((EpubTextContentFile htmlFile) {
  String htmlContent = htmlFile.Content;
});

// All CSS content in the book
cssFiles.values.forEach((EpubTextContentFile cssFile){
  String cssContent = cssFile.Content;
});


// OTHER CONTENT

// All fonts in the book (file name is the key)
Map<String, EpubByteContentFile> fonts = bookContent.Fonts;

// All files in the book (including HTML, CSS, images, fonts, and other types of files)
Map<String, EpubContentFile> allFiles = bookContent.AllFiles;


// ACCESSING RAW SCHEMA INFORMATION

// EPUB OPF data
EpubPackage package = epubBook.Schema.Package;

// Enumerating book's contributors
package.Metadata.Contributors.forEach((EpubMetadataContributor contributor){
  String contributorName = contributor.Contributor;
  String contributorRole = contributor.Role;
});

// EPUB NCX data
EpubNavigation navigation = epubBook.Schema.Navigation;

// Enumerating NCX metadata
navigation.Head.Metadata.forEach((EpubNavigationHeadMeta meta){
  String metadataItemName = meta.Name;
  String metadataItemContent = meta.Content;
});

// Writing Data
var written = await EpubWriter.writeBook(epubBook);

// You can even re-read the book into a new object! 
var bookRoundTrip = await EpubReader.readBook(written);

Categorias

Dependências

Lista de dependências 6 itens

Repositório-fonte

Projetos que usam este pacote

Ainda não há dados.