From e5cdec6073d32f41373105919929ed066fbe588a Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Fri, 14 Dec 2018 12:29:28 +0100 Subject: [PATCH] try using b64 encoded inline svgs --- screenless/bureau/publications/news.html | 7 ++++--- screenless/bureau/publications/publications.py | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/screenless/bureau/publications/news.html b/screenless/bureau/publications/news.html index 8043d12..5840212 100644 --- a/screenless/bureau/publications/news.html +++ b/screenless/bureau/publications/news.html @@ -6,6 +6,7 @@ @media print { @page { size: A4; + margin: 1cm; } } html { @@ -76,9 +77,9 @@ text-align: left; margin-top: 0.25em; } - .entry .barcode svg { - width: 100%; - height: auto; + .entry .barcode img { + /*width: 100%; + height: auto;*/ /*width: 130%; margin-left: -15%;*/ } diff --git a/screenless/bureau/publications/publications.py b/screenless/bureau/publications/publications.py index 508aaca..eb6275c 100644 --- a/screenless/bureau/publications/publications.py +++ b/screenless/bureau/publications/publications.py @@ -1,4 +1,5 @@ # publications office for reading and writing +from base64 import b64encode from datetime import datetime import io import json @@ -272,6 +273,9 @@ class Publications(Bureau): entry.source = feed.feed.title entry.dbhash = self._make_shorturl(entry.link) entry.svg = code128.svg("PBr." + entry.dbhash) + encoded_svg = b64encode(entry.svg).decode() + encoded_data = "data:image/svg+xml;charset=utf-8;base64," + encoded_svg + entry.svg = '' % encoded_data # skip bogus entries with no text if not hasattr(entry, "summary"):