PDF Conversion and Unicode Error

Bug #1866364 reported by Maximiliano Sánchez on 2020-03-06
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

Hello. I have the following error converting to PDF. I have no idea how to solve it and I can't find any other way to convert EPUB or MOBI files to PDF which is what led me to download Calibre. Thanks in advance for any help provided.

I'm using Calibre Portable, version 4.11.2 (2020 - 03 - 05) on Windows 7 Ultimate 64-bit.
Core i3 Processor. 16GB RAM. Lots of free disk space.

Converting from EPUB to PDF triggers the error, something about Unicode. Description below.
Converting from MOBI to PDF also triggers the same error.
Converting from EPUB to DOCX or TXT does not trigger the error. Conversion is successful.
Converting from MOBI to DOCX or TXT does not trigger the error. Conversion is successful.

Error seems to be connected with PDF Format and Unicode.
I have Adobe Acrobat Professional 9 installed on my computer but not running at the moment of the conversion. Could it have any influence on triggering this error?

Error:

calibre, version 4.11.2 (win32, embedded-python: True)
Conversion error: Failed: Convert book 1 of 1 (The Everything Golf Instruction Book: From Teeing Off to Sinking the Putt, All You Need to Play the Game)

Convert book 1 of 1 (The Everything Golf Instruction Book: From Teeing Off to Sinking the Putt, All You Need to Play the Game)
C:\Users\Usuario\Desktop\Calibre\Calibre Portable\Calibre\\app\pylib.zip\dateutil\parser\_parser.py:1177: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
Conversion options changed from defaults:
  pdf_serif_family: u'MS Shell Dlg 2'
  read_metadata_from_opf: u'C:\\Users\\Usuario\\AppData\\Local\\Temp\\calibre_jxhyzu\\o9sygm.opf'
  output_profile: u'ipad3'
  verbose: 2
  cover: u'C:\\Users\\Usuario\\AppData\\Local\\Temp\\calibre_jxhyzu\\uuvxx7.jpeg'
