Answers.Body: <p>When the DjVu support for Calibre was added a few years ago, it was implemented by taking the  text layer, when available, and extract and convert that to textual material usable for conversion, by Calibre, to other formats. When available it uses the C++ based <code>djvu2txt</code> from the djvu-libre toolset, otherwise it uses a, much slower, decoding done in Python.</p>
  
  <p>That text layer can be generated when "printing" to DjVu, but it normally is built from the <em>image material</em> that you get when you scan files to the DjVu format. And the layer allows you, in most DjVu viewers, to select something on the image and then either copy the image rectangle or the associated text in the text layer.</p>
  
  <p>What you see in WinDjView is the image layer in your DjVu file, what you see in the EbookViewer is the text layer. The text layer has some positioning information (otherwise a viewer would not be able to associate text with a picked area of the image data), but most of that is discarded and only used to make paragraphs.</p>
  
  <p>When I wrote the original DjVu support for Calibre (several years ago), I did so, to make it possible for conversion as indicated above. I had no idea that this made it into the Calibre ebook-viewer. The ebook viewer should directly use the image data, but it obviously doesn't (and that is even less trivial than writing a Python based extractor of the text layer). </p>
  
  <p>I tested viewing a DjVu file <em>without text layer</em> on a recent version of the Calibre ebook viewer. It shows nothing, which confirms my expectation.
  It could be that the ebook-viewer just picked up the DjVu plugin by using the same interface as the convertor, that would make sense, but in the case of DjVu files that is not the right approach. IIRC there was no way to provide such a plugin and tell Calibre it should only be used for conversion (and not for display).</p>
  
  <p>You're not doing anything wrong. I would rather say this works as can be expected knowing the implementation, but that doesn't make it very useful for books that are not paragraph oriented. So in your words: it is converting the books to some basic format. And this is not easily/quickly fixed.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-29T17:06:14.813Z
Answers.Text: I am hugely grateful that YOU are answering given the fact that you were involved in calibre directly, I am very happy and I thank you for writing that software!!!!
  So, there is no solution except using another viewer to view calibre files? This seems like a huge usability bug on calibre, since
  the project claims to be a solution for all your ebook needs, but can't show djvu how it's supposed. Am I right?
Answers.UserDisplayName: Santropedro
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-29T17:06:46.207Z
Answers.Text: Most people aren't interested in viewing books in text layer I guess. At least there should be a clear option, even by default, to show image layer. Am I right?
  I need your help to know if I'm understanding the situation correctly.
  
  So, I want to tell calibre developers, what do I say to them? I want to contact them and tell them in Windows 10 this does not work.
  I will give you more data: Calibre does not open pdf: it crashes. This is ridiculous.
  What means "printing" to djvu in your second paragraph in your answer? I understood your answer don't worry!!!
