Hello
I add an xhtml file called time.xhtml
Code:
<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
<title>template</title>
<link type="text/css" rel="stylesheet" href="stylesheet-tgp.css"/>
</head>
<body>
<h1>Date et Heure</h1>
<p id="datetime"></p>
<!-- Include JavaScript at the end of the body -->
<script src="META-INF/script.js"></script>
</body>
</html>
Then I add the java Script in META-INF/script.js
Code:
window.onload = function() {
setInterval(function(){
var date = new Date();
var displayDate = date.toLocaleDateString();
var displayTime = date.toLocaleTimeString();
document.getElementById('datetime').innerHTML = displayDate + " " + displayTime;
}, 1000); // 1000 milliseconds = 1 second
}
Then I add in the manifest
Code:
<item href="META-INF/script.js" media-type="application/javascript" properties="scripted"/>
<item id="id4" href="time.xhtml" media-type="application/xhtml+xml" properties="scripted"/>
All is runing perfect when I am in ebook-editor: Date and Time are displayed in the viewer.
But When I convert in pdf
Code:
ebook-convert testimp.epub testimp.pdf
1% Conversion de l’entrée en HTML…
InputFormatPlugin: EPUB Input running
on /home/guy/Documents/Livres/testimp.epub
Found HTML cover titlepage.xhtml
Parsing all content...
34% Exécution des transformations du livre numérique…
Merging user specified metadata...
Detecting structure...
Flattening CSS and remapping font sizes...
Source base font size is 12.00000pt
Removing fake margins...
Cleaning up manifest...
Trimming unused files from manifest...
Trimming 'nav.xhtml' from manifest
Creating PDF Output...
67% Exécution de l'extension PDF Output
Traceback (most recent call last):
File "runpy.py", line 198, in _run_module_as_main
File "runpy.py", line 88, in _run_code
File "site.py", line 47, in <module>
File "site.py", line 43, in main
File "calibre/ebooks/conversion/cli.py", line 422, in main
File "calibre/ebooks/conversion/plumber.py", line 1294, in run
File "calibre/ebooks/conversion/plugins/pdf_output.py", line 190, in convert
File "calibre/ebooks/conversion/plugins/pdf_output.py", line 256, in convert_text
File "calibre/ebooks/conversion/plugins/oeb_output.py", line 32, in convert
File "calibre/ebooks/oeb/base.py", line 1971, in to_opf2
File "calibre/ebooks/oeb/base.py", line 1278, in to_opf2
File "calibre/ebooks/oeb/base.py", line 364, in element
File "src/lxml/etree.pyx", line 3186, in lxml.etree.SubElement
File "src/lxml/apihelpers.pxi", line 206, in lxml.etree._makeSubElement
File "src/lxml/apihelpers.pxi", line 201, in lxml.etree._makeSubElement
File "src/lxml/apihelpers.pxi", line 325, in lxml.etree._initNodeAttributes
File "src/lxml/apihelpers.pxi", line 336, in lxml.etree._addAttributeToNode
File "src/lxml/apihelpers.pxi", line 1528, in lxml.etree._utf8
TypeError: Argument must be bytes or unicode, got 'NoneType'
Is it impossible the date and time when the conversion occurs?