X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/55e8586118a522d262a7b337ccf8a83cfb458054..08329a32008649fa633b364f67841846d1034767:/librarian/pdf.py diff --git a/librarian/pdf.py b/librarian/pdf.py index ca18f70..af3d1df 100644 --- a/librarian/pdf.py +++ b/librarian/pdf.py @@ -174,7 +174,8 @@ def package_available(package, args='', verbose=False): def transform(wldoc, verbose=False, save_tex=None, morefloats=None, - cover=None, flags=None, customizations=None): + cover=None, flags=None, customizations=None, + imgdir=""): """ produces a PDF file with XeLaTeX wldoc: a WLDocument @@ -228,7 +229,7 @@ def transform(wldoc, verbose=False, save_tex=None, morefloats=None, style = etree.parse(style_filename) texml = document.transform(style) - + # etree.dump(texml.getroot()) # TeXML -> LaTeX temp = mkdtemp('-wl2pdf') @@ -236,6 +237,13 @@ def transform(wldoc, verbose=False, save_tex=None, morefloats=None, with open(os.path.join(temp, 'cover.jpg'), 'w') as f: the_cover.save(f) + shutil.copy("cce_trust.eps", temp) + shutil.copy("logo.eps", temp) + for img in document.edoc.findall('//ilustr'): + # print "--->> %s %s %s" % (imgdir, img, img.get('src')) + shutil.copy(os.path.join(imgdir, img.get('src')), temp) + + del document # no longer needed large object :) tex_path = os.path.join(temp, 'doc.tex') @@ -271,6 +279,7 @@ def transform(wldoc, verbose=False, save_tex=None, morefloats=None, return OutputFile.from_filename(output_file.name) except (XMLSyntaxError, XSLTApplyError), e: + print e raise ParseError(e)