Node.js Express Convert EPUB Book to PDF Online Converter Using ebook-converter Library Full App 2020

Node.js Express Convert EPUB Book to PDF Online Converter Using ebook-converter Library Full App 2020

 

Welcome folks today in this blog post we will talk about a epub-converter library which will convert the epub books to pdf application. All the source code of the application will be given below.

 

Get started

 

 

In order to get started we need to install the following dependencies

 

 

npm i ebook-converter

 

 

For converting this you need a special library installed on your computer.

 

Install Calibre library for windows here

 

 

Sample Code

 

 

var path = require('path')
var xtend = require('xtend')
var convert = require('ebook-convert')
 
// see more options at https://manual.calibre-ebook.com/generated/en/ebook-convert.html
var options = {
  input: path.join(__dirname, 'sample1.epub'),
  output: path.join(__dirname, 'example.pdf'),
  authors: '"Seth Vincent"',
  pageBreaksBefore: '//h:h1',
  chapter: '//h:h1',
  insertBlankLine: true,
  insertBlankLineSize: '1',
  lineHeight: '12',
  marginTop: '50',
  marginRight: '50',
  marginBottom: '50',
  marginLeft: '50'
}
 
/*
* create epub file
*/
convert(options, function (err) {
  if (err) console.log(err)
})

 

See also  Node.js Express Easy Payment PDF Invoice Generator in Javascript After Online Payment Using EasyInvoice Library Tutorial 2020

 

This will take the input epub book file and it will output the pdf file.

 

 

Leave a Reply