feat(api): PDF Footers!
Image only chapters aren't packaged, that's a bug. Fixed a bug with the cover image not being included when download_images was False.
This commit is contained in:
@@ -491,6 +491,8 @@ class PDFGenerator:
|
|||||||
for image_container in html.find_all("p", {"data-media-type": "image"}):
|
for image_container in html.find_all("p", {"data-media-type": "image"}):
|
||||||
img = image_container.findChild("img")
|
img = image_container.findChild("img")
|
||||||
source = img.get("src")
|
source = img.get("src")
|
||||||
|
if not download_images and source:
|
||||||
|
img["src"] = ""
|
||||||
image_container.replace_with(img)
|
image_container.replace_with(img)
|
||||||
image_sources.append(source)
|
image_sources.append(source)
|
||||||
|
|
||||||
@@ -524,7 +526,13 @@ class PDFGenerator:
|
|||||||
self.file.name,
|
self.file.name,
|
||||||
cover=cover_file.file.name,
|
cover=cover_file.file.name,
|
||||||
toc={"toc-header-text": "Table of Contents"},
|
toc={"toc-header-text": "Table of Contents"},
|
||||||
options={"images" if download_images else "no-images": ""},
|
options={
|
||||||
|
"footer-html": "footer.html",
|
||||||
|
"margin-top": "10mm",
|
||||||
|
"margin-bottom": "10mm",
|
||||||
|
"title": self.data["title"],
|
||||||
|
"encoding": "UTF-8",
|
||||||
|
},
|
||||||
cover_first=True,
|
cover_first=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html><head><script>
|
||||||
|
function subst() {
|
||||||
|
var vars = {};
|
||||||
|
var query_strings_from_url = document.location.search.substring(1).split('&');
|
||||||
|
for (var query_string in query_strings_from_url) {
|
||||||
|
if (query_strings_from_url.hasOwnProperty(query_string)) {
|
||||||
|
var temp_var = query_strings_from_url[query_string].split('=', 2);
|
||||||
|
vars[temp_var[0]] = decodeURI(temp_var[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var css_selector_classes = ['page', 'frompage', 'topage', 'webpage', 'section', 'subsection', 'date', 'isodate', 'time', 'title', 'doctitle', 'sitepage', 'sitepages'];
|
||||||
|
for (var css_class in css_selector_classes) {
|
||||||
|
if (css_selector_classes.hasOwnProperty(css_class)) {
|
||||||
|
var element = document.getElementsByClassName(css_selector_classes[css_class]);
|
||||||
|
for (var j = 0; j < element.length; ++j) {
|
||||||
|
element[j].textContent = vars[css_selector_classes[css_class]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script></head><body style="border:0; margin: 0;" onload="subst()">
|
||||||
|
<table style="border-bottom: 1px solid black; width: 100%">
|
||||||
|
<tr>
|
||||||
|
<td style="text-align:right">
|
||||||
|
<strong style="margin-right: 5px;"><span class="section"></span></strong> | <span class="page" style="margin-left: 5px;"></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body></html>
|
||||||
Reference in New Issue
Block a user