Created attachment 1728039 [details] Patch to fix the bug Description of problem: conversion of an epub file to PDF format fails Version-Release number of selected component (if applicable): calibre-4.23.0-2.fc33.x86_64 How reproducible: always Steps to Reproduce: 1. ebook-convert /usr/share/calibre/quick_start/eng.epub eng.pdf Actual results: fails with: 1% Converting input to HTML... InputFormatPlugin: EPUB Input running on /usr/share/calibre/quick_start/eng.epub Found HTML cover text/titlepage.xhtml Parsing all content... 34% Running transforms on e-book... Merging user specified metadata... Detecting structure... Detected chapter: Task 3: The e-book editor Detected chapter: Task 5: Interacting with e-book readers Detected chapter: Task 6: The e-book viewer Flattening CSS and remapping font sizes... Source base font size is 12.00000pt Removing fake margins... Cleaning up manifest... Trimming unused files from manifest... Creating PDF Output... 67% Running PDF Output plugin 68% Parsed all content for markup transformation 70% Completed markup transformation 90% Rendered all HTML as PDF 91% Added links to PDF content Traceback (most recent call last): File "/usr/bin/ebook-convert", line 20, in <module> sys.exit(main()) File "/usr/lib64/calibre/calibre/ebooks/conversion/cli.py", line 401, in main plumber.run() File "/usr/lib64/calibre/calibre/ebooks/conversion/plumber.py", line 1274, in run self.output_plugin.convert(self.oeb, self.output, self.input_plugin, File "/usr/lib64/calibre/calibre/ebooks/conversion/plugins/pdf_output.py", line 188, in convert self.convert_text(oeb_book) File "/usr/lib64/calibre/calibre/ebooks/conversion/plugins/pdf_output.py", line 253, in convert_text convert( File "/usr/lib64/calibre/calibre/ebooks/pdf/html_writer.py", line 1286, in convert merge_fonts(pdf_doc, log) File "/usr/lib64/calibre/calibre/ebooks/pdf/html_writer.py", line 978, in merge_fonts t0_font, base_font, references_to_drop = merge_font(fonts, log) File "/usr/lib64/calibre/calibre/ebooks/pdf/html_writer.py", line 934, in merge_font base_font['sfnt'], width_for_glyph_id, height_for_glyph_id = merge_truetype_fonts_for_pdf(tuple(f['sfnt'] for f in descendant_fonts), log) File "/usr/lib64/calibre/calibre/utils/fonts/sfnt/merge.py", line 61, in merge_truetype_fonts_for_pdf loca.update(offset_map) File "/usr/lib64/calibre/calibre/utils/fonts/sfnt/loca.py", line 81, in update self.raw = vals.tostring() AttributeError: 'array.array' object has no attribute 'tostring' Expected results: should generate a pdf Additional info: Replacing tostring with tobytes on line 81 of /usr/lib64/calibre/calibre/utils/fonts/sfnt/loca.py fixes the problem.
Updated the library file "/usr/lib64/calibre/calibre/utils/fonts/sfnt/loca.py" with the patch as suggested. But I got this error instead: $ ebook-convert in.epub out.pdf 1% Converting input to HTML... InputFormatPlugin: EPUB Input running on /home/user/in.epub Found HTML cover OEBPS/text/9781400207473_Cover.xhtml Parsing all content... 34% Running transforms on e-book... Merging user specified metadata... Detecting structure... Flattening CSS and remapping font sizes... Source base font size is 9.60000pt Removing fake margins... Cleaning up manifest... Trimming unused files from manifest... Trimming 'OEBPS/9781400207473_toc.ncx' from manifest Creating PDF Output... 67% Running PDF Output plugin The cover image has an id != "cover". Renaming to work around bug in Nook Color 68% Parsed all content for markup transformation 70% Completed markup transformation Traceback (most recent call last): File "/usr/bin/ebook-convert", line 20, in <module> sys.exit(main()) File "/usr/lib64/calibre/calibre/ebooks/conversion/cli.py", line 401, in main plumber.run() File "/usr/lib64/calibre/calibre/ebooks/conversion/plumber.py", line 1275, in run self.opts, self.log) File "/usr/lib64/calibre/calibre/ebooks/conversion/plugins/pdf_output.py", line 188, in convert self.convert_text(oeb_book) File "/usr/lib64/calibre/calibre/ebooks/conversion/plugins/pdf_output.py", line 255, in convert_text log=self.log, cover_data=self.cover_data, report_progress=self.report_progress File "/usr/lib64/calibre/calibre/ebooks/pdf/html_writer.py", line 1232, in convert manager = RenderManager(opts, log, container.root) File "/usr/lib64/calibre/calibre/ebooks/pdf/html_writer.py", line 278, in __init__ ans.setUrlRequestInterceptor(self.interceptor) AttributeError: 'QWebEngineProfile' object has no attribute 'setUrlRequestInterceptor'
I guess this is a separate bug. I don't have a problem with setUrlRequestInterceptor but I suspect that is the particular .epub files I was trying. I see a mention of this upstream: https://bugs.launchpad.net/calibre/+bug/1850835 Do you have a problem with the file I used to test (/usr/share/calibre/quick_start/eng.epub) which is part of the calibre documentation? i.e. do you have a separate problem or is it my fix, that is causing a problem. I think the former.
(In reply to nvwarr from comment #2) > I guess this is a separate bug. I don't have a problem with > setUrlRequestInterceptor but I suspect that is the particular .epub files I > was trying. I see a mention of this upstream: > > https://bugs.launchpad.net/calibre/+bug/1850835 > > Do you have a problem with the file I used to test > (/usr/share/calibre/quick_start/eng.epub) which is part of the calibre > documentation? i.e. do you have a separate problem or is it my fix, that is > causing a problem. I think the former. Hi, thanks for your quick reply. I didn't use your example file, but another e-book so the reproduction steps is moot. I was a bit quick on reporting this issue. However, the issue is not present in the latest upstream binary release[1], which is 5.6 at this time. Using the latest upstream version works as intended. I have no further quarrels with the version available in Fedora, since I circumvented it. Looking forward to the 5.6 release. [1]: https://calibre-ebook.com/download_linux
I'll close this… We have the newer versions in later Fedora releases, let's concentrate on keeping the versions up to date there.
This comment was flagged a spam, view the edit history to see the original text if required.