Skip to content

Commit

Permalink
script updated
Browse files Browse the repository at this point in the history
  • Loading branch information
dodeeric committed Jul 9, 2020
1 parent 91ca87f commit d3cc3a4
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions pdf2epubEX.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
#!/bin/bash

# Bash script to convert a PDF file to a fixed layout ePub file.
# By Eric Dodémont (eric.dodemont@skynet.be)
# Belgium, July 2020
#
# This bash script uses the pdf2htmlEX tool to convert a PDF file (myfile.pdf) to a fixed layout ePub file (myfile.epub).
# The layout is retained and all the fonts are embedded.
# The pdf2htmlEX tool converts a PDF file into HTML (with CSS, JS, fonts, and bitmap and/or vector images).
# Usage: ./pdf2epubEX.sh myfile.pdf
# The PDF file has to be in the same directory as the script.
# Result will be: myfile.epub
# Prerequisites: You have to install pdf2htmlEX before using the script.

cp $1 ./mybook.pdf

widthinpts=$(pdfinfo $1 2>/dev/null | grep "Page size" | cut -d " " -f8) # Unit is points (pts)
Expand Down Expand Up @@ -52,17 +64,19 @@ echo -n "Language: (e.g.: fr): " ; read language
echo -n "ISBN number: " ; read isbn
echo -n "Subject (e.g.: history): " ; read tags

title="PDF2ePub: $dpi dpi / $imgformat"
author="John Doe"
publisher="O'Reilly"
year="2020"
language="en"
isbn="1234567890"
tags="sciences"
#title="PDF2ePub: $dpi dpi / $imgformat"
#author="John Doe"
#publisher="O'Reilly"
#year="2020"
#language="en"
#isbn="1234567890"
#tags="sciences"

echo "Wait..."

pdf2htmlEX -f 1 -l 75 --embed-css 0 --embed-font 0 --embed-image 0 --embed-javascript 0 --embed-outline 0 --split-pages 1 --bg-format $imgformat --dpi $dpi --fit-width $hres --fit-height $vres --page-filename mybook%04d.page --css-filename mybook.css mybook.pdf
pdf2htmlEX --embed-css 0 --embed-font 0 --embed-image 0 --embed-javascript 0 --embed-outline 0 --split-pages 1 --bg-format $imgformat --dpi $dpi --fit-width $hres --fit-height $vres --page-filename mybook%04d.page --css-filename mybook.css mybook.pdf

#pdf2htmlEX -f 1 -l 75 --embed-css 0 --embed-font 0 --embed-image 0 --embed-javascript 0 --embed-outline 0 --split-pages 1 --bg-format $imgformat --dpi $dpi --fit-width $hres --fit-height $vres --page-filename mybook%04d.page --css-filename mybook.css mybook.pdf

# Update the top and bottom of each page file

Expand Down

0 comments on commit d3cc3a4

Please sign in to comment.