diff --git a/src/calibre/ebooks/pdf/render/links.py b/src/calibre/ebooks/pdf/render/links.py index 41b7fcfd39..188dbd4494 100644 --- a/src/calibre/ebooks/pdf/render/links.py +++ b/src/calibre/ebooks/pdf/render/links.py @@ -58,7 +58,13 @@ class Links(object): 0])}) if is_local: path = combined_path if href else path - annot['Dest'] = self.anchors[path][frag] + try: + annot['Dest'] = self.anchors[path][frag] + except KeyError: + try: + annot['Dest'] = self.anchors[path][None] + except KeyError: + pass else: url = href + (('#'+frag) if frag else '') purl = urlparse(url)