08-10-2012, 08:24 AM | #31 | |
Junior Member
Posts: 6
Karma: 10
Join Date: Aug 2012
Device: none
|
Quote:
It's redicolous, all I wanted to do was exporting a dokuwiki to pdf. If I had known that this will be so complicated I would have given this task to someone else Thanks & Regards |
|
08-13-2012, 10:29 AM | #32 | |
Junior Member
Posts: 6
Karma: 10
Join Date: Aug 2012
Device: none
|
Quote:
I fixed the problem and I wanted to inform you about it The problem was, that after validating the epub with sigil, sigil url-encoded the links to the image files! So the links get changed from something like "../Images/privat@images.jpeg" to "../Images/privat%40images.jpeg" which can not be found by prince later... Thanks for your help, my task is completed |
|
03-27-2013, 01:46 AM | #33 | |
Junior Member
Posts: 1
Karma: 10
Join Date: Mar 2013
Device: none
|
Quote:
Actually, I've never tried installing anything into Cygwin without using its manager, so I don't even know if the generic linux gz files will work. |
|
04-22-2013, 01:11 PM | #34 |
Connoisseur
Posts: 70
Karma: 515184
Join Date: Sep 2011
Location: Brasília
Device: Kindle3, iPad, Nook, Kobo, Positivo Alfa
|
Hi folks,
I'm getting an error message when running the script. It generates a zero KB PDF file. It happened with every ePUB file I tried. I changed file permissions, but it didn't work. I'm on a Mac. Does anyone have any clue about it? Any help is appreciated. Here's the error message: Code:
sh epub2pdf.sh test.epub test.pdf readlink: illegal option -- f usage: readlink [-n] [file ...] readlink: illegal option -- f usage: readlink [-n] [file ...] readlink: illegal option -- f usage: readlink [-n] [file ...] Cannot read file test.epub |
04-23-2013, 08:51 AM | #35 |
frumious Bandersnatch
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Well, evidently your readlink version does not support the -f option.
Anyway, this script has not been updated or even looked at for a very long time. Maybe you could try the GUI version, if you can get python and pyQT for your system. |
04-23-2013, 09:08 AM | #36 |
Connoisseur
Posts: 70
Karma: 515184
Join Date: Sep 2011
Location: Brasília
Device: Kindle3, iPad, Nook, Kobo, Positivo Alfa
|
Thanks Jellby, I'll try the GUI version.
|
12-26-2013, 07:48 AM | #37 |
frumious Bandersnatch
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
There's a calibre plugin version now!
|
12-26-2013, 10:55 AM | #38 | |
Member
Posts: 13
Karma: 24
Join Date: Dec 2013
Location: Florida, USA
Device: Kindle
|
Quote:
SteveT |
|
10-21-2014, 02:16 PM | #39 |
Junior Member
Posts: 2
Karma: 10
Join Date: Oct 2014
Device: ipad
|
How do you even load an epub to convert in the GUI version? I can't for the life of me work out how it works.
|
10-21-2014, 03:37 PM | #40 |
frumious Bandersnatch
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Do you mean this version? I'll answer there (where you should have asked).
|
02-21-2015, 10:32 AM | #41 |
Linux User
Posts: 323
Karma: 13682
Join Date: Aug 2007
Location: Germany
Device: Kindle 3
|
Wow, this is great! I was getting more and more frustrated by my Kindle's limited typographic abilities. I started converting some epubs to PDF by using Calibre to convert to RTF from there to LaTeX using rtf2latex – but then I had to do some manual tweaking for every epub. This is so much easier and looks almost as good as LaTeX.
One question though: I added some faint lines at the top and bottom of every page so that my Kindle doesn't do any auto-cropping of white space (which can't be disabled, as far as I can tell). There's always a small margin between the lines and the borders of the page. Do you know how I can get lines at the very top and bottom of the page? This is how my default.css looks at the moment: Code:
@font-face { font-family: serif; src: local("Sirba") } @font-face { font-family: sans-serif; src: local("Lato") } @font-face { font-family: monospace; src: local("Source Code Pro") } @page { size: 85mm 114mm; margin: 2mm 1mm 2mm 1mm !important; border-width: 0.1px; border-color:rgb(240,240,240); border-top-style:solid; border-bottom-style:solid; } body { font-size: 10pt !important; font-family: serif; text-align: justify; hyphens: auto; prince-hyphenate-lines:3; prince-image-resolution: 166dpi; orphans: 1; widows: 1; line-height: 1.4em; word-spacing: 0.5pt; } h1, h2, h3, h4, h5, h6 { hyphens: none; } :lang(it), :lang(es) { hyphenate-before: 3; hyphenate-after: 3; } Last edited by IceHand; 02-21-2015 at 10:45 AM. |
02-21-2015, 10:49 AM | #42 |
frumious Bandersnatch
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
I'd guess that's because of the margin, the margin goes outside the border, for spacing inside the border you'd have to use padding. Try:
Code:
@page { size: 85mm 114mm; margin: 0 1mm 0 1mm !important; border-width: 0.1px; border-color:rgb(240,240,240); padding-top: 2mm; border-top-style:solid; padding-bottom: 2mm; border-bottom-style:solid; } |
02-21-2015, 10:54 AM | #43 |
Linux User
Posts: 323
Karma: 13682
Join Date: Aug 2007
Location: Germany
Device: Kindle 3
|
Thank you, Jellby, that works perfectly! I also found out that by reducing border-width to 0.01px the lines are as good as invisible on the Kindle while still preventing the auto-crop.
|
03-03-2015, 03:37 AM | #44 |
Junior Member
Posts: 2
Karma: 10
Join Date: Mar 2015
Device: bla
|
Hi there
Helllo from Russia! Nice work . I was used ebook-convert, but it's very slooow and little bugy. Then i wrote a simple bashscript, but script wasn't smart enough without xml parsing. Until i found your script.
Prince is good, nice ability to adapt file for e-read-devices, but needs to remove logo manually (I'm using "Master PDF Editor" http://code-industry.net). So, i wrote a modification based on your bash script (for my humble printing needs). It uses Fuse-zip (apt-get install fuse-zip) and WkHTMLtoPDF (wk means WebKit http://wkhtmltopdf.org) instead of Unzip and Prince. Fuse-zip mounting a little faster then unzip unpacking and WkHTMLtoPDF have no watermark and it's opensource. But WkHTMLtoPDF have no options for metadata, like in Prince (but i found in your script it doesn't used), and output pdf file size some times a little bigger (may be fonts). To test WkHTMLtoPDF you can try firefox addon "Print pages to PDF", which based on it. And one sad thing: WkHTMLtoPDF can't print svg cover (cover image in epub usually wrapped in svg tag). But! I maid a workaround in script (unwrap svg image tag to img tag), and it works, cover prints, but not upscaled to page size. Here is the script: epub2pdfwk.sh and a little custom style.css. Dependencies: (in addition to xmlstarlet and optional(for metadata) pdftk and recode): fuse-zip, wkhtmltopdf, sed. Options: are same plus 3 additionals:-n means not load default.css. (Using both -n -S equivalent to use only -s). -d means don't print cover. -o accepts wkhtmltopdf options (-o "--grayscale --quiet --page-size A5" Or -o "-gqs A5" Or -o "--page-width 800px --page-height 600px" Or -o "--header-font-name 'Liberation Sans' --footer-font-name 'Liberation Sans'" ...) (By default WkHTMLtoPDF prints to A4 size format). Already specified WkHTMLtoPDF options can be edited in "WKHTMLTOPDF OPTIONS SETTINGS" section of script in set_wkh2popts() function. They are self explained. And a little fix and improvement of your epub2pdf.sh: epub2pdf.sh Cheers! Just outline how script works: Code:
## Mount epub archive: #mkdir "$HOME"/.ZIP # umount before mount fusermount -uz "$HOME"/.ZIP fuse-zip -r "file.epub" "$HOME"/.ZIP -o modules=iconv,from_code=CP866,to_code=UTF8 (iconv here can fix ugly cyrillic filenames in nasty winziped archives) ## Convert html files to pdf wkhtmltopdf OEBPS/article0.xhtml ... OEBPS/article100.xhtml wkhtmltopdfoutput.pdf ## or: wkhtmltopdf -l --image-dpi 144 --image-quality 90 -T 5 -R 2 -B 5 -L 2 --user-style-sheet "${HOME}/bin/style.css" cover OEBPS/cover.xhtml OEBPS/article0.xhtml ... OEBPS/article100.xhtml ~/Documents/wkhtmltopdfoutput.pdf ## or even: wkhtmltopdf --lowquality --image-dpi 144 --image-quality 90 -T 5 -R 2 -B 5 -L 2 --user-style-sheet "${HOME}/bin/style.css" --page-size A5 -O Landscape --load-error-handling ignore --load-media-error-handling ignore --javascript-delay 2500 --header-left '[title]' --header-right '[date]' --header-font-name 'WenQuanYi Micro Hei' --header-font-size 8 --header-line --footer-left '[webpage]' --footer-right '[page] / [topage]' --footer-font-name 'WenQuanYi Micro Hei' --footer-font-size 8 --footer-line --custom-header 'User-Agent' 'Mozilla/5.0 (Windows NT 6.1; rv:25.0) Gecko/20100101 Firefox/25.0' --custom-header-propagation cover OEBPS/cover.xhtml OEBPS/article0.xhtml ... OEBPS/article100.xhtml ~/Documents/wkhtmltopdfoutput.pdf Last edited by pdurrant; 03-09-2015 at 05:45 AM. Reason: removed shortened URLs |
03-03-2015, 03:21 PM | #45 |
Junior Member
Posts: 2
Karma: 10
Join Date: Mar 2015
Device: bla
|
Script also posted on http://notablog.tk/epub2pdfwk-epub-v...z-wkhtmltopdf/.
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
converting pdf to epub | Gagan | ePub | 65 | 06-28-2017 11:57 PM |
Converting Sanskrit PDF to epub | sriniamble | Calibre | 17 | 11-25-2010 06:10 AM |
Error converting to PDF from EPub and PRC | gauravj | Calibre | 3 | 05-24-2010 02:07 AM |
Problem converting pdf to epub | smartin | Calibre | 3 | 05-02-2010 06:55 AM |
Help with converting PDF to epub | neilmarr | Sigil | 6 | 11-14-2009 09:26 AM |