forked from ScoDoc/DocScoDoc
adaptation de code de traitement des templates pdf
This commit is contained in:
parent
ecd637fb39
commit
f219b8d003
@ -60,11 +60,8 @@ from reportlab.lib.pagesizes import letter, A4, landscape
|
||||
from flask import g
|
||||
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app.scodoc.sco_utils import (
|
||||
CONFIG,
|
||||
SCODOC_LOGOS_DIR,
|
||||
LOGOS_IMAGES_ALLOWED_TYPES,
|
||||
)
|
||||
from app.scodoc.sco_logos import find_logo
|
||||
from app.scodoc.sco_utils import CONFIG
|
||||
from app import log
|
||||
from app.scodoc.sco_exceptions import ScoGenError, ScoValueError
|
||||
import sco_version
|
||||
@ -219,20 +216,16 @@ class ScolarsPageTemplate(PageTemplate):
|
||||
)
|
||||
PageTemplate.__init__(self, "ScolarsPageTemplate", [content])
|
||||
self.logo = None
|
||||
# XXX COPIED from sco_pvpdf, to be refactored (no time now)
|
||||
# Search background in dept specific dir, then in global config dir
|
||||
for image_dir in (
|
||||
SCODOC_LOGOS_DIR + "/logos_" + g.scodoc_dept + "/",
|
||||
SCODOC_LOGOS_DIR + "/", # global logos
|
||||
):
|
||||
for suffix in LOGOS_IMAGES_ALLOWED_TYPES:
|
||||
fn = image_dir + "/bul_pdf_background" + "." + suffix
|
||||
if not self.background_image_filename and os.path.exists(fn):
|
||||
self.background_image_filename = fn
|
||||
logo = find_logo(
|
||||
logoname="bul_pdf_background", dept_id=g.scodoc_dept_id, prefix=None
|
||||
)
|
||||
if logo is None:
|
||||
# Also try to use PV background
|
||||
fn = image_dir + "/letter_background" + "." + suffix
|
||||
if not self.background_image_filename and os.path.exists(fn):
|
||||
self.background_image_filename = fn
|
||||
logo = find_logo(
|
||||
logoname="letter_background", dept_id=g.scodoc_dept_id, prefix=None
|
||||
)
|
||||
if logo is not None:
|
||||
self.background_image_filename = logo.filepath
|
||||
|
||||
def beforeDrawPage(self, canvas, doc):
|
||||
"""Draws (optional) background, logo and contribution message on each page.
|
||||
|
Loading…
Reference in New Issue
Block a user