repo-to-pdf icon indicating copy to clipboard operation
repo-to-pdf copied to clipboard

[Bug] CSS not applied to pdf created using Calibre

Open Akv2021 opened this issue 2 years ago • 0 comments

Hi,

  • I am converting a folder containing js and md files to pdf. Earlier it used to work correctly using Calibre as renderer.
  • But recently, I noticed the output PDF was just plain text. i.e. The code snippets did not have syntax highlighting etc.
  • On carefully investigating, I found the generated html file was correctly displayed (same as earlier), But the styling disappeared while converting to pdf.
  • I tried to run the calibre standalone from CLI and found it was not able to access assets in html5bp folder.
  • The error :
clbr://internal.invalid/book/output.html:10:Not allowed to load local resource: file:///<path>repo-to-pdf/html5bp/js/vendor/modernizr-2.6.2.min.js
clbr://internal.invalid/book/output.html:3979:Not allowed to load local resource: file:///<path>repo-to-pdf/html5bp/js/vendor/jquery-1.10.2.min.js
clbr://internal.invalid/book/output.html:3980:Not allowed to load local resource: file:///<path>repo-to-pdf/html5bp/js/plugins.js
clbr://internal.invalid/book/output.html:3981:Not allowed to load local resource: file:///<path>repo-to-pdf/html5bp/js/main.js
  • I also noticed that the recent commit to fix the similar issue for wkhtmltopdf was to include --enable-local-file-access flag. But I couldn't find any such flag for calibre.

  • I can see the styling on using wkhtmltopdf renderer.

  • Why I'd prefer to use calibre : Mainly because wkhtmltopdf has issue of splitting the lines.

  • Also each file is mentioned properly in the Table of Contents sidebar in the pdf when using Calibre. But in wkhtmltopdf lots of files are missing from TOC sidebar.

Would be adding any more details if required !

Akv2021 avatar Aug 12 '23 17:08 Akv2021