Tie BE and UI for epub viewing

This commit is contained in:
aditya.chandel
2025-01-14 14:27:49 -07:00
parent ebea3890af
commit c2c2b8d6b8
13 changed files with 191 additions and 149 deletions
@@ -1,5 +1,6 @@
package com.adityachandel.booklore.model.dto;
import com.adityachandel.booklore.model.enums.BookFileType;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
@@ -10,6 +11,7 @@ import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Book {
private Long id;
private BookFileType bookType;
private Long libraryId;
private String fileName;
private String title;
@@ -1,5 +1,6 @@
package com.adityachandel.booklore.model.entity;
import com.adityachandel.booklore.model.enums.BookFileType;
import jakarta.persistence.*;
import lombok.*;
@@ -25,6 +26,9 @@ public class BookEntity {
@Column(name = "path")
private String path;
@Column(name = "book_type")
private BookFileType bookType;
@OneToOne(mappedBy = "book", cascade = CascadeType.ALL, orphanRemoval = true)
private BookMetadataEntity metadata;
@@ -5,6 +5,7 @@ import com.adityachandel.booklore.model.entity.AuthorEntity;
import com.adityachandel.booklore.model.entity.BookEntity;
import com.adityachandel.booklore.model.entity.BookMetadataEntity;
import com.adityachandel.booklore.model.entity.BookViewerSettingEntity;
import com.adityachandel.booklore.model.enums.BookFileType;
import com.adityachandel.booklore.repository.AuthorRepository;
import com.adityachandel.booklore.repository.BookMetadataRepository;
import com.adityachandel.booklore.repository.BookRepository;
@@ -26,9 +27,14 @@ public class BookCreatorService {
private BookMetadataRepository bookMetadataRepository;
private BookViewerSettingRepository bookViewerSettingRepository;
public BookEntity createShellBook(LibraryFile libraryFile) {
public BookEntity createShellBook(LibraryFile libraryFile, BookFileType bookFileType) {
File bookFile = new File(libraryFile.getFilePath());
BookEntity bookEntity = BookEntity.builder().library(libraryFile.getLibraryEntity()).path(bookFile.getPath()).fileName(bookFile.getName()).build();
BookEntity bookEntity = BookEntity.builder()
.library(libraryFile.getLibraryEntity())
.path(bookFile.getPath())
.fileName(bookFile.getName())
.bookType(bookFileType)
.build();
BookMetadataEntity bookMetadataEntity = BookMetadataEntity.builder().build();
BookViewerSettingEntity bookViewerSetting = BookViewerSettingEntity.builder()
.book(bookEntity)
@@ -40,6 +46,7 @@ public class BookCreatorService {
.build();
bookEntity.setMetadata(bookMetadataEntity);
bookEntity.setViewerSetting(bookViewerSetting);
bookEntity = bookRepository.saveAndFlush(bookEntity);
return bookEntity;
}
@@ -1,14 +1,13 @@
package com.adityachandel.booklore.service;
import com.adityachandel.booklore.config.AppProperties;
import com.adityachandel.booklore.mapper.BookMapper;
import com.adityachandel.booklore.model.LibraryFile;
import com.adityachandel.booklore.model.dto.Book;
import com.adityachandel.booklore.model.entity.AuthorEntity;
import com.adityachandel.booklore.model.entity.BookEntity;
import com.adityachandel.booklore.model.entity.BookMetadataEntity;
import com.adityachandel.booklore.model.enums.BookFileType;
import com.adityachandel.booklore.repository.BookRepository;
import io.documentnode.epub4j.domain.Date;
import com.adityachandel.booklore.service.fileprocessing.FileProcessingUtils;
import io.documentnode.epub4j.domain.Identifier;
import io.documentnode.epub4j.domain.Metadata;
import io.documentnode.epub4j.domain.Resource;
@@ -20,7 +19,6 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.File;
@@ -31,6 +29,7 @@ import java.time.OffsetDateTime;
import java.time.format.DateTimeParseException;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@Slf4j
@@ -40,8 +39,8 @@ public class EpubFileProcessor implements FileProcessor {
private final BookRepository bookRepository;
private final BookCreatorService bookCreatorService;
private final AppProperties appProperties;
private final BookMapper bookMapper;
private final FileProcessingUtils fileProcessingUtils;
@Transactional(propagation = Propagation.REQUIRES_NEW)
@Override
@@ -60,30 +59,12 @@ public class EpubFileProcessor implements FileProcessor {
@Transactional(propagation = Propagation.REQUIRES_NEW)
protected Book processNewFile(LibraryFile libraryFile) {
File bookFile = new File(libraryFile.getFilePath());
BookEntity bookEntity = bookCreatorService.createShellBook(libraryFile);
bookRepository.saveAndFlush(bookEntity);
BookMetadataEntity bookMetadataEntity = bookEntity.getMetadata();
BookEntity bookEntity = bookCreatorService.createShellBook(libraryFile, BookFileType.EPUB);
try {
EpubReader epubReader = new EpubReader();
io.documentnode.epub4j.domain.Book book = epubReader.readEpub(new FileInputStream(bookFile));
setMetadata(book, bookMetadataEntity);
io.documentnode.epub4j.domain.Book epub = new EpubReader().readEpub(new FileInputStream(libraryFile.getFilePath()));
Resource coverImage = book.getCoverImage();
if (coverImage != null) {
File coverDirectory = new File(appProperties.getPathConfig() + "/thumbs");
File bookDirectory = new File(coverDirectory, bookEntity.getId().toString());
if (!bookDirectory.exists()) {
if (!bookDirectory.mkdirs()) {
throw new IOException("Failed to create directory: " + bookDirectory.getAbsolutePath());
}
}
File coverImageFile = new File(bookDirectory, "f.jpg");
boolean success = saveCoverImage(coverImage, coverImageFile);
if (success) {
bookMetadataEntity.setThumbnail(coverImageFile.getAbsolutePath());
}
}
setBookMetadata(epub, bookEntity);
processCover(epub, bookEntity);
bookCreatorService.saveConnections(bookEntity);
bookRepository.save(bookEntity);
@@ -95,80 +76,73 @@ public class EpubFileProcessor implements FileProcessor {
return bookMapper.toBook(bookEntity);
}
private void setMetadata(io.documentnode.epub4j.domain.Book book, BookMetadataEntity metadataEntity) {
Metadata metadata = book.getMetadata();
private void processCover(io.documentnode.epub4j.domain.Book epub, BookEntity bookEntity) throws IOException {
Resource coverImage = epub.getCoverImage();
if (coverImage != null) {
boolean success = saveCoverImage(coverImage, bookEntity.getId());
if (success) {
fileProcessingUtils.setBookCoverPath(bookEntity.getId(), bookEntity.getMetadata());
}
}
}
if (metadata != null) {
metadataEntity.setTitle(metadata.getFirstTitle());
private static Set<String> getAuthors(io.documentnode.epub4j.domain.Book book) {
return book.getMetadata().getAuthors().stream()
.map(author -> author.getFirstname() + " " + author.getLastname())
.collect(Collectors.toSet());
}
if (metadata.getAuthors() != null && !metadata.getAuthors().isEmpty()) {
List<AuthorEntity> authorEntities = metadata.getAuthors().stream()
.map(author -> author.getFirstname() + " " + author.getLastname())
.map(a -> AuthorEntity.builder().name(a).build())
.collect(Collectors.toList());
metadataEntity.setAuthors(authorEntities);
private void setBookMetadata(io.documentnode.epub4j.domain.Book book, BookEntity bookEntity){
BookMetadataEntity bookMetadata = bookEntity.getMetadata();
Metadata epubMetadata = book.getMetadata();
if (epubMetadata != null) {
bookMetadata.setTitle(epubMetadata.getFirstTitle());
if (epubMetadata.getDescriptions() != null && !epubMetadata.getDescriptions().isEmpty()) {
bookMetadata.setDescription(epubMetadata.getDescriptions().getFirst());
}
if (metadata.getDescriptions() != null && !metadata.getDescriptions().isEmpty()) {
metadataEntity.setDescription(metadata.getDescriptions().getFirst());
if (epubMetadata.getPublishers() != null && !epubMetadata.getPublishers().isEmpty()) {
bookMetadata.setPublisher(epubMetadata.getPublishers().getFirst());
}
if (metadata.getPublishers() != null && !metadata.getPublishers().isEmpty()) {
metadataEntity.setPublisher(metadata.getPublishers().getFirst());
}
List<String> identifiers = metadata.getIdentifiers().stream()
List<String> identifiers = epubMetadata.getIdentifiers().stream()
.map(Identifier::getValue)
.toList();
if (!identifiers.isEmpty()) {
String isbn13 = identifiers.stream().filter(id -> id.length() == 13).findFirst().orElse(null);
String isbn10 = identifiers.stream().filter(id -> id.length() == 10).findFirst().orElse(null);
metadataEntity.setIsbn13(isbn13);
metadataEntity.setIsbn10(isbn10);
bookMetadata.setIsbn13(isbn13);
bookMetadata.setIsbn10(isbn10);
}
metadataEntity.setLanguage(metadata.getLanguage() == null || metadata.getLanguage().equalsIgnoreCase("UND") ? "en" : metadata.getLanguage());
bookMetadata.setLanguage(epubMetadata.getLanguage() == null || epubMetadata.getLanguage().equalsIgnoreCase("UND") ? "en" : epubMetadata.getLanguage());
if (metadata.getDates() != null && !metadata.getDates().isEmpty()) {
metadata.getDates().stream()
.findFirst()
.ifPresent(publishedDate -> {
String dateString = publishedDate.getValue();
if (isValidLocalDate(dateString)) {
LocalDate parsedDate = LocalDate.parse(dateString);
metadataEntity.setPublishedDate(parsedDate);
} else if (isValidOffsetDateTime(dateString)) {
OffsetDateTime offsetDateTime = OffsetDateTime.parse(dateString);
metadataEntity.setPublishedDate(offsetDateTime.toLocalDate());
} else {
log.error("Unable to parse date: {}", dateString);
}
});
if (epubMetadata.getDates() != null && !epubMetadata.getDates().isEmpty()) {
epubMetadata.getDates().stream()
.findFirst()
.ifPresent(publishedDate -> {
String dateString = publishedDate.getValue();
if (isValidLocalDate(dateString)) {
LocalDate parsedDate = LocalDate.parse(dateString);
bookMetadata.setPublishedDate(parsedDate);
} else if (isValidOffsetDateTime(dateString)) {
OffsetDateTime offsetDateTime = OffsetDateTime.parse(dateString);
bookMetadata.setPublishedDate(offsetDateTime.toLocalDate());
} else {
log.error("Unable to parse date: {}", dateString);
}
});
}
bookCreatorService.addAuthorsToBook(getAuthors(book), bookEntity);
}
}
private boolean saveCoverImage(Resource coverImage, File coverImageFile) {
if (coverImage == null) {
return false;
}
try {
BufferedImage originalImage = ImageIO.read(new ByteArrayInputStream(coverImage.getData()));
BufferedImage resizedImage = resizeImage(originalImage, 250, 350);
return ImageIO.write(resizedImage, "JPEG", coverImageFile);
} catch (IOException e) {
log.error("Failed to save cover image: {}", e.getMessage());
return false;
}
}
private BufferedImage resizeImage(BufferedImage originalImage, int width, int height) {
Image tmp = originalImage.getScaledInstance(width, height, Image.SCALE_SMOOTH);
BufferedImage resizedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = resizedImage.createGraphics();
g2d.drawImage(tmp, 0, 0, null);
g2d.dispose();
return resizedImage;
private boolean saveCoverImage(Resource coverImage, long bookId) throws IOException {
BufferedImage originalImage = ImageIO.read(new ByteArrayInputStream(coverImage.getData()));
return fileProcessingUtils.saveCoverImage(originalImage, bookId);
}
private boolean isValidLocalDate(String dateString) {
@@ -1,12 +1,13 @@
package com.adityachandel.booklore.service;
import com.adityachandel.booklore.config.AppProperties;
import com.adityachandel.booklore.mapper.BookMapper;
import com.adityachandel.booklore.model.LibraryFile;
import com.adityachandel.booklore.model.dto.Book;
import com.adityachandel.booklore.model.entity.BookEntity;
import com.adityachandel.booklore.model.entity.BookMetadataEntity;
import com.adityachandel.booklore.model.enums.BookFileType;
import com.adityachandel.booklore.repository.BookRepository;
import com.adityachandel.booklore.service.fileprocessing.FileProcessingUtils;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.pdfbox.Loader;
@@ -17,8 +18,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
@@ -33,10 +32,10 @@ import java.util.stream.Collectors;
@AllArgsConstructor
public class PdfFileProcessor implements FileProcessor {
private BookRepository bookRepository;
private BookCreatorService bookCreatorService;
private AppProperties appProperties;
private BookMapper bookMapper;
private final BookRepository bookRepository;
private final BookCreatorService bookCreatorService;
private final BookMapper bookMapper;
private final FileProcessingUtils fileProcessingUtils;
@Transactional(propagation = Propagation.REQUIRES_NEW)
@Override
@@ -55,27 +54,14 @@ public class PdfFileProcessor implements FileProcessor {
@Transactional(propagation = Propagation.REQUIRES_NEW)
protected Book processNewFile(LibraryFile libraryFile) {
File bookFile = new File(libraryFile.getFilePath());
BookEntity bookEntity = bookCreatorService.createShellBook(libraryFile);
BookMetadataEntity bookMetadataEntity = bookEntity.getMetadata();
try (PDDocument document = Loader.loadPDF(bookFile)) {
if (document.getDocumentInformation() == null) {
log.warn("No document information found");
} else {
if (document.getDocumentInformation().getTitle() != null) {
bookMetadataEntity.setTitle(document.getDocumentInformation().getTitle());
}
if (document.getDocumentInformation().getAuthor() != null) {
Set<String> authors = getAuthors(document);
bookCreatorService.addAuthorsToBook(authors, bookEntity);
}
}
BookEntity bookEntity = bookCreatorService.createShellBook(libraryFile, BookFileType.PDF);
try (PDDocument pdf = Loader.loadPDF(new File(libraryFile.getFilePath()))) {
setMetadata(pdf, bookEntity);
processCover(pdf, bookEntity);
bookCreatorService.saveConnections(bookEntity);
BookEntity saved = bookRepository.save(bookEntity);
boolean success = generateCoverImage(saved.getId(), new File(appProperties.getPathConfig() + "/thumbs"), document);
if (success) {
bookMetadataEntity.setThumbnail(appProperties.getPathConfig() + "/thumbs/" + bookEntity.getId() + "/f.jpg");
}
bookEntity = bookRepository.save(bookEntity);
bookRepository.flush();
} catch (Exception e) {
log.error("Error while processing file {}, error: {}", libraryFile.getFilePath(), e.getMessage());
@@ -83,6 +69,27 @@ public class PdfFileProcessor implements FileProcessor {
return bookMapper.toBook(bookEntity);
}
private void processCover(PDDocument document, BookEntity bookEntity) throws IOException {
boolean success = generateCoverImageAndSave(bookEntity.getId(), document);
if (success) {
fileProcessingUtils.setBookCoverPath(bookEntity.getId(), bookEntity.getMetadata());
}
}
private void setMetadata(PDDocument document, BookEntity bookEntity) {
if (document.getDocumentInformation() == null) {
log.warn("No document information found");
} else {
if (document.getDocumentInformation().getTitle() != null) {
bookEntity.getMetadata().setTitle(document.getDocumentInformation().getTitle());
}
if (document.getDocumentInformation().getAuthor() != null) {
Set<String> authors = getAuthors(document);
bookCreatorService.addAuthorsToBook(authors, bookEntity);
}
}
}
private Set<String> getAuthors(PDDocument document) {
String authorNamesUnsplit = document.getDocumentInformation().getAuthor();
Set<String> authorNames = new HashSet<>();
@@ -96,27 +103,9 @@ public class PdfFileProcessor implements FileProcessor {
return authorNames.stream().map(String::trim).collect(Collectors.toSet());
}
private boolean generateCoverImage(Long bookId, File coverDirectory, PDDocument document) throws IOException {
PDFRenderer renderer = new PDFRenderer(document);
BufferedImage coverImage = renderer.renderImageWithDPI(0, 300, ImageType.RGB);
BufferedImage resizedImage = resizeImage(coverImage, 250, 350);
File bookDirectory = new File(coverDirectory, bookId.toString());
if (!bookDirectory.exists()) {
if (!bookDirectory.mkdirs()) {
throw new IOException("Failed to create directory: " + bookDirectory.getAbsolutePath());
}
}
String coverImageName = "f.jpg";
File coverImageFile = new File(bookDirectory, coverImageName);
return ImageIO.write(resizedImage, "JPEG", coverImageFile);
private boolean generateCoverImageAndSave(Long bookId, PDDocument document) throws IOException {
BufferedImage coverImage = new PDFRenderer(document).renderImageWithDPI(0, 300, ImageType.RGB);
return fileProcessingUtils.saveCoverImage(coverImage, bookId);
}
public static BufferedImage resizeImage(BufferedImage originalImage, int width, int height) {
Image tmp = originalImage.getScaledInstance(width, height, Image.SCALE_SMOOTH);
BufferedImage resizedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = resizedImage.createGraphics();
g2d.drawImage(tmp, 0, 0, null);
g2d.dispose();
return resizedImage;
}
}
@@ -0,0 +1,47 @@
package com.adityachandel.booklore.service.fileprocessing;
import com.adityachandel.booklore.config.AppProperties;
import com.adityachandel.booklore.model.entity.BookMetadataEntity;
import lombok.AllArgsConstructor;
import org.apache.pdfbox.rendering.ImageType;
import org.springframework.stereotype.Service;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
@AllArgsConstructor
@Service
public class FileProcessingUtils {
private final AppProperties appProperties;
public void setBookCoverPath(long bookId, BookMetadataEntity bookMetadataEntity) {
bookMetadataEntity.setThumbnail(appProperties.getPathConfig() + "/thumbs/" + bookId + "/f.jpg");
}
public boolean saveCoverImage(BufferedImage coverImage, long bookId) throws IOException {
File coverDirectory = new File(appProperties.getPathConfig() + "/thumbs");
BufferedImage resizedImage = resizeImage(coverImage, 250, 350);
File bookDirectory = new File(coverDirectory, String.valueOf(bookId));
if (!bookDirectory.exists()) {
if (!bookDirectory.mkdirs()) {
throw new IOException("Failed to create directory: " + bookDirectory.getAbsolutePath());
}
}
String coverImageName = "f.jpg";
File coverImageFile = new File(bookDirectory, coverImageName);
return ImageIO.write(resizedImage, "JPEG", coverImageFile);
}
public BufferedImage resizeImage(BufferedImage originalImage, int width, int height) {
Image tmp = originalImage.getScaledInstance(width, height, Image.SCALE_SMOOTH);
BufferedImage resizedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = resizedImage.createGraphics();
g2d.drawImage(tmp, 0, 0, null);
g2d.dispose();
return resizedImage;
}
}
@@ -15,6 +15,7 @@ CREATE TABLE IF NOT EXISTS book
path VARCHAR(1000) NOT NULL,
last_read_time TIMESTAMP NULL,
added_on TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
book_type VARCHAR(6) NOT NULL,
CONSTRAINT fk_library FOREIGN KEY (library_id) REFERENCES library (id) ON DELETE CASCADE,
CONSTRAINT unique_file_library UNIQUE (file_name, library_id),
INDEX idx_library_id (library_id),
+5
View File
@@ -3,6 +3,7 @@ import {PdfViewerComponent} from './book/components/pdf-viewer/pdf-viewer.compon
import {BookBrowserComponent} from './book/components/book-browser/book-browser.component';
import {MainDashboardComponent} from './dashboard/components/main-dashboard/main-dashboard.component';
import {AppLayoutComponent} from './layout/component/layout-main/app.layout.component';
import {EpubViewerComponent} from './epub-viewer/component/epub-viewer.component';
export const routes: Routes = [
{
@@ -25,5 +26,9 @@ export const routes: Routes = [
{
path: 'pdf-viewer/book/:bookId',
component: PdfViewerComponent
},
{
path: 'epub-viewer/book/:bookId',
component: EpubViewerComponent
}
];
@@ -39,7 +39,7 @@ export class BookCardComponent implements OnInit {
}
readBook(book: Book): void {
this.bookService.readBook(book.id);
this.bookService.readBook(book);
}
toggleSelection(selected: boolean): void {
@@ -1,5 +1,7 @@
import {Shelf} from './shelf.model';
export type BookType = "PDF" | "EPUB";
export interface Book {
id: number;
libraryId: number;
@@ -7,6 +9,7 @@ export interface Book {
shelves?: Shelf[];
lastReadTime?: string;
addedOn?: string;
bookType: BookType;
}
export interface BookMetadata {
@@ -2,7 +2,7 @@ import {Injectable} from '@angular/core';
import {BehaviorSubject, Observable, of} from 'rxjs';
import {HttpClient} from '@angular/common/http';
import {catchError, map, switchMap, tap} from 'rxjs/operators';
import {Book, BookMetadata, BookSetting} from '../model/book.model';
import {Book, BookMetadata, BookSetting, BookType} from '../model/book.model';
import {BookState} from '../model/state/book-state.model';
@Injectable({
@@ -113,12 +113,21 @@ export class BookService {
);
}
readBook(bookId: number): void {
const url = `/pdf-viewer/book/${bookId}`;
window.open(url, '_blank');
this.updateLastReadTime(bookId).subscribe({
error: err => console.error('Failed to update last read time', err),
});
readBook(book: Book): void {
if (book.bookType === "PDF") {
const url = `/pdf-viewer/book/${book.id}`;
window.open(url, '_blank');
this.updateLastReadTime(book.id).subscribe({
next: () => console.log('Last read time updated successfully'),
error: err => console.error('Failed to update last read time', err),
});
} else if (book.bookType === "EPUB") {
const url = `/epub-viewer/book/${book.id}`;
window.open(url, '_blank');
} else {
console.error('Unsupported book type:', book.bookType);
return;
}
}
searchBooks(query: string): Observable<Book[]> {
@@ -7,6 +7,7 @@ import {NgForOf} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {Divider} from 'primeng/divider';
import {DropdownModule} from 'primeng/dropdown';
import {ActivatedRoute} from '@angular/router';
@Component({
selector: 'app-epub-viewer',
@@ -24,14 +25,12 @@ import {DropdownModule} from 'primeng/dropdown';
export class EpubViewerComponent implements OnInit, OnDestroy {
@ViewChild('epubContainer', {static: true}) epubContainer!: ElementRef;
bookId = 1;
chapters: { label: string; href: string }[] = [];
isDrawerVisible = false;
isSettingsDrawerVisible: boolean = false;
private book: any;
private rendition: any;
private keyListener: (e: KeyboardEvent) => void = () => {
};
private keyListener: (e: KeyboardEvent) => void = () => {};
fontSize: number = 100;
fontTypes: any[] = [
@@ -43,15 +42,17 @@ export class EpubViewerComponent implements OnInit, OnDestroy {
];
selectedFontType: string = 'serif';
constructor(private epubService: EpubService) {
constructor(private epubService: EpubService, private route: ActivatedRoute) {
}
ngOnInit(): void {
this.loadEpub();
this.route.paramMap.subscribe((params) => {
this.loadEpub(+params.get('bookId')!);
});
}
loadEpub(): void {
this.epubService.downloadEpub(this.bookId).subscribe(
loadEpub(bookId: number): void {
this.epubService.downloadEpub(bookId).subscribe(
(data: Blob) => {
const fileReader = new FileReader();
fileReader.onload = () => {
@@ -66,7 +66,7 @@ export class MetadataViewerComponent implements OnInit {
}
readBook(bookId: number) {
this.bookService.readBook(bookId);
/*this.bookService.readBook(bookId);*/
}
closeDialog() {