Resolved conversion options
calibre version: 4.11.2
{'asciiize': False,
 'author_sort': None,
 'authors': None,
 'base_font_size': 0.0,
 'book_producer': None,
 'change_justification': u'original',
 'chapter': u"//*[((name()='h1' or name()='h2') and re:test(., '\\s*((chapter|book|section|part)\\s+)|((prolog|prologue|epilogue)(\\s+|$))', 'i')) or @class = 'chapter']",
 'chapter_mark': u'pagebreak',
 'comments': None,
 'cover': u'C:\\Users\\Usuario\\AppData\\Local\\Temp\\calibre_jxhyzu\\uuvxx7.jpeg',
 'custom_size': None,
 'debug_pipeline': None,
 'dehyphenate': True,
 'delete_blank_paragraphs': True,
 'disable_font_rescaling': False,
 'duplicate_links_in_toc': False,
 'embed_all_fonts': False,
 'embed_font_family': None,
 'enable_heuristics': False,
 'expand_css': False,
 'extra_css': None,
 'filter_css': u'',
 'fix_indents': True,
 'font_size_mapping': None,
 'format_scene_breaks': True,
 'html_unwrap_factor': 0.4,
 'input_encoding': None,
 'input_profile': <calibre.customize.profiles.InputProfile object at 0x031CD430>,
 'insert_blank_line': False,
 'insert_blank_line_size': 0.5,
 'insert_metadata': False,
 'isbn': None,
 'italicize_common_cases': True,
 'keep_ligatures': False,
 'language': None,
 'level1_toc': None,
 'level2_toc': None,
 'level3_toc': None,
 'line_height': 0.0,
 'linearize_tables': False,
 'margin_bottom': 5.0,
 'margin_left': 5.0,
 'margin_right': 5.0,
 'margin_top': 5.0,
 'markup_chapter_headings': True,
 'max_toc_links': 50,
 'minimum_line_height': 120.0,
 'no_chapters_in_toc': False,
 'no_inline_navbars': False,
 'output_profile': <calibre.customize.profiles.iPad3Output object at 0x031CD6F0>,
 'page_breaks_before': u'/',
 'paper_size': u'letter',
 'pdf_add_toc': False,
 'pdf_default_font_size': 20,
 'pdf_footer_template': None,
 'pdf_header_template': None,
 'pdf_hyphenate': False,
 'pdf_mark_links': False,
 'pdf_mono_family': u'Courier',
 'pdf_mono_font_size': 16,
 'pdf_odd_even_offset': 0.0,
 'pdf_page_margin_bottom': 72.0,
 'pdf_page_margin_left': 72.0,
 'pdf_page_margin_right': 72.0,
 'pdf_page_margin_top': 72.0,
 'pdf_page_number_map': None,
 'pdf_page_numbers': False,
 'pdf_sans_family': u'Helvetica',
 'pdf_serif_family': u'MS Shell Dlg 2',
 'pdf_standard_font': u'serif',
 'pdf_use_document_margins': False,
 'prefer_metadata_cover': False,
 'preserve_cover_aspect_ratio': False,
 'pretty_print': False,
 'pubdate': None,
 'publisher': None,
 'rating': None,
 'read_metadata_from_opf': u'C:\\Users\\Usuario\\AppData\\Local\\Temp\\calibre_jxhyzu\\o9sygm.opf',
 'remove_fake_margins': True,
 'remove_first_image': False,
 'remove_paragraph_spacing': False,
 'remove_paragraph_spacing_indent_size': 1.5,
 'renumber_headings': True,
 'replace_scene_breaks': u'',
 'search_replace': '[]',
 'series': None,
 'series_index': None,
 'smarten_punctuation': False,
 'sr1_replace': None,
 'sr1_search': None,
 'sr2_replace': None,
 'sr2_search': None,
 'sr3_replace': None,
 'sr3_search': None,
 'start_reading_at': None,
 'subset_embedded_fonts': False,
 'tags': None,
 'timestamp': None,
 'title': None,
 'title_sort': None,
 'toc_filter': None,
 'toc_threshold': 6,
 'toc_title': None,
 'transform_css_rules': '[]',
 'uncompressed_pdf': False,
 'unit': u'inch',
 'unsmarten_punctuation': False,
 'unwrap_lines': True,
 'use_auto_toc': False,
 'use_profile_size': False,
 'verbose': 2}
InputFormatPlugin: EPUB Input running
on C:\Users\Usuario\AppData\Local\Temp\calibre_jxhyzu\lhkt6f.epub
Found HTML cover OEBPS/9781580626729_epub_cvi_r1.htm
Parsing all content...
Parsing OEBPS/9781580626729_epub_toc_r1.htm ...
Parsing OEBPS/9781580626729_epub_col2_r1.htm ...
Parsing OEBPS/9781580626729_epub_cvi_r1.htm ...
Parsing OEBPS/9781580626729_epub_tp_r1.htm ...
Parsing OEBPS/9781580626729_epub_fm_r1.htm ...
Parsing OEBPS/9781580626729_epub_itr_r1.htm ...
Parsing OEBPS/9781580626729_epub_app_r1.htm ...
Parsing OEBPS/9781580626729_epub_c01_r1.htm ...
Parsing OEBPS/9781580626729_epub_c02_r1.htm ...
Parsing OEBPS/9781580626729_epub_appb_r1.htm ...
Parsing OEBPS/9781580626729_epub_c03_r1.htm ...
Parsing OEBPS/9781580626729_epub_c04_r1.htm ...
Parsing OEBPS/9781580626729_epub_css_r1.css ...
Parsing OEBPS/9781580626729_epub_c05_r1.htm ...
Parsing OEBPS/9781580626729_epub_c06_r1.htm ...
Parsing OEBPS/9781580626729_epub_c07_r1.htm ...
Parsing OEBPS/9781580626729_epub_c08_r1.htm ...
Parsing OEBPS/9781580626729_epub_c09_r1.htm ...
Parsing OEBPS/9781580626729_epub_c10_r1.htm ...
Parsing OEBPS/9781580626729_epub_c11_r1.htm ...
Parsing OEBPS/9781580626729_epub_c12_r1.htm ...
Parsing OEBPS/9781580626729_epub_c14_r1.htm ...
Parsing OEBPS/9781580626729_epub_c15_r1.htm ...
Parsing OEBPS/9781580626729_epub_c16_r1.htm ...
Parsing OEBPS/9781580626729_epub_c17_r1.htm ...
Parsing OEBPS/9781580626729_epub_c18_r1.htm ...
Parsing OEBPS/9781580626729_epub_c19_r1.htm ...
Parsing OEBPS/9781580626729_epub_c20_r1.htm ...
Parsing OEBPS/9781580626729_epub_c13_r1.htm ...
Parsing OEBPS/9781580626729_epub_col1_r1.htm ...
Parsing OEBPS/9781580626729_epub_cop_r1.htm ...
Parsing OEBPS/9781580626729_epub_appa_r1.htm ...
Reading TOC from NCX...
Merging user specified metadata...
Detecting structure...
 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: Chapter 10
 Detected chapter: Chapter 11
 Detected chapter: Chapter 12
 Detected chapter: Chapter 13
 Detected chapter: Chapter 14
 Detected chapter: Chapter 15
 Detected chapter: Chapter 16
 Detected chapter: Chapter 17
 Detected chapter: Chapter 18
 Detected chapter: Chapter 19
 Detected chapter: Chapter 20
 Detected chapter: Appendices
 Detected chapter: Appendix AResources
 Detected chapter: Appendix BGlossary
