मैं HTML से एक pdf फ़ाइल पीसा का उपयोग कर उत्पन्न:सीएसएस Django
def fetch_resources(uri, rel):
path = os.path.join(settings.MEDIA_ROOT, uri.replace(settings.MEDIA_URL, ""))
return path
def write_pdf(template_src, context_dict, filename):
template = get_template(template_src)
context = Context(context_dict)
html = template.render(context)
result = open(filename, 'wb')
pdf = pisa.pisaDocument(StringIO.StringIO(
html.encode("UTF-8")), result, link_callback=fetch_resources)
result.close()
मेरे एचटीएमएल बाह्य CSS लिए एक लिंक है और ठीक से प्रदान की गई है, लेकिन सीएसएस द्वारा नहीं किया जाता पीसा (उदाहरण के लिए फ़ॉन्ट आकार, टेबल सेल चौड़ाई, पाठ-संरेखण ...)।
<!DOCTYPE html>
<html lang="fr">
<head>
<link rel="stylesheet" href="/site_media/style/style.css" />
</head>
<body>
....
क्या मुझे कुछ याद आया?
धन्यवाद
आपको अपना खुद का [लिंक लोडर] लागू करना पड़ सकता है (https://github.com/chrisglass/xhtml2pdf/blob/master/test/linkloading.py) ..? –