This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Convert PDFs to EPUB with Java

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm still very new to Java Programming, but I let my good friend convince me to do a project for his startup. Somehow, I need to convert PDFs to EPUB within a Java application running on Linux. I've checked open source projects, but I can't find anything that will do what I need. Any help is much apricated.

Thanks,
Jim
 
Rancher
Posts: 3520
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

new to Java Programming


This sounds like something that is way past what a beginner could do.  Unless you are lucky enough to find a program that does what you are looking for and only requires a bit of input/output changes.

 
Rancher
Posts: 4304
47
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found this project on GitHub:
https://github.com/jmrozanec/pdf-converter

But in general the conversion of PDF to EPUB is very much an "it depends", at least as far as a good conversion goes.

See this article:
https://blog.idrsolutions.com/2015/01/pdf-to-epub-conversion/
 
Greenhorn
Posts: 2
1
  • Likes 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Jim,

My name is Boris and I’m a product advocate for Aspose. Our products can do what you're asking with just a couple of lines of code. For example, converting PDF to EPUB using our Aspose.PDF for Java product could look like this:



To see more samples how to use Aspose.PDF product to convert PDF to other file formats please check https://docs.aspose.com/display/pdfjava/Convert+PDF+to+other+Formats

Please check Aspose.PDF for Java home page https://products.aspose.com/pdf/java to learn about all other PDF features.

Let me know if it works for you, or if you have any problems or questions.


Many Thanks,
Boris
 
Marshal
Posts: 66134
250
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
 
Saloon Keeper
Posts: 21227
137
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A PDF is a very different sort of file than an EPUB.

Essentially, a PDF is an enhanced PostScript file, and like PostScript in general, that means that for the most part, the page layout is totally fixed. Which is good and bad, since reading PDF's of many books and documents printed for (for example) US Letter-sized pages are an abomination to read on a 7-inch tablet or cellphone screen.

In contrast, an EPUB is actually a special form of ZIP file with HTML pages in it and some XML metadata to keep things sorted out. For a standard book, each HTML "page" would usually correspond to one chapter of the book. PDF, incidentally, considers the document as one big chapter, although you can have hierarchical markers in it to support a table of contents.

In user-visible terms, however, the main difference is that the contents in an EPUB are reflowable, whereas you can only reflow a PDF if the PDF was designed to be reflowable. Reflowable text means that the page is formatted to fit the device instead of the device applying Procrustean operations on the page display. Although stuff with big illustrations and the like may not survive the reflowing process very well. Which is why I'm glad I now own a 10-inch tablet for such documents.

So if you're creating book-style documents from scratch, it's a good idea to write them specifically for EPUB - unless you're doing a technical or art book where PDF's absolute location abilities are essential. There is a plug-in for LibreOffice for EPUB publishing - you just have to use special styles to tell it how to organize things. There's also, incidentally, a plugin for Mozilla, so if you download a lot of related documents and would like them in a nice tidy ebook...

Calibre is a popular document management system that supports format conversions, including PDF-to-EPUB (or EPUB to PDF). It serves as a database for documents, and can present them via both personal desktop and web interfaces. It can do conversions in bulk, and even supports storing documents in multiple formats for the convenience of the user.
 
Dave Tolls
Rancher
Posts: 4304
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Calibre was what I had in mind when I dug up my second link above.
Having converted a PDF with images/diagrams etc into an EPUB ... well, let's just say it struggled a bit.

And plus points for using "procrustean"!
 
Tim Holloway
Saloon Keeper
Posts: 21227
137
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, Welcome to the Ranch, Boris!
 
Jimmy Smitherson
Greenhorn
Posts: 6
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all, especially Boris, for the help. I ened up going with the Aspsoe solution and it did the trick. I see that Aspose can do many other conversions as well. I will keep that in mind for future projects.
 
Boris Pazin
Greenhorn
Posts: 2
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jim,

Thanks for letting me know. I am glad to hear it was helpful for you.

Happy coding!
Boris
 
Seriously? That's what you're going with? I prefer this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!