View Single Post
Old 07-04-2021, 02:20 PM   #21
adamaymas
Junior Member
adamaymas doesn't litteradamaymas doesn't litter
 
Posts: 5
Karma: 108
Join Date: Sep 2011
Device: SONY PRS-350
Hi, I know this is an old thread but I had the same issues with converting to vertical text for kindle. I have a little bash script that works in two stages to produce a AZW3 file that works on my kindle paper white. It's for converting the XHTML files you can get from aozora.gr.jp, but it could easily be adapted for other sources by adjusting the two lines that call ebook-convert. Here it is:

Code:
name=${1%%.html}
ebook-convert "$name".html "$name"

echo -en "\n\
body {\n\
\t writing-mode: vertical-rl;\n\
\t line-break: normal;\n\
\t -epub-writing-mode: vertical-rl;\n\
\t -webkit-writing-mode: vertical-rl;\n\
\t -epub-line-break: normal;\n\
\t -webkit-line-break: normal;\n\
\t line-height: 150%;\n\
\t padding: 1em 1em;\n\
\t font-family: serif, sans-serif\n\
}\n"\
>>"$name"/page_styles.css

sed -i -e 's:</metadata>:<meta\ name="primary-writing-mode"\ content="vertical-rl"/>\n</metadata>:' "$name"/content.opf

sed -i -e 's:<spine.*:<spine\ toc="ncx"\ page-progression-direction="rtl">:' "$name"/content.opf

sed -i -e 's/<dc:language>.*/<dc:language>jpn<\/dc:language>/' "$name"/content.opf

zip "$name".zip add -j "$name"/*

ebook-convert "$name".zip "$name".azw3

rm -Rf "$name"
rm -f "$name".zip
adamaymas is offline   Reply With Quote