패키지, 저장소 및 앱 카테고리 검색

패키지 상세v2.1.0

epub

Dart용 Epub 파서. 서버, 웹 또는 Flutter에서 사용하기 적합합니다

30일 다운로드
352
좋아요
54
Pub 점수
35

패키지 설치

flutter pub add epub

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

epub 패키지는 서버, 웹 및 플러터 환경에서 작동하도록 설계된 EPUB 파일을 파싱하고 읽기 위한 Dart 라이브러리입니다. 개발자가 프로그래밍적으로 EPUB 문서의 콘텐츠, 메타데이터 및 구조를 추출할 수 있게 해줍니다. 패키지는 표준 EPUB 형식을 지원하며 장, 이미지, 스타일링 정보에 대한 접근을 제공합니다. 전자책 처리가 필요한 애플리케이션, 예를 들어 리더, 변환기 또는 콘텐츠 관리 시스템에 적합합니다.

사용 사례

  • Flutter 앱에서 EPUB 파일 읽기
  • 서버에서 전자책 파싱하기
  • EPUB 콘텐츠를 다른 형식으로 변환하는 것
  • 전자 독서기 애플리케이션 구축
  • 전자책에서 메타데이터 추출하기

주요 기능

  • 표준 EPUB 형식을 지원합니다
  • 크로스 플랫폼 호환성
  • 장, 이미지 및 메타데이터 추출
  • 경량이고 효율적
  • 오픈소스이며 활발한 유지보수가 이루어지고 있습니다

적합한 대상

  • 전자책 지원이 필요한 Flutter 모바일 앱
  • 서버 측 전자책 처리
  • 웹 기반 전자 독서 도구
  • 콘텐츠 집약 플랫폼
  • 교육 또는 출판 소프트웨어

고려 사항

  • EPUB 구문 분석에 한정됨(쓰기 불가)
  • 유효한 EPUB 파일이 필요합니다
  • 내장 렌더링 엔진 없음
  • 표시를 위해 외부 종속성에 의존합니다
  • 매우 큰 EPUB에 최적화되지 않음

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

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);

카테고리

의존성

의존성 목록 6 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.