repo-to-pdf
repo-to-pdf copied to clipboard
[Bug] CSS not applied to pdf created using Calibre
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-accessflag. 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
wkhtmltopdfhas 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
wkhtmltopdflots of files are missing from TOC sidebar.
Would be adding any more details if required !