springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2021-07-26 10:56:37
357
我有一个关于使用Weazy Print在Django项目中生成PDF的问题
所以我所做的件事是确保PDF按照下面的函数中包含的CSS文件正确显示在views.py:
中def admin_order_pdf(request, info_id):
info = get_object_or_404(Info, id=info_id)
html = render_to_string('businessplan/pdf.html', {'info': info})
response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = 'filename="order_{}.pdf"'.format(
Info.id)
weasyprint.HTML(string=html,base_url=request.build_absolute_uri()).write_pdf(response,
stylesheets=[weasyprint.CSS(settings.STATICFILES_DIRS[0] + '\css\\report.css')], presentational_hints=True)
return response
其次,我已经在report.css中包含了{% load static %}
,并且我正在尝试使用以下方式访问图像文件:
@page :first {
background: url('{% static "img/report-cover.jpg" %}') no-repeat center;
background-size: cover;
margin: 0; }
我查看了以下问题及其答案,但这些问题无助于实现显示图像的目标:
使用Weasyprint不显示图像的PDF输出(Django) 在pdf weasyprint中附加img文件我的试验:
我可以通过在html页面中@page :first
之间添加<style></style>
来获得显示的图像,但我的问题是我需要链接其他东西,比如字体和SVG,所以我想知道我做错了什么,不允许css文件显示静态文件中的内容。
我的问题要更加明确:
我希望能够链接静态文件夹中的文件,以便从report.css
文件中显示
顺晟科技:
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11