Answers.UserDisplayName: Santropedro
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-29T17:10:24.037Z
Answers.Text: Sorry for being unclear. Thanks for telling me that I'm not doing wrong becayse then I will change to another viewer. Now, should I report usability bug? How it's possible they overlook such a basic feature? Possibly there is something wrong with windows 10? I know you can't answer this. But it seems super misterious, Well thank you a lot !!!
Answers.UserDisplayName: Santropedro
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-29T17:11:03.027Z
Answers.Text: The image layer should be the one shown by default, but that is not implemented (at least not by me). It doesn't work at all (I work on LInux). With the PDF you might have the same issue: that it is images only. With printing I mean from Word or some similar program print directly to a DjVu file, then it is easy to add the text layer to the image layer. But most DjVu files come from scans.
Answers.UserDisplayName: Anthon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-29T17:15:01.997Z
Answers.Text: You can file a bug, but for text only books without much layout this behavior is IMO better than not showing anything at all. I think it might be difficult to programmatically tell if displaying the textlayer makes sense or not. Best would be to have image display, but the djvu libre library is C++ and horrible to use. And I only rewrote the text decoding part in Python (and C).
Answers.UserDisplayName: Anthon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-29T17:17:11.023Z
Answers.Text: Yes, Linux is badass, I also have it! Same issue with pdf? interesting. Your use of the word printing is not the same as [this on wikipedia](https://en.wikipedia.org/wiki/Printing), that confused me, now I imagine you take a file and convert it from word to djvu, by creating images files but also the layer text, because indeed word stores letters and so text is readily available, in comparison to scans, in wich have to be recognised by a smart [ODR](https://en.wikipedia.org/wiki/Optical_character_recognition). Thanks.
Answers.UserDisplayName: Santropedro
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-29T17:17:56.843Z
Answers.Text: On the other hand filing a feature request asking that you can specify some third party viewer in Calibre for DjVu files would make sense. I think I'll do that. BTW for scanned papers DjVu is by far the best format: multipage and small image size, far better than PDF or TIFF.
Answers.UserDisplayName: Anthon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-29T17:18:23.810Z
Answers.Text: Yes I imagine you may find a use for this. I understand that something better than nothing and I agree on that hugely. But you should have the option. I'm thinking that you maybe have and I don't see it.
Answers.UserDisplayName: Santropedro
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-29T17:19:36.377Z
Answers.Text: No I don't have that option, I don't see the image layer either nor can I (AFAIK) specify an external viewer for the DjVu format.
Answers.UserDisplayName: Anthon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-29T17:23:08.223Z
Answers.Text: Try this (on windows 10 works): right click on a book cover > view > view specific format > open pdf with (if its pdf). This is what you need I think. There you can browse a new program for opening.
Answers.UserDisplayName: Santropedro
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-29T18:08:48.247Z
Answers.Text: There was a misunderstanding. When I meant "but you should have and option" I mean "it would be nice if the program had that feature of viewing the image layer." and when i said "you maybe have and i dont see it" I meant "maybe there is a feature and i dont see the button". With "you" I meant not Anthon but the program.
Answers.UserDisplayName: Santropedro
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-29T13:01:52.900Z
Answers.LastActivityDate: 2016-06-04T21:29:07.530Z
Answers.LastEditDate: 2016-06-04T21:29:07.530Z
Answers.UserDisplayName: Anthon
Body: <p>I'm using Calibre the ebook viewer to view PDFs, DjVu, and ePub books. I don't know what version the program is, since I couldn't find any about dialog to confirm it. But I downloaded a couple of weeks ago. There was a update very recently which I installed, so this could be due to bad installation or something like that.</p>
  
  <p>My problem is when viewing ebooks with Calibre viewer, two things happen:</p>
  
  <ol>
  <li><p>If I try to choose them with Calibre open from my library, then they never finish loading.</p></li>
  <li><p>If I open them from Windows, and I choose to "open with" Calibre the ebook viewer, the result is that they are displayed very badly, with a ugly standard font, with equations all ugly, It easier to show it so I will copy some images comparing how it's viewed with Calibre vs other viewers that work fine.</p></li>
  </ol>
  
  <p>Calibre with a DjVu, all the pages looks like this:</p>
  
  <p><a href="https://i.sstatic.net/LF0UE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/LF0UE.png" alt="how calibre wrongly displays a djvu"></a></p>
  
  <p>Other viewer (not calibre) can format equations, of the same ebook, and displays the whole book correctly, this is how it should look:
  <a href="https://i.sstatic.net/7Ehim.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7Ehim.png" alt="how the book should look, with nice equations, completely readable, like a scanned ebook that it is"></a></p>
  
  <p>I don't understand if Calibre is having a bug or if it's converting ebooks to some basic format. I don't understand why this happens. Help me to view books correctly.</p>
  
  <p>Edit (day 06/ month 05/year 2016): <a href="https://bugs.launchpad.net/calibre/+bug/1586827" rel="nofollow noreferrer">I filed a bug report and got a response from the developer</a>.</p>
  
Tags: <calibre>
Title: Calibre viewer displays books wrong
UserDisplayName: Santropedro
ThreadText: # Calibre viewer displays books wrong
  
  (Asked by: username_0 on 2016-05-28)
  
  I'm using Calibre the ebook viewer to view PDFs, DjVu, and ePub books. I don't know what version the program is, since I couldn't find any about dialog to confirm it. But I downloaded a couple of weeks ago. There was a update very recently which I installed, so this could be due to bad installation or something like that.
  
  My problem is when viewing ebooks with Calibre viewer, two things happen:
  
  1. If I try to choose them with Calibre open from my library, then they never finish loading.
  2. If I open them from Windows, and I choose to "open with" Calibre the ebook viewer, the result is that they are displayed very badly, with a ugly standard font, with equations all ugly, It easier to show it so I will copy some images comparing how it's viewed with Calibre vs other viewers that work fine.
  
  Calibre with a DjVu, all the pages looks like this:
  
  [![how calibre wrongly displays a djvu](https://i.sstatic.net/LF0UE.png)](https://i.sstatic.net/LF0UE.png)
  
  Other viewer (not calibre) can format equations, of the same ebook, and displays the whole book correctly, this is how it should look:
  [![how the book should look, with nice equations, completely readable, like a scanned ebook that it is](https://i.sstatic.net/7Ehim.png)](https://i.sstatic.net/7Ehim.png)
  
  I don't understand if Calibre is having a bug or if it's converting ebooks to some basic format. I don't understand why this happens. Help me to view books correctly.
  
  Edit (day 06/ month 05/year 2016): [I filed a bug report and got a response from the developer](https://bugs.launchpad.net/calibre/+bug/1586827).
  
  **Tags:** calibre
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-05-29. Score: 3 | Accepted answer
  
  When the DjVu support for Calibre was added a few years ago, it was implemented by taking the text layer, when available, and extract and convert that to textual material usable for conversion, by Calibre, to other formats. When available it uses the C++ based `djvu2txt` from the djvu-libre toolset, otherwise it uses a, much slower, decoding done in Python.
  
  That text layer can be generated when "printing" to DjVu, but it normally is built from the *image material* that you get when you scan files to the DjVu format. And the layer allows you, in most DjVu viewers, to select something on the image and then either copy the image rectangle or the associated text in the text layer.
  
  What you see in WinDjView is the image layer in your DjVu file, what you see in the EbookViewer is the text layer. The text layer has some positioning information (otherwise a viewer would not be able to associate text with a picked area of the image data), but most of that is discarded and only used to make paragraphs.
  
  When I wrote the original DjVu support for Calibre (several years ago), I did so, to make it possible for conversion as indicated above. I had no idea that this made it into the Calibre ebook-viewer. The ebook viewer should directly use the image data, but it obviously doesn't (and that is even less trivial than writing a Python based extractor of the text layer).
  
  I tested viewing a DjVu file *without text layer* on a recent version of the Calibre ebook viewer. It shows nothing, which confirms my expectation.
  It could be that the ebook-viewer just picked up the DjVu plugin by using the same interface as the convertor, that would make sense, but in the case of DjVu files that is not the right approach. IIRC there was no way to provide such a plugin and tell Calibre it should only be used for conversion (and not for display).
  
  You're not doing anything wrong. I would rather say this works as can be expected knowing the implementation, but that doesn't make it very useful for books that are not paragraph oriented. So in your words: it is converting the books to some basic format. And this is not easily/quickly fixed.
  
  > **Comments:**
  > **username_0**: I am hugely grateful that YOU are answering given the fact that you were involved in calibre directly, I am very happy and I thank you for writing that software!!!! So, there is no solution except using another viewer to view calibre files? This seems like a huge usability bug on calibre, since the project claims to be a solution for all your ebook needs, but can't show djvu how it's supposed. Am I right?  
  > **username_0**: Most people aren't interested in viewing books in text layer I guess. At least there should be a clear option, even by default, to show image layer. Am I right? I need your help to know if I'm understanding the situation correctly.  So, I want to tell calibre developers, what do I say to them? I want to contact them and tell them in Windows 10 this does not work. I will give you more data: Calibre does not open pdf: it crashes. This is ridiculous. What means "printing" to djvu in your second paragraph in your answer? I understood your answer don't worry!!!  
  > **username_0**: Sorry for being unclear. Thanks for telling me that I'm not doing wrong becayse then I will change to another viewer. Now, should I report usability bug? How it's possible they overlook such a basic feature? Possibly there is something wrong with windows 10? I know you can't answer this. But it seems super misterious, Well thank you a lot !!!  
  > **username_1**: The image layer should be the one shown by default, but that is not implemented (at least not by me). It doesn't work at all (I work on LInux). With the PDF you might have the same issue: that it is images only. With printing I mean from Word or some similar program print directly to a DjVu file, then it is easy to add the text layer to the image layer. But most DjVu files come from scans.  
  > **username_1**: You can file a bug, but for text only books without much layout this behavior is IMO better than not showing anything at all. I think it might be difficult to programmatically tell if displaying the textlayer makes sense or not. Best would be to have image display, but the djvu libre library is C++ and horrible to use. And I only rewrote the text decoding part in Python (and C).  
  > **username_0**: Yes, Linux is badass, I also have it! Same issue with pdf? interesting. Your use of the word printing is not the same as [this on wikipedia](https://en.wikipedia.org/wiki/Printing), that confused me, now I imagine you take a file and convert it from word to djvu, by creating images files but also the layer text, because indeed word stores letters and so text is readily available, in comparison to scans, in wich have to be recognised by a smart [ODR](https://en.wikipedia.org/wiki/Optical_character_recognition). Thanks.  
  > **username_1**: On the other hand filing a feature request asking that you can specify some third party viewer in Calibre for DjVu files would make sense. I think I'll do that. BTW for scanned papers DjVu is by far the best format: multipage and small image size, far better than PDF or TIFF.  
  > **username_0**: Yes I imagine you may find a use for this. I understand that something better than nothing and I agree on that hugely. But you should have the option. I'm thinking that you maybe have and I don't see it.  
  > **username_1**: No I don't have that option, I don't see the image layer either nor can I (AFAIK) specify an external viewer for the DjVu format.  
  > **username_0**: Try this (on windows 10 works): right click on a book cover > view > view specific format > open pdf with (if its pdf). This is what you need I think. There you can browse a new program for opening.  
  > **username_0**: There was a misunderstanding. When I meant "but you should have and option" I mean "it would be nice if the program had that feature of viewing the image layer." and when i said "you maybe have and i dont see it" I meant "maybe there is a feature and i dont see the button". With "you" I meant not username_1 but the program.  
  
  ---
  
  