title_body: Problem with hyperlinks after converting chm to epub with calibre I have a book in .chm format and I had to convert it into .epub format so I used Calibre for Windows for this operation. I am satisfied with the result except for a hyperlink problem. There are some words in the book that you click to jump to another page where the word's definition is found. So in .epub format when I click to one of those words the link takes me to the beginning of the page where the word is found. By saying beginning of the page, I mean the page group that is linked to one of content title on the left in .chm formatted documents.
  
  In broad explanation, in .chm books you have contents tab on the left and there are titles and when you click one of them the page can be very long or short so when I click a word in a text (in the .epub book) to go to its definition page I am being sent to the top of the page then I have to find the definition by myself on that long page.
  
  What can be the problem? I am not very familiar with the file formats so I cannot identify the problem to find the solution. Are these kind of hyperlinks directly linked to word (like searching) or to a page number?
  
  Thanks
  
  Update One:
  Here is how one of the links appears in .chm
  
  mk:@MSITStore:C:\Users\XXXX\Desktop\Mybook.chm::/7859final/LiB0052.html#8960
  
  
  And this is .epub version of the same link source
  
  file:///C:/Users/XXXX/Desktop/Mybook/LiB0052_split_001.html#8960
  
  
  This is html code
  
  &lt;a href="LiB0052_split_001.html#8960" target="_parent" class="pcalibre2 pcalibre3"&gt;GARP&lt;/a&gt;
upvoted_answer: CHM and epub are based on html files, but generally the production method for chm determines how simple the code is. Often the HTML files in the CHM files are made of complicated code which confuse calibre.  
  
  The first question to ask is: why do you want to convert it to epub? 1)Because you have one special file  you wish to read in that format or 2)eventually you want to republish (i.e., "repurpose") the content so that others can read it in an epub reader? or 3)you have many different chm files you wish to convert. 
  
  If you need it just for your reference, I would try skipping the step of converting to epub and just look for a chm reader on your device. Android and Ios have decent apps which can read chm files natively. That is always the best option. 
  
  I tried converting a simple chm to epub using calibre. Guess what? All the hyperlinks work for me. It sounds as if you are saying that the glossary for your chm contains all the definitions, and the problem is that every defined word goes to the top of the page (instead of going to the right part of the page).  My test files don't have anchors, so I cannot see what you are talking about. 
  
  To diagnose the problem, you need to view the source of the chm and epub. 
  
  The first step is renaming the epub to zip and then unzipping everything so you can see the html. Then open one of the files in a text editor (or open it in a browser, right click and select VIEW SOURCE). 
  
  You can also view source in a chm file on Windows. Just right click on the topic with a defective hyperlink, view the hyperlink and see what is supposed to happen. 
  
  From doing these two steps (and especially the first), you can see why the hyperlinks in the epub are not working. Perhaps epub stripped the part of the hyperlink that would put the target hyperlink to the middle of the page. 
  Normally it should look like this &lt;a href="first.html#elephant"&gt; where "elephant" refers to the anchor in the middle of the page. 
  
  Another possible cause of the problem is that the chm file might be doing weird stuff. Perhaps, depending on the authoring tool which produced the chm file, javascript is making the anchor (I'm guessing randomly here). 
  
  Another possibility is that when producing the epub file from chm, for some reason calibre removed the anchor references. If the glossary page does not have something like: 
  
  &lt;h2 id="elephant"&gt; or &lt;a id="elephant"&gt;
  
  
  it will be impossible for the hyperlink to find the anchor on that file. 
  
  Calibre gives you powerful tools (like regular expressions) to rewrite certain code when converting. (although it may take you a while to learn how). If you are motivated, you can probably just re-edit the html files and make sure the references work and then rezip it again and rename the file extension to epub.  
  
  Again, without seeing the HTML source, it's hard to know where the problem lies.  But again, finding an chm reader to read the file natively would probably be the easiest thing to do.