Open jacob-hegna opened 10 years ago
*Cloudconvert's website
I do intend on supporting more formats in the near future, in particular OpenDocument formats and EPUB (possibly using an adapted version of Viewer.js), but relying on a (commercial) third party for conversion is out of the question. Cloudconvert is therefore not an option.
EPUB and other ebooks formats are what I would ask.
I think epub support we can gain by convert to pdf by ebook-convert (calibre package). Yea, this is very heavy requirements, but I think support epub can be optional.
I tested it now and work well...
adas@adas-AMILO-Pro-V3205:/tmp/a$ curl "http://www.epubbooks.com/downloads/1971" >> a.epub
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 345k 0 345k 0 0 239k 0 --:--:-- 0:00:01 --:--:-- 239k
adas@adas-AMILO-Pro-V3205:/tmp/a$ ebook-convert "a.epub" "a.pdf";
1% Konwertuję plik źródłowy na plik HTML...
InputFormatPlugin: EPUB Input running
on /tmp/a/a.epub
Found HTML cover OEBPS/cover.xhtml
Parsing all content...
34% Przekształcanie książki...
Merging user specified metadata...
Detecting structure...
Detected chapter: Part One
Detected chapter: Part One
Detected chapter: Chapter 1
Detected chapter: Chapter 2
Detected chapter: Chapter 3
Detected chapter: Chapter 4
Detected chapter: Chapter 5
Detected chapter: Chapter 6
Detected chapter: Chapter 7
Detected chapter: Chapter 8
Detected chapter: Part Two
Detected chapter: Part Two
Detected chapter: Chapter 1
Detected chapter: Chapter 2
Detected chapter: Chapter 3
Detected chapter: Chapter 4
Detected chapter: Chapter 5
Detected chapter: Chapter 6
Detected chapter: Chapter 7
Detected chapter: Chapter 8
Detected chapter: Chapter 9
Detected chapter: Part Three
Detected chapter: Part Three
Detected chapter: Chapter 1
Detected chapter: Chapter 2
Detected chapter: Chapter 3
Detected chapter: Chapter 4
Detected chapter: Chapter 5
Detected chapter: Chapter 6
Detected chapter: AppendixThe Principles of NewspeakNewspeak was the
Flattening CSS and remapping font sizes...
Source base font size is 12.00000pt
Removing fake margins...
Cleaning up manifest...
Trimming unused files from manifest...
Creating PDF Output...
67% Działa wtyczka PDF Output
The cover image has an id != "cover". Renaming to work around bug in Nook Color
Got bus address: "unix:abstract=/tmp/dbus-vVC2QONAGz,guid=118cfbe2b2640dc05caa828c53cc2f74"
Connected to accessibility bus at: "unix:abstract=/tmp/dbus-vVC2QONAGz,guid=118cfbe2b2640dc05caa828c53cc2f74"
Registered DEC: true
68% Rendered bk01-toc.xhtml
69% Rendered index.xhtml
70% Rendered ch01.xhtml
71% Rendered ch01s01.xhtml
72% Rendered ch01s02.xhtml
73% Rendered ch01s03.xhtml
74% Rendered ch01s04.xhtml
76% Rendered ch01s05.xhtml
77% Rendered ch01s06.xhtml
78% Rendered ch01s07.xhtml
79% Rendered ch01s08.xhtml
80% Rendered ch02.xhtml
81% Rendered ch02s01.xhtml
82% Rendered ch02s02.xhtml
84% Rendered ch02s03.xhtml
85% Rendered ch02s04.xhtml
86% Rendered ch02s05.xhtml
87% Rendered ch02s06.xhtml
88% Rendered ch02s07.xhtml
89% Rendered ch02s08.xhtml
90% Rendered ch02s09.xhtml
92% Rendered ch03.xhtml
93% Rendered ch03s01.xhtml
94% Rendered ch03s02.xhtml
95% Rendered ch03s03.xhtml
96% Rendered ch03s04.xhtml
97% Rendered ch03s05.xhtml
98% Rendered ch03s06.xhtml
100% Rendered ch04.xhtml
Rendered PDF in 11.8664 seconds:
PDF output written to /tmp/a/a.pdf
Plik wyjściowy zapisany do /tmp/a/a.pdf
I got https://pdf.yt/d/K67SQtIZ5tCnNtfA .
But this require don't only simple conversion before save to database, because I think this is good to support download original epub file too eg.:
With that we can obtain support for a lof of file format http://manual.calibre-ebook.com/cli/ebook-convert.html .
In this way we can also add support fg. odt, because we can convert by:
libreoffice --headless --convert-to pdf filename.odt
I'd really prefer to display the original documents with a native viewer. Conversion tends to cause display glitches (or even unreadable documents), and I'd rather take the time to implement it correctly than to have it break half of the time.
From a technical point of view it's perfectly possible to implement it natively; PDF and ODF are already supported by viewer.js, and EPUB is effectively just HTML/CSS (thus writing a plugin for that should be trivial). The main issue is in retaining the UI of the pdf.js viewer - the viewer.js UI is... barebones at best, and I'd really prefer to just port over the pdf.js viewer to viewer.js. That'll take time, though.
Of course a pull request doing the above would be very welcome, provided that it's sufficiently polished/tested. Otherwise, I'll have to finish a number of other outstanding tasks (on other projects) first, before I can start work on this particular issue.
EDIT: I am planning on allowing for download of converted versions later on, it's just the main viewer display that I want to use a native viewer for.
Using Cloudconvert's public api, it is possible to allow the uploading of files such as docx and rtf, hosting as PDF, then it is also possible to give the option to download as any file type