Flattening CSS and remapping font sizes...
Source base font size is 12.00000pt
Removing fake margins...
Found 523 items of level: p_2
Found 174 items of level: div_1
Found 57 items of level: p_3
Found 1097 items of level: p_1
Negative text indent detected at level p_2, ignoring this level
div_1 left margin stats: Counter({u'': 3})
div_1 right margin stats: Counter({u'': 3})
p_3 left margin stats: Counter({u'0': 57})
p_3 right margin stats: Counter({u'0': 57})
p_1 left margin stats: Counter({u'0': 1097})
p_1 right margin stats: Counter({u'0': 1097})
Removing page margins specified in the Adobe page template
Cleaning up manifest...
Trimming unused files from manifest...
Trimming u'OEBPS/9781580626729_epub_cvi_r1.htm' from manifest
Creating PDF Output...
Converting input as a text based book...
Python function terminated unexpectedly
  Size mismatch for glyph id: 0 prev_sz: 42 sz: 108 (Error Code: 1)
 Traceback (most recent call last):
  File "site.py", line 114, in main
  File "site.py", line 88, in run_entry_point
  File "site-packages\calibre\utils\ipc\worker.py", line 209, in main
  File "site-packages\calibre\gui2\convert\gui_conversion.py", line 43, in gui_convert_override
  File "site-packages\calibre\gui2\convert\gui_conversion.py", line 28, in gui_convert
  File "site-packages\calibre\ebooks\conversion\plumber.py", line 1275, in run
  File "site-packages\calibre\ebooks\conversion\plugins\pdf_output.py", line 188, in convert
  File "site-packages\calibre\ebooks\conversion\plugins\pdf_output.py", line 255, in convert_text
  File "site-packages\calibre\ebooks\pdf\html_writer.py", line 1230, in convert
  File "site-packages\calibre\ebooks\pdf\html_writer.py", line 960, in merge_fonts
  File "site-packages\calibre\ebooks\pdf\html_writer.py", line 916, in merge_font
  File "site-packages\calibre\utils\fonts\sfnt\merge.py", line 31, in merge_truetype_fonts_for_pdf
GlyphSizeMismatch: Size mismatch for glyph id: 0 prev_sz: 42 sz: 108

Fixed in branch master. The fix will be in the next release. calibre is usually released every alternate Friday.

 status fixreleased

Changed in calibre:
status: New → Fix Released

Thanks a million good sir. You rock. Glad to be of help detecting an error.

Acrobat Pro does not support EPUB or MOBI. And apart from those low-quality websites which offer file conversion like ZamZar or pdfcandy, there seems to be no other way to do this conversion as of now. I've asked everywhere on forums and nobody seemed to know any method to convert from EPUB to PDF. I was about to convince myself that there was no possible way to convert EPUB and MOBI to PDF before discovering your program. I'm really lucky. Calibre will save the day